Repository navigation
v0.1.0
The first release that works end to end: HOCON text into your own Zig struct, shaped after std.json.
Added
hocon.parseFromSlice(T, gpa, source)returnsParsed(T), an arena that owns the value and is freed by onedeinit;parseFromSliceLeakytakes your arena and returns the plain value.- Into structs with nested structs, slices, optionals, enums and field defaults; a value converts as the spec's automatic type conversions say.
hocon.Value, the tree itself, whichstd.json.Stringifyprints as JSON.- The syntax: JSON as it is, comments (
#and//), root braces left out,=or:or nothing before{, newlines for commas, unquoted and multi-line strings. - Paths as keys (
a.b.c = 1), a key written again merging objects, and value concatenation of strings, lists and objects. - Substitutions
${a.b}and${?a.b}, resolved against the whole document. - The
hoconcommand prints a file as JSON and exits 1 with the reason when it does not parse or resolve.
307 of the 445 tests in the conformance suite pass. Not yet: includes, +=, and a key that refers to its own earlier value.
How much of the code in src/ is written by hand, the rest with AI, counted with git blame over the lines that are not empty, by who wrote the commit each line comes from; moved code stays its author's. The tests are left out: most of them are written with AI.
| share | |
|---|---|
| Tokenizer | 100 % |
| AST | 99 % |
| Value | 80 % |
| Config | 100 % |
| API and CLI | 66 % |
all of src/ |
92 % of 2206 lines |
| conformance to the spec | 69 % (307 of 445 tests) |