Go to file
2020-10-04 15:24:17 +08:00
corpus feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
docs chore(release): 0.3.0 2020-10-04 15:24:17 +08:00
scripts feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
src feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
tree-sitter@1ccb0ac0e8 chore: upgrade playground 2020-10-02 15:58:40 +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 chore: upgrade playground 2020-10-02 15:58:40 +08:00
.gitmodules chore: upgrade playground 2020-10-02 15:58:40 +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: initial implementation 2019-08-31 19:14:13 +08:00
CHANGELOG.md chore(release): 0.3.0 2020-10-04 15:24:17 +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
index.js feat: initial implementation 2019-08-31 19:14:13 +08:00
LICENSE feat: initial implementation 2019-08-31 19:14:13 +08:00
package.json chore(release): 0.3.0 2020-10-04 15:24:17 +08:00
README.md feat: support core schema (#13) 2020-10-04 15:19:57 +08:00
yarn.lock feat: support core schema (#13) 2020-10-04 15:19:57 +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