codec/toml
lib/codec/toml.vklib/codec/toml.vk
Pure-Veko TOML v1.0 configuration parser and encoder.
Supports [tables], [nested.tables], # comments, basic/literal strings,
integers (with _ separators), floats, booleans, arrays, and inline tables { k = v }.
Zero capabilities required.
decode = fn [src str] map
Decodes a TOML v1.0 string into nested Veko maps, blocks, strings, integers, floats, and booleans.
Executable Example
use [toml = codec/toml]
doc = toml/decode 'title = "Veko"\n[server]\nhost = "127.0.0.1"\nport = 8_080\ntls = true\ntags = ["pqc", "oro"]\n'
if doc.title != 'Veko' or doc.server.port != 8080 or doc.server.tls != true or (len doc.server.tags) != 2 [
err 'toml decode'
] else [ .ok ]
encode = fn [doc map] str
Encodes a Veko map (including nested sub-tables) into a clean TOML v1.0 string.