Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ikatyang/tree-sitter-toml
TOML grammar for tree-sitter
https://github.com/ikatyang/tree-sitter-toml
grammar toml tree-sitter
Last synced: 27 days ago
JSON representation
TOML grammar for tree-sitter
- Host: GitHub
- URL: https://github.com/ikatyang/tree-sitter-toml
- Owner: ikatyang
- License: mit
- Created: 2019-08-18T10:26:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-18T05:19:47.000Z (about 1 year ago)
- Last Synced: 2024-04-14T09:58:25.769Z (7 months ago)
- Topics: grammar, toml, tree-sitter
- Language: JavaScript
- Homepage: https://ikatyang.github.io/tree-sitter-toml/
- Size: 671 KB
- Stars: 41
- Watchers: 3
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tree-sitter-toml
[![npm](https://img.shields.io/npm/v/tree-sitter-toml.svg)](https://www.npmjs.com/package/tree-sitter-toml)
[![build](https://img.shields.io/travis/com/ikatyang/tree-sitter-toml/master.svg)](https://travis-ci.com/ikatyang/tree-sitter-toml/builds)TOML ([TOML Spec v1.0.0-rc.1](https://github.com/toml-lang/toml/blob/v1.0.0-rc.1/versions/en/toml-v1.0.0-rc.1.md)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter)
[Changelog](https://github.com/ikatyang/tree-sitter-toml/blob/master/CHANGELOG.md)
## Install
```sh
npm install tree-sitter-toml tree-sitter
```## Usage
```js
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](https://github.com/ikatyang)