Go to file
2021-03-21 20:10:14 +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.0 2021-03-14 18:37:55 +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 docs(changelog): add the missing breaking change notice 2021-03-14 18:54:33 +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 fix: add missing binding.gyp (#21) 2021-03-21 20:10:14 +08:00
README.md feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
yarn.lock chore(deps): bump ini from 1.3.5 to 1.3.7 (#14) 2020-12-12 16:54:23 +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