diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 12ef529..99c9e47 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -105,6 +105,6 @@ jobs: run: go build -o bin/interpres-decode ./cmd/interpres-decode - name: Compliance suite - # interpres implements TOML 1.0 and 1.1; the mode is pinned so an upstream + # interpres implements TOML 1.1; the mode is pinned so an upstream # default change cannot silently move the corpus. run: bin/toml-test test -decoder=bin/interpres-decode -toml=1.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e03c9a..8923205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- TOML 1.1 is the acceptance contract, and TOML 1.0 is not. The compliance + suite runs the 1.1 corpus alone, and the promise that every 1.0 document + parses exactly as before is withdrawn. Nothing that parses today stops + parsing: the 1.0 valid corpus still passes in full. The documents whose + verdict changes are the ones 1.1 relaxed, such as the `\xHH` escape + sequences 1.0 rejected. - The module path carries the /v2 suffix the Go toolchain requires of every major version 2 module: imports change to `sourcedock.dev/petrbalvin/interpres/v2`. diff --git a/README.md b/README.md index a320620..282e4d4 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # interpres -A TOML 1.0 and 1.1 parser and encoder for Go, written with the standard -library alone. `interpres` (Latin for *interpreter*) gives zero-dependency +A TOML 1.1 parser and encoder for Go, written with the standard library +alone. `interpres` (Latin for *interpreter*) gives zero-dependency programs an `encoding/json`-style API for reading and writing TOML, and passes the entire official [toml-test](https://github.com/toml-lang/toml-test) suite: 214 valid and 467 invalid cases, zero failures. ## Features -- **Full TOML 1.0 and 1.1**: bare, quoted and dotted keys; tables and arrays of +- **Full TOML 1.1**: bare, quoted and dotted keys; tables and arrays of tables; basic and literal strings including multiline, with the 1.1 `\e` and `\xHH` escapes; integers in the four radixes with `_` separators; floats with exponents, `inf` and `nan`; booleans; the four date-time kinds, seconds diff --git a/docs/API.md b/docs/API.md index 5b9e5a7..a4ade37 100644 --- a/docs/API.md +++ b/docs/API.md @@ -7,10 +7,9 @@ package. The snippets assume: import "sourcedock.dev/petrbalvin/interpres/v2" ``` -The parser accepts TOML 1.0 documents plus the TOML 1.1 extensions: date-times -and times without seconds, the `\e` and `\xHH` escape sequences, and -multi-line inline tables with comments and trailing commas. The encoder emits -TOML 1.0, which is valid under both versions. +The parser implements TOML 1.1: date-times and times without seconds, the +`\e` and `\xHH` escape sequences, and multi-line inline tables with comments +and trailing commas. The encoder emits TOML 1.1. ## Functions diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index dc376a8..39b1cb4 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -6,7 +6,7 @@ source tree; nothing is aspirational. ## Overview interpres is one public library package, one command, and one example. The -library implements the whole of TOML 1.0 and 1.1, decoding and encoding, in the +library implements the whole of TOML 1.1, decoding and encoding, in the standard library alone; the command wraps the parser for the toml-test compliance harness, against which it stands at 214 valid and 467 invalid cases with zero failures; the example demonstrates the API. @@ -43,7 +43,7 @@ Inside the library package, one file owns one concern: | File | Responsibility | |---|---| -| `parser.go` | The recursive-descent parser. Produces the `map[string]any` tree and enforces the structural rules of TOML 1.0 and 1.1 (table redefinitions, dotted keys, arrays of tables, multi-line inline tables). Reports a 1-based line on failure. | +| `parser.go` | The recursive-descent parser. Produces the `map[string]any` tree and enforces the structural rules of TOML 1.1 (table redefinitions, dotted keys, arrays of tables, multi-line inline tables). Reports a 1-based line on failure. | | `number.go` | Strict numeric tokens: integers in the four radixes with `_` separators, and floats including `inf` and `nan`. Rejects leading zeros, misplaced underscores and malformed fractions. | | `datetime.go` | The three local date-time wrapper types and `parseDateTime`, which classifies a token into the four date-time kinds under the strict TOML grammar. | | `decode.go` | Maps the parsed tree onto Go values by reflection: struct fields, maps, slices, scalar conversion with overflow checks, `Unmarshaler` dispatch. | diff --git a/interpres.go b/interpres.go index bfce423..3f7f268 100644 --- a/interpres.go +++ b/interpres.go @@ -198,8 +198,7 @@ type Unmarshaler interface { UnmarshalTOML(data any) error } -// Marshal returns the TOML encoding of v. The output stays within TOML 1.0, -// so it is valid under both TOML 1.0 and 1.1. +// Marshal returns the TOML encoding of v. The output is valid TOML 1.1. // // Marshal traverses v using reflection and applies the following rules: //