Crate yaml_parser

source ·
Expand description

Semi-tolerant YAML concrete syntax tree parser.

§Usage

let code = "";
match yaml_parser::parse(code) {
    Ok(tree) => println!("{tree:#?}"),
    Err(err) => eprintln!("{err}"),
};

It produces rowan tree if succeeded. For consuming the tree, see rowan’s docs.

To build AST from CST:

use yaml_parser::{ast::{AstNode, Root}, parse};

let code = "";
let tree = parse(code).unwrap();
let ast = Root::cast(tree);
assert!(matches!(ast, Some(Root { .. })));

Modules§

  • Abstract Syntax Tree, layered on top of untyped SyntaxNodes.

Structs§

Enums§

Functions§

  • Parse the given YAML code into CST.

Type Aliases§