Skip to main content

yaml_rt_core/
lib.rs

1//! Core types for a YAML 1.2.2 round-trip parser.
2//!
3//! This crate is intentionally dependency-free. It owns source storage, the
4//! lossless lexer and CST, semantic metadata, diagnostics, JSON Pointer
5//! operations, typed-overlay traits, editor APIs, and patch-based emission.
6//! The original source and CST remain authoritative so untouched YAML is
7//! emitted byte-for-byte.
8
9mod diagnostic;
10mod doc;
11mod edit;
12mod fragment;
13mod inline_vec;
14mod lexer;
15mod parser;
16mod patch;
17mod pointer;
18mod semantic;
19mod source;
20mod syntax;
21mod typed;
22mod value;
23
24pub use diagnostic::{Diagnostic, DiagnosticKind, ParseError, YamlError};
25pub use doc::{
26    Edit, MappingEntryStyle, ReservedDirective, TagDirective, YamlDirective, YamlDoc, YamlEvents,
27};
28pub use edit::YamlEditError;
29pub use fragment::{FragmentError, YamlFragment};
30pub use lexer::{Token, TokenKind, lex, tokens_to_string};
31pub use parser::events_to_test_string;
32pub use patch::{YamlPatch, YamlPatchError, YamlPatchErrorKind, YamlPatchOperation};
33pub use pointer::{JsonPointer, PointerError, PointerErrorKind, ReferenceToken};
34pub use semantic::SemanticKind;
35pub use source::{LineCol, NodeId, Source, Span, TARGET_YAML_VERSION};
36pub(crate) use syntax::ParsedYaml;
37pub use syntax::{
38    Children, CollectionStyle, Node, NodeKind, YamlEvent, YamlEventKind, YamlScalarStyle, parse_cst,
39};
40#[doc(hidden)]
41pub use typed::{
42    __mapping_fields_to_yaml_fragment, __mapping_overlay_to_yaml_fragment, __read_mapping_fields,
43    __read_mapping_overlay, __read_tagged_yaml_value, __read_yaml_document, __replace_yaml_value,
44    __sequence_fields_to_yaml_fragment, __tag_yaml_fragment, __typed_node_error,
45    __validate_yaml_flatten_layout, __write_mapping_fields, __write_mapping_overlay,
46    __write_tagged_yaml_value, __write_yaml_document,
47};
48pub use typed::{FromYamlDoc, ToYamlDoc, ToYamlFragment, YamlFlatten, YamlValue};
49pub use value::{
50    NonFiniteFloat, ResolvedScalar, ScalarResolveError, SemanticValueError, YamlNumber,
51    resolve_scalar, semantically_equal,
52};
53
54pub(crate) use parser::{
55    BlockChomp, Parser, ScalarStyle, decode_scalar_value_with_content_indent, directive_emit_error,
56    double_quoted_scalar_end, edits_conflict, format_scalar_value, parse_block_scalar_header,
57    parse_node_properties, plain_scalar_end, resolve_tag, single_quoted_scalar_end,
58    strip_inline_comment, validate_plain_mapping_fragment, validate_tag_directive_parts_for_emit,
59    validate_yaml_directive_version_for_emit,
60};
61pub(crate) use semantic::{SemanticBuilder, SemanticProperties, SemanticStore};
62pub(crate) use source::validate_yaml_chars;
63
64#[cfg(test)]
65mod tests;