Skip to content

v0.2.0

Choose a tag to compare

@lejmr lejmr released this 18 Oct 12:53
· 133 commits to main since this release

Includes, errors with a place, environment variables and HOCON out.

Added

  • Includes: files, file(), required() and http(s) URLs, as .conf, .json or .properties, read through hocon.parseFromFile and parseFromFileLeaky. A slow server is error.IncludeTimeout after ParseOptions.http_timeout (30 s).
  • Errors with a place: ParseOptions.diagnostics gets the file, line, column and the line itself, and render prints it with a caret, as the zig compiler does. A value of the wrong type names its path, what the type wanted and where the value is written.
  • A key written again over a substitution of itself (path = ${path} ":/opt"), and +=.
  • Environment variables: a ${…} the document does not answer reads the variable of the same name, ${X[]} a list from X_0, X_1, … (ParseOptions.env). .keep leaves them for later.
  • hocon.stringify and stringifyAlloc write any value as HOCON, an unresolved one too, which is the one file to deploy.
  • hocon.parsePath turns a path given as text into keys.
  • --env=process|none|keep on the command line.

Changed

  • parseFromSlice and parseFromSliceLeaky take ParseOptions as their last argument; .{} does what they did before.
  • hocon <file> prints HOCON; --json gives the JSON it printed before.
  • A value that starts like a number has to be a JSON number: 01 and - alone are errors, as in JSON.
  • Input over 64 MiB is error.StreamTooLong, a file that is not UTF-8 error.InvalidUtf8 at the first bad byte.

Fixed

437 of the 445 tests in the conformance suite pass, up from 307.

  • Every whitespace character the spec lists separates, a lone \r included; // right after unquoted text starts a comment.
  • A comma separates once; array elements on one line concatenate; a document that starts with [ is a list.
  • Unquoted text may start with _, % or a letter outside ASCII; 1e+5 is a number; an escaped backslash before the closing quote ends the string.
  • ${.a} is an error, as the key .a is.

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 74 %
AST 58 %
Value 19 %
Config 54 %
API and CLI 5 %
all of src/ 33 % of 5342 lines
conformance to the spec 98 % (437 of 445 tests)