treesitter-types-yaml 0.1.1

Pre-generated strongly-typed AST types for YAML (tree-sitter-yaml)
Documentation

Strongly-typed AST types for YAML, auto-generated from tree-sitter-yaml's node-types.json.

This crate is generated by treesitter-types and is automatically kept up to date when a new version of the grammar crate is released.

See the Tree-sitter project for more information about the underlying parser framework.

Example

use treesitter_types_yaml::*;

// A small YAML document.
let src = b"\
name: hello
version: 1.0.0
dependencies:
  - foo
  - bar
";

// Parse the source with tree-sitter and convert into typed AST.
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_yaml::LANGUAGE.into()).unwrap();
let tree = parser.parse(src, None).unwrap();
let stream = Stream::from_node(tree.root_node(), src).unwrap();

// A YAML stream contains one or more documents.
assert_eq!(stream.children.len(), 1);

// The document contains the top-level mapping.
let doc = &stream.children[0];
assert!(!doc.children.is_empty());
assert_eq!(doc.span.start.row, 0);