42afd6a0eb
Since the AST should reflect its logical structure as close as possible, I revert the changes from #2. This PR also renames nodes with more appropriate names. BREAKING CHANGE: - rename `file` with `document`. - rename `table_array` with `table_array_element`. - unflatten `table` and `table_array_element`, i.e., `pair`s are now their children instead of siblings. |
||
---|---|---|
corpus | ||
examples | ||
src | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.npmignore | ||
.prettierrc | ||
.travis.yml | ||
binding.gyp | ||
CHANGELOG.md | ||
grammar.js | ||
index.js | ||
LICENSE | ||
package.json | ||
README.md | ||
yarn.lock |
tree-sitter-toml
TOML (TOML Spec v0.5.0) grammar for tree-sitter
Install
npm install tree-sitter-toml tree-sitter
Usage
const Parser = require("tree-sitter");
const TOML = require("tree-sitter-toml");
const parser = new Parser();
parser.setLanguage(TOML);
const sourceCode = `
[hello]
world = true
`;
const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());
// (root
// (table
// (key)
// (pair (key) (boolean))))
License
MIT © Ika