Skip to main content

oneyaml_syntax/
lib.rs

1//! Lossless YAML 1.2.2 decoder, lexer, parser, event stream, and syntax tree
2//! underneath [oneyaml](https://docs.rs/oneyaml).
3//!
4//! For tooling (formatters, language servers, linters). Most users want
5//! `oneyaml`'s `Document` and serde API instead. **This crate has its own
6//! semver track** and may break more often than `oneyaml`.
7//!
8//! - [`decode()`]: UTF-8/16/32 input with byte order mark detection.
9//! - [`events`] / [`parse`]: the lossless event stream, whose trivia events
10//!   tile every input byte (white space, comments, indicators).
11//! - [`SyntaxTree`]: the arena syntax tree; an untouched tree emits the
12//!   input byte for byte, and its structural edits are checked so that an
13//!   edited tree always equals the parse of its own text.
14//!
15//! No `unsafe`, no panics on any input, no recursion on the input-driven
16//! path. MSRV: Rust 1.85.
17#![forbid(unsafe_code)]
18#![warn(missing_docs)]
19
20pub mod decode;
21pub mod event;
22pub mod parser;
23pub mod tree;
24
25pub use decode::{
26    Decoded, Encoder, Encoding, InvalidRun, InvalidRuns, decode, decode_strict, decode_with_limit,
27    detect_encoding, encode, first_error, run_diagnostic,
28};
29pub use event::{Event, EventKind, EventList, Sourced, check_contract, check_tiling};
30pub use oneyaml_core::Span;
31pub use parser::{Events, events, events_with, parse, parse_with};
32pub use tree::SyntaxTree;