Table of Contents

Bodu.Text.Yaml.Reader Namespace

Package

Bodu.Text.Yaml.Reader

Purpose

Bodu.Text.Yaml.Reader is the lowest tier of Bodu.Text.Yaml: a forward-only token cursor over a parsed YAML document, mirroring the Utf8JsonReader surface. Unlike its Bencode and TOML siblings the reader is buffered - construction parses the input into an in-memory node store (resolving anchors, aliases, tags, and merge keys) and Read then walks that store in document order. The YamlSerializer and both DOMs are built over it, and a custom YamlConverter<T> consumes values through it.

Key types

Example

using Bodu.Text.Yaml;
using Bodu.Text.Yaml.Reader;

var reader = new Utf8YamlReader("host: localhost\nport: 8080\n"u8);

while (reader.Read())
{
    if (reader.TokenType == YamlTokenType.PropertyName && reader.ValueTextEquals("port"u8))
    {
        reader.Read();
        long port = reader.GetInt64();   // 8080
    }
}

Notes

  • Presentation is resolved, not reported. Scalar style, block vs. flow layout, anchors, and aliases are handled during parsing; the token stream exposes only StartMapping / StartSequence, PropertyName, and the typed scalar kinds (Null, String, Integer, Float, Boolean).
  • Spec version. The 1.2 core schema is the default; V1_1 additionally accepts yes/no/on/off and sexagesimal numbers. Malformed input throws YamlFormatException with line, column, and offset.
  • See also: the Bodu.Text.Yaml introduction and the Using YAML guide (Pattern 9 - Drive the low-level reader and writer).

Structs

Utf8YamlReader

Provides a forward-only, read-only token cursor over a parsed YAML document, surfacing its nodes as structural and scalar tokens in document order. The token surface mirrors Utf8JsonReader, but the underlying reader is buffered rather than a single-pass streaming scanner.

YamlReaderOptions

Provides options that configure how YAML source is parsed by the reader and document layers.