Manuscript Documentation
v2026.12.0

@std/data/toml.ms#

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

TomlOptions Type#

Limits for parse on input bytes, nesting depth and parsed values. A field set to null adds no limit. The defaults, depth 10,000 and 1,000,000 values, guard against deeply nested or very large documents. A negative limit returns EINVAL.

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

TomlOptions.max_bytes#

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

Manuscript
max_bytes Int? = null

TomlOptions.max_depth#

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

Manuscript
max_depth Int? = 10000

TomlOptions.max_values#

Maximum containers and leaves, excluding keys; checked during parsing and materialization.

Manuscript
max_values Int? = 1000000

TomlValue Enum#

A TOML value. Date and time values retain their original TOML text.

Manuscript
enum TomlValue {
    StringValue(value String)
    IntValue(value Int)
    FloatValue(value Float)
    BoolValue(value Bool)
    DateTimeValue(text String)
    ArrayValue(values List[TomlValue])
    TableValue(values Map[String, TomlValue])
}

TomlValue.ArrayValue#

An ordered array; elements can have different TOML value kinds.

Manuscript
ArrayValue(values List[TomlValue])

TomlValue.BoolValue#

A TOML true or false value; other capitalizations are invalid.

Manuscript
BoolValue(value Bool)

TomlValue.DateTimeValue#

A validated local/offset date or time token, retained as text.

Manuscript
DateTimeValue(text String)

TomlValue.FloatValue#

A parsed floating-point number, including TOML infinity and NaN spellings.

Manuscript
FloatValue(value Float)

TomlValue.IntValue#

A parsed whole number; out-of-range input is rejected rather than truncated.

Manuscript
IntValue(value Int)

TomlValue.StringValue#

Text decoded from TOML basic or literal string syntax.

Manuscript
StringValue(value String)

TomlValue.TableValue#

An insertion-ordered table; parse returns this case even for an empty document.

Manuscript
TableValue(values Map[String, TomlValue])

TomlValue.ArrayValue.values#

Element values in document order, with ordinary mutable list storage.

Manuscript
values List[TomlValue]

TomlValue.BoolValue.value#

The decoded boolean from the lowercase TOML token.

Manuscript
value Bool

TomlValue.DateTimeValue.text#

Original accepted TOML date/time spelling, without a timezone conversion.

Manuscript
text String

TomlValue.FloatValue.value#

Numeric value of the accepted floating token, preserving signed zero.

Manuscript
value Float

TomlValue.IntValue.value#

Exact signed integer value of the accepted TOML numeric token.

Manuscript
value Int

TomlValue.StringValue.value#

Unicode contents after the applicable escapes and multiline rules.

Manuscript
value String

TomlValue.TableValue.values#

String-keyed entries produced by assignments, dotted keys and table headers.

Manuscript
values Map[String, TomlValue]

parse Function#

Parses a TOML document into a TableValue, which is empty for an empty document. Invalid TOML returns an Error with kind EBADMSG that reports the source line and column. A limit in options that the document exceeds returns EOVERFLOW.

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

stringify Function#

Writes a table value as a TOML document. Tables and arrays of tables use headers; other values are written inline. A value that is not a TableValue, or that holds a malformed date or time, returns EINVAL. Output longer than max_bytes returns EOVERFLOW.

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