Expand description
In-tree YAML parser. Produces a lossless, Panache-compatible CST that the host parser embeds directly into the document tree (frontmatter and hashpipe option bodies) and that the in-tree YAML formatter consumes.
- supports plain YAML and hashpipe-prefixed YAML from shared parsing
primitives (see
parse_stream/parse_stream_with_prefix), - preserves lossless syntax/trivia needed for exact host document ranges,
- backs first-class YAML formatting via
crate::syntax::yaml_ast.
Modules§
Structs§
Functions§
- locate_
yaml_ diagnostic - Locate a structural YAML diagnostic in
input(raw, possiblyprefix-marked), returning the diagnostic plus the byte range withininputit covers (start, end). An emptyprefixis plain YAML with identity offsets. ReturnsNonewheninputis valid — the verdict matchesvalidate_yaml_with_prefix. The host parser adds the region’s document start to emit a host-rangedSyntaxErrorfor malformed embedded YAML. - parse_
stream - Drive the scanner over
inputand build a CST. Always returns aSyntaxNode— the scanner is permissive and the builder preserves bytes regardless of well-formedness. - parse_
stream_ with_ prefix - Like
parse_stream, but treatsprefix(e.g. hashpipe"#|") as an embedded-YAML per-line marker: the scanner excludes it from column/indent accounting and the builder peels it intoYAML_LINE_PREFIXleaves, so the resulting CST’s token ranges are host ranges directly (prefix bytes included as trivia, no offset remapping). An emptyprefixbehaves likeparse_stream. - parse_
yaml_ report - Parse YAML tree structure and include diagnostics on failure.
- parse_
yaml_ tree - Parse YAML tree structure from input, or
Noneif it fails to parse. - project_
events - Walk the YAML CST for
inputand return the projected yaml-test-suite event stream. Returns an empty vector if the input fails to parse. - project_
events_ from_ tree - Walk a YAML parser CST and return the projected yaml-test-suite event
stream. Decoupled from
parse_yaml_treeso callers that already hold a tree (e.g. yaml-test-suite parity checks) can reuse the same projection. - validate_
yaml_ with_ prefix - Structural validation for embedded (prefixed) YAML. Strips the
per-line
prefixto the plain-YAML baseline and runs the standard [super::validator::validate_yaml] pass. The verdict matches the stripped baseline; diagnostic offsets refer to the stripped text (host-offset remapping is a later concern). An emptyprefixis plain validation.