tree-sitter
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -5,3 +5,3 @@ var Document = require("./binding").Document, | ||
Document.prototype.setInputString = function(string) { | ||
this.setInput(new StringInput(string)); | ||
return this.setInput(new StringInput(string)); | ||
}; | ||
@@ -8,0 +8,0 @@ |
@@ -15,6 +15,7 @@ { | ||
"main": "index.js", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"dependencies": { | ||
"bindings": "1.2.x" | ||
"bindings": "1.2.x", | ||
"nan": "1.3.x" | ||
} | ||
} |
tree-sitter | ||
=========== | ||
[![Build Status](https://travis-ci.org/maxbrunsfeld/node-tree-sitter.svg?branch=master)](https://travis-ci.org/maxbrunsfeld/node-tree-sitter) | ||
Incremental parsers for node | ||
[![Build Status](https://travis-ci.org/maxbrunsfeld/node-tree-sitter.svg?branch=master)](https://travis-ci.org/maxbrunsfeld/node-tree-sitter) | ||
### Installation | ||
``` | ||
npm install tree-sitter | ||
``` | ||
### Usage | ||
Make a document: | ||
```javascript | ||
var treeSitter = require("tree-sitter"); | ||
var document = new treeSitter.Document(); | ||
``` | ||
Create a language module using [tree-sitter-compiler](http://github.com/maxbrunsfeld/node-tree-sitter-compiler). See [the javascript module](http://github.com/maxbrunsfeld/node-tree-sitter-javascript) for an example. | ||
Set the document's language: | ||
```javascript | ||
document.setLanguage(require("tree-sitter-javascript")); | ||
``` | ||
Set the document's text: | ||
```javascript | ||
document.setInputString("var inc = function(n) { return n + 1; }; inc(5);"); | ||
``` | ||
Access the document's AST: | ||
```javascript | ||
document.toString() | ||
/* | ||
* (DOCUMENT | ||
* (program | ||
* (var_declaration | ||
* (identifier) | ||
* (function (formal_parameters (identifier)) (statement_block | ||
* (return_statement (math_op (identifier) (number)))))) | ||
* (expression_statement (function_call | ||
* (identifier) (number))))) | ||
*/ | ||
var program = document.children[0]; | ||
program.children[0]; | ||
/* | ||
* { name: 'var_declaration', | ||
* size: 40, | ||
* position: 0, | ||
* children: { length: 2 } } | ||
*/ | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1162170
128
63
2