Skip to main content

Crate oneyaml_syntax

Crate oneyaml_syntax 

Source
Expand description

Lossless YAML 1.2.2 decoder, lexer, parser, event stream, and syntax tree underneath oneyaml.

For tooling (formatters, language servers, linters). Most users want oneyaml’s Document and serde API instead. This crate has its own semver track and may break more often than oneyaml.

  • decode(): UTF-8/16/32 input with byte order mark detection.
  • events / parse: the lossless event stream, whose trivia events tile every input byte (white space, comments, indicators).
  • SyntaxTree: the arena syntax tree; an untouched tree emits the input byte for byte, and its structural edits are checked so that an edited tree always equals the parse of its own text.

No unsafe, no panics on any input, no recursion on the input-driven path. MSRV: Rust 1.85.

Re-exports§

pub use decode::Decoded;
pub use decode::Encoder;
pub use decode::InvalidRun;
pub use decode::InvalidRuns;
pub use decode::decode;
pub use decode::decode_strict;
pub use decode::decode_with_limit;
pub use decode::detect_encoding;
pub use decode::encode;
pub use decode::first_error;
pub use decode::run_diagnostic;
pub use event::Event;
pub use event::EventKind;
pub use event::EventList;
pub use event::Sourced;
pub use event::check_contract;
pub use event::check_tiling;
pub use parser::Events;
pub use parser::events;
pub use parser::events_with;
pub use parser::parse;
pub use parser::parse_with;
pub use tree::SyntaxTree;

Modules§

decode
Input decoding (YAML 1.2.2 §5.2): bytes in UTF-8, UTF-16 LE/BE, or UTF-32 LE/BE to the UTF-8 text the parser reads.
event
The public lossless event stream.
parser
The YAML 1.2.2 parser: source text to the lossless event stream.
tree
The lossless syntax tree.

Structs§

Span
A UTF-8 byte range start..end into the source text.

Enums§

Encoding
A character encoding of YAML input (§5.2).