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 lexer;
14mod parser;
15mod pointer;
16mod semantic;
17mod source;
18mod syntax;
19mod typed;
20mod value;
21
22pub use diagnostic::{Diagnostic, DiagnosticKind, ParseError, YamlError};
23pub use doc::{
24    Edit, MappingEntryStyle, ReservedDirective, TagDirective, YamlDirective, YamlDoc, YamlEvents,
25};
26pub use edit::YamlEditError;
27pub use fragment::{FragmentError, YamlFragment};
28pub use lexer::{Token, TokenKind, lex, tokens_to_string};
29pub use parser::events_to_test_string;
30pub use pointer::{JsonPointer, PointerError, PointerErrorKind, ReferenceToken};
31pub use semantic::SemanticKind;
32pub use source::{LineCol, NodeId, Source, Span, TARGET_YAML_VERSION};
33pub(crate) use syntax::ParsedYaml;
34pub use syntax::{
35    Children, CollectionStyle, Node, NodeKind, YamlEvent, YamlEventKind, YamlScalarStyle, parse_cst,
36};
37#[doc(hidden)]
38pub use typed::{
39    __mapping_fields_to_yaml_fragment, __mapping_overlay_to_yaml_fragment, __read_mapping_fields,
40    __read_mapping_overlay, __read_tagged_yaml_value, __read_yaml_document, __replace_yaml_value,
41    __sequence_fields_to_yaml_fragment, __tag_yaml_fragment, __typed_node_error,
42    __write_mapping_fields, __write_mapping_overlay, __write_tagged_yaml_value,
43    __write_yaml_document,
44};
45pub use typed::{FromYamlDoc, ToYamlDoc, ToYamlFragment, YamlValue};
46pub use value::{
47    NonFiniteFloat, ResolvedScalar, ScalarResolveError, SemanticValueError, YamlNumber,
48    resolve_scalar, semantically_equal,
49};
50
51pub(crate) use parser::{
52    BlockChomp, Parser, ScalarStyle, decode_scalar_value_with_content_indent, directive_emit_error,
53    double_quoted_scalar_end, edits_conflict, format_scalar_value, parse_block_scalar_header,
54    parse_node_properties, plain_scalar_end, resolve_tag, single_quoted_scalar_end,
55    strip_inline_comment, validate_plain_mapping_fragment, validate_tag_directive_parts_for_emit,
56    validate_yaml_directive_version_for_emit,
57};
58pub(crate) use semantic::{SemanticBuilder, SemanticProperties, SemanticStore};
59pub(crate) use source::validate_yaml_chars;
60
61#[cfg(test)]
62mod tests;