Expand description
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);Re-exports§
pub use tree_sitter_yaml;pub use treesitter_types::tree_sitter;
Structs§
- Alias
- Alias
Name - Anchor
- Anchor
Name - Block
Mapping - Block
Mapping Pair - Block
Node - Block
Scalar - Block
Sequence - Block
Sequence Item - Boolean
Scalar - Comment
- Directive
Name - Directive
Parameter - Document
- Double
Quote Scalar - Escape
Sequence - Float
Scalar - Flow
Mapping - Flow
Node - Flow
Pair - Flow
Sequence - Integer
Scalar - Null
Scalar - Plain
Scalar - Reserved
Directive - Single
Quote Scalar - Span
- Stream
- String
Scalar - Tag
- TagDirective
- TagHandle
- TagPrefix
- Timestamp
Scalar - Yaml
Directive - Yaml
Version
Enums§
- AnyNode
- Block
Mapping Pair Key - Block
Mapping Pair Value - Block
Node Children - Block
Sequence Item Children - Document
Children - Flow
Mapping Children - Flow
Node Children - Flow
Sequence Children - Parse
Error - Plain
Scalar Children - Reserved
Directive Children - TagDirective
Children