Manuscript Documentation
v2026.12.0

@std/data/yaml.ms#

Import each required symbol with import Name from "@std/data/yaml.ms".

YamlOptions Type#

Limits for parse and parse_all on input bytes, nesting depth and parsed values. A limit set to null adds no limit. The defaults, depth 10,000 and 1,000,000 values, guard against deep nesting and alias expansion. A negative limit returns EINVAL, and a document that exceeds one returns EOVERFLOW.

Manuscript
type YamlOptions {
    max_bytes Int? = null
    max_depth Int? = 10000
    max_values Int? = 1000000
}

YamlOptions.max_bytes#

Maximum UTF-8 input bytes before line-ending normalization; null adds no budget.

Manuscript
max_bytes Int? = null

YamlOptions.max_depth#

Maximum value depth, including scalar leaves, with the root at one.

Manuscript
max_depth Int? = 10000

YamlOptions.max_values#

Maximum containers and leaves, excluding keys; aliases count at each checked occurrence.

Manuscript
max_values Int? = 1000000

YamlValue Enum#

A YAML value represented as null, boolean, number text, string, array, or object.

Manuscript
enum YamlValue {
    Null
    BoolValue(value Bool)
    NumberValue(text String)
    StringValue(value String)
    ArrayValue(values List[YamlValue])
    ObjectValue(values Map[String, YamlValue])
}

YamlValue.ArrayValue#

An ordered YAML sequence with ordinary mutable list storage.

Manuscript
ArrayValue(values List[YamlValue])

YamlValue.BoolValue#

A core-schema true or false value; yes and no remain strings.

Manuscript
BoolValue(value Bool)

YamlValue.Null#

YAML null, including an empty document or a plain null spelling.

Manuscript
Null

YamlValue.NumberValue#

Numeric token text retained exactly instead of being coerced into Float.

Manuscript
NumberValue(text String)

YamlValue.ObjectValue#

A textual-key mapping, with insertion order and duplicate-key checks.

Manuscript
ObjectValue(values Map[String, YamlValue])

YamlValue.StringValue#

Text decoded from a quoted, plain or block scalar.

Manuscript
StringValue(value String)

YamlValue.ArrayValue.values#

Sequence entries in document order, retaining nested references.

Manuscript
values List[YamlValue]

YamlValue.BoolValue.value#

The decoded boolean selected from YAML core-schema spellings.

Manuscript
value Bool

YamlValue.NumberValue.text#

Original numeric spelling, including supported base prefixes and nonfinite spellings.

Manuscript
text String

YamlValue.ObjectValue.values#

Decoded string keys and their values; aliases may share nested payloads.

Manuscript
values Map[String, YamlValue]

YamlValue.StringValue.value#

Resulting Unicode text after escape decoding, folding and chomping.

Manuscript
value String

parse Function#

Parses a single YAML document. A stream of several documents is an error; use parse_all for it. Invalid input returns EBADMSG and unsupported YAML syntax returns ENOTSUP; both errors include the source location.

Manuscript
fn parse(text String, options YamlOptions = YamlOptions()) Result[YamlValue, Error] { ... }

parse_all Function#

Parses a stream of YAML documents separated by --- or ended by ..., returning one value per document in order. A document with no content is null; input with no document at all is an empty list. Anchors, tag handles and limits apply to each document on its own.

Manuscript
fn parse_all(text String, options YamlOptions = YamlOptions()) Result[List[YamlValue], Error] { ... }

stringify Function#

Writes a YAML value in block style with double-quoted strings. Output longer than max_bytes returns EOVERFLOW, and a negative max_bytes returns EINVAL.

Manuscript
fn stringify(value YamlValue, max_bytes Int? = null) Result[String, Error] { ... }