Manuscript Documentation
v0.1.0

@std/yaml.ms#

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

YamlError Alternative#

Errors returned for malformed YAML, unsupported features, or exceeded resource limits.

Manuscript
type YamlError:
    case InvalidInput
    case InvalidData(line: Int, column: Int, reason: String)
    case UnsupportedFeature(line: Int, reason: String)
    case LimitExceeded
Manuscript
impl Error for YamlError:
    fn message() -> String:

YamlError.InvalidData#

Malformed YAML or a form outside the supported parser’s accepted grammar.

Manuscript
case InvalidData(line: Int, column: Int, reason: String)

YamlError.InvalidInput#

A supplied limit is negative, or stringify received a number whose text is not a YAML number.

Manuscript
case InvalidInput

YamlError.LimitExceeded#

Parsing or validating the returned alias-expanded tree exceeds a supplied budget.

Manuscript
case LimitExceeded

YamlError.UnsupportedFeature#

An explicit tag, complex key or directive unsupported by this configuration parser.

Manuscript
case UnsupportedFeature(line: Int, reason: String)

YamlError.InvalidData.column#

One-based Unicode scalar column within that source line.

Manuscript
column: Int

YamlError.InvalidData.line#

One-based source line of the offending token or construct.

Manuscript
line: Int

YamlError.InvalidData.reason#

Parser diagnostic describing the malformed construct.

Manuscript
reason: String

YamlError.UnsupportedFeature.line#

One-based source line where the unsupported construct appears.

Manuscript
line: Int

YamlError.UnsupportedFeature.reason#

Diagnostic identifying the unsupported syntax or feature.

Manuscript
reason: String

YamlError.Error.message#

Formats parser positions and reason text; match the typed fields for programmatic handling.

Manuscript
fn message() -> String:

YamlLimits Record#

Optional input-byte, nesting-depth, and parsed-value limits for YAML parsing.

Manuscript
type YamlLimits:
    max_bytes: Optional[Int] = none
    max_depth: Optional[Int] = none
    max_values: Optional[Int] = none

YamlLimits.max_bytes#

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

Manuscript
max_bytes: Optional[Int] = none

YamlLimits.max_depth#

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

Manuscript
max_depth: Optional[Int] = none

YamlLimits.max_values#

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

Manuscript
max_values: Optional[Int] = none

YamlValue Alternative#

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

Manuscript
type YamlValue:
    case Null
    case BoolValue(value: Bool)
    case NumberValue(text: String)
    case StringValue(value: String)
    case ArrayValue(values: List[YamlValue])
    case ObjectValue(values: Map[String, YamlValue])

YamlValue.ArrayValue#

An ordered YAML sequence with ordinary mutable list storage.

Manuscript
case ArrayValue(values: List[YamlValue])

YamlValue.BoolValue#

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

Manuscript
case BoolValue(value: Bool)

YamlValue.Null#

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

Manuscript
case Null

YamlValue.NumberValue#

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

Manuscript
case NumberValue(text: String)

YamlValue.ObjectValue#

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

Manuscript
case ObjectValue(values: Map[String, YamlValue])

YamlValue.StringValue#

Text decoded from a quoted, plain or block scalar.

Manuscript
case 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 YAML document. Unsupported YAML features and invalid input include source locations.

Manuscript
fn parse(text: String, limits: Optional[YamlLimits] = none) -> Result[YamlValue, YamlError]:

stringify Function#

Serializes a YAML value in block style with double-quoted strings.

Manuscript
fn stringify(value: YamlValue, max_bytes: Optional[Int] = none) -> Result[String, YamlError]: