Go to file
dependabot[bot] 2240ccd053
chore(deps): bump y18n from 4.0.0 to 4.0.1 (#22)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-31 21:35:12 +08:00
bindings/node feat: upgrade to tree-sitter@0.19.3 (#19) 2021-03-14 18:33:18 +08:00
corpus feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
docs chore(release): 0.4.1 2021-03-21 20:14:05 +08:00
scripts feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
src feat: upgrade to tree-sitter@0.19.3 (#19) 2021-03-14 18:33:18 +08:00
tree-sitter@fc5a692b7d feat: upgrade to tree-sitter@0.19.3 (#19) 2021-03-14 18:33:18 +08:00
yaml-test-suite@053b73a9c1 feat: initial implementation 2019-08-31 19:14:13 +08:00
.editorconfig feat: initial implementation 2019-08-31 19:14:13 +08:00
.gitattributes chore: add playground 2019-09-01 02:06:30 +08:00
.gitignore feat: upgrade to tree-sitter@0.19.3 (#19) 2021-03-14 18:33:18 +08:00
.gitmodules build: correct the branch name in .gitmodules 2021-03-14 18:53:46 +08:00
.npmignore feat: initial implementation 2019-08-31 19:14:13 +08:00
.travis.yml chore: use tree-sitter-cli@0.15.9-custom 2019-09-30 14:33:07 +08:00
binding.gyp feat: upgrade to tree-sitter@0.19.3 (#19) 2021-03-14 18:33:18 +08:00
CHANGELOG.md chore(release): 0.4.1 2021-03-21 20:14:05 +08:00
grammar-schema.js feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
grammar.js feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
LICENSE feat: initial implementation 2019-08-31 19:14:13 +08:00
package.json chore(release): 0.4.1 2021-03-21 20:14:05 +08:00
README.md feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
yarn.lock chore(deps): bump y18n from 4.0.0 to 4.0.1 (#22) 2021-03-31 21:35:12 +08:00

tree-sitter-yaml

npm build

YAML (YAML Spec v1.2) grammar for tree-sitter

Changelog

Install

npm install tree-sitter-yaml tree-sitter

Usage

const Parser = require("tree-sitter");
const YAML = require("tree-sitter-yaml");

const parser = new Parser();
parser.setLanguage(YAML);

const sourceCode = `
!!map
hello: &anchor
- world
`;

const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());
// (stream
//   (document
//     (block_node
//       (tag)
//       (block_mapping
//         (block_mapping_pair
//           key: (flow_node
//             (plain_scalar
//               (string_scalar)))
//           value: (block_node
//             (anchor)
//             (block_sequence
//               (block_sequence_item
//                 (flow_node
//                   (plain_scalar
//                     (string_scalar)))))))))))

License

MIT © Ika