a3812033af
Input: ```toml [table] key = "value" ``` Output: ```sh # before (root (table (key) (pair (key) (string))) # after (root (table (key)) (pair (key) (string))) ``` |
||
---|---|---|
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 (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