mirror of
https://github.com/tree-sitter/tree-sitter-toml.git
synced 2026-11-17 03:10:33 +00:00
TOML grammar for tree-sitter
- JavaScript 49.6%
- Rust 19.5%
- C 19.2%
- C++ 6.6%
- Tree-sitter Query 4.4%
- Other 0.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| bindings | ||
| corpus | ||
| docs | ||
| examples | ||
| queries | ||
| scripts | ||
| src | ||
| toml-spec | ||
| tree-sitter@fc5a692b7d | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| .npmignore | ||
| .travis.yml | ||
| binding.gyp | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| grammar.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| yarn.lock | ||
tree-sitter-toml
TOML (TOML Spec v1.0.0-rc.1) 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());
// (document
// (table
// (key)
// (pair
// (key) (boolean))))
License
MIT © Ika