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