Go to file
Ika 42afd6a0eb
feat: unflatten structure and rename nodes (#4)
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.
2019-08-31 22:16:56 +08:00
corpus feat: unflatten structure and rename nodes (#4) 2019-08-31 22:16:56 +08:00
examples feat: initial implementation 2019-08-18 18:30:34 +08:00
src feat: unflatten structure and rename nodes (#4) 2019-08-31 22:16:56 +08:00
.editorconfig fix: trailing whitespaces are allowed for local_time (#3) 2019-08-21 09:13:14 +08:00
.gitattributes chore: update gitattributes and add prepack script 2019-08-18 21:13:19 +08:00
.gitignore feat: initial implementation 2019-08-18 18:30:34 +08:00
.npmignore feat: initial implementation 2019-08-18 18:30:34 +08:00
.prettierrc chore: update formatting 2019-08-22 17:22:58 +08:00
.travis.yml feat: initial implementation 2019-08-18 18:30:34 +08:00
binding.gyp feat: initial implementation 2019-08-18 18:30:34 +08:00
CHANGELOG.md chore(release): 0.1.3 2019-08-21 09:14:02 +08:00
grammar.js feat: unflatten structure and rename nodes (#4) 2019-08-31 22:16:56 +08:00
index.js feat: initial implementation 2019-08-18 18:30:34 +08:00
LICENSE feat: initial implementation 2019-08-18 18:30:34 +08:00
package.json chore(release): 0.1.3 2019-08-21 09:14:02 +08:00
README.md chore: update formatting 2019-08-22 17:22:58 +08:00
yarn.lock refactor: replace external tokens with internal ones 2019-08-19 23:58:20 +08:00

tree-sitter-toml

npm build

TOML (TOML Spec v0.5.0) grammar for tree-sitter

Changelog

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