toml.parse reads TOML 1.0 in full, and
toml.encode writes it. Arrays, floats, inline tables,
dotted keys, arrays of tables and the four date and time types all
parse, so a config file written to the spec is a config file SCUA can
read.
import toml
match toml.parse(text)
Ok(cfg) -> print((cfg @ "worker")[1] @ "name")
Error(why) -> print(why)
end
An array is an array you can index and iterate.
[[worker]] is an array of tables, in file order. A date is
a datetime you can do arithmetic on rather than a string
you have to parse again. Integers take the 0x,
0o and 0b bases and 1_000
underscores, floats take inf and nan, and
strings come in all four TOML spellings with escapes processed where the
spec says they should be.
The parser is a rewrite rather than an extension. Arrays and inline tables span lines, so a line-at-a-time shape could not reach them at any amount of effort. If you carry a workaround for a TOML construct SCUA did not read, you can drop it.
Dates are checked rather than normalised. 1979-99-99 and
2026-01-32 are refused as the impossible dates they are,
with leap years counted properly, so a typo in a config file stops the
run instead of becoming a plausible neighbouring date. A document that
fails to parse names the line it failed on.
toml.encode sorts its keys, so the same table produces
the same text every run and a config file does not reshuffle itself in
version control. Exact decimal and money
values are written as strings, because TOML's only number types are
64-bit integer and float and either would drop the exactness those types
exist to hold. A value with no TOML form at all, like
bytes, raises a fault instead of being approximated into
one.
Before you round-trip a file, two limits. A bare local time,
07:32:00 with no date, reads as a string, because SCUA has
no time-of-day type and inventing a date for it would be worse than
saying so. And a date's spelling does not survive a read-modify-write: a
datetime is an instant plus an offset and carries no record
of having been written date-only, so 2026-08-19 read in and
written back out comes out as 2026-08-19T00:00:00Z. Same
instant, longer spelling. Where the exact shape of a file matters, edit
the text.