docs: drop the TOML 1.0 compatibility promise
Assisted-by: DeepSeek V4.1 Flash
This commit is contained in:
@@ -105,6 +105,6 @@ jobs:
|
|||||||
run: go build -o bin/interpres-decode ./cmd/interpres-decode
|
run: go build -o bin/interpres-decode ./cmd/interpres-decode
|
||||||
|
|
||||||
- name: Compliance suite
|
- 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.
|
# default change cannot silently move the corpus.
|
||||||
run: bin/toml-test test -decoder=bin/interpres-decode -toml=1.1
|
run: bin/toml-test test -decoder=bin/interpres-decode -toml=1.1
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### 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
|
- The module path carries the /v2 suffix the Go toolchain requires of
|
||||||
every major version 2 module: imports change to
|
every major version 2 module: imports change to
|
||||||
`sourcedock.dev/petrbalvin/interpres/v2`.
|
`sourcedock.dev/petrbalvin/interpres/v2`.
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# interpres
|
# interpres
|
||||||
|
|
||||||
A TOML 1.0 and 1.1 parser and encoder for Go, written with the standard
|
A TOML 1.1 parser and encoder for Go, written with the standard library
|
||||||
library alone. `interpres` (Latin for *interpreter*) gives zero-dependency
|
alone. `interpres` (Latin for *interpreter*) gives zero-dependency
|
||||||
programs an `encoding/json`-style API for reading and writing TOML, and passes
|
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:
|
the entire official [toml-test](https://github.com/toml-lang/toml-test) suite:
|
||||||
214 valid and 467 invalid cases, zero failures.
|
214 valid and 467 invalid cases, zero failures.
|
||||||
|
|
||||||
## Features
|
## 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
|
tables; basic and literal strings including multiline, with the 1.1 `\e` and
|
||||||
`\xHH` escapes; integers in the four radixes with `_` separators; floats with
|
`\xHH` escapes; integers in the four radixes with `_` separators; floats with
|
||||||
exponents, `inf` and `nan`; booleans; the four date-time kinds, seconds
|
exponents, `inf` and `nan`; booleans; the four date-time kinds, seconds
|
||||||
|
|||||||
+3
-4
@@ -7,10 +7,9 @@ package. The snippets assume:
|
|||||||
import "sourcedock.dev/petrbalvin/interpres/v2"
|
import "sourcedock.dev/petrbalvin/interpres/v2"
|
||||||
```
|
```
|
||||||
|
|
||||||
The parser accepts TOML 1.0 documents plus the TOML 1.1 extensions: date-times
|
The parser implements TOML 1.1: date-times and times without seconds, the
|
||||||
and times without seconds, the `\e` and `\xHH` escape sequences, and
|
`\e` and `\xHH` escape sequences, and multi-line inline tables with comments
|
||||||
multi-line inline tables with comments and trailing commas. The encoder emits
|
and trailing commas. The encoder emits TOML 1.1.
|
||||||
TOML 1.0, which is valid under both versions.
|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ source tree; nothing is aspirational.
|
|||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
interpres is one public library package, one command, and one example. The
|
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
|
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
|
compliance harness, against which it stands at 214 valid and 467 invalid cases
|
||||||
with zero failures; the example demonstrates the API.
|
with zero failures; the example demonstrates the API.
|
||||||
@@ -43,7 +43,7 @@ Inside the library package, one file owns one concern:
|
|||||||
|
|
||||||
| File | Responsibility |
|
| 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. |
|
| `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. |
|
| `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. |
|
| `decode.go` | Maps the parsed tree onto Go values by reflection: struct fields, maps, slices, scalar conversion with overflow checks, `Unmarshaler` dispatch. |
|
||||||
|
|||||||
+1
-2
@@ -198,8 +198,7 @@ type Unmarshaler interface {
|
|||||||
UnmarshalTOML(data any) error
|
UnmarshalTOML(data any) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal returns the TOML encoding of v. The output stays within TOML 1.0,
|
// Marshal returns the TOML encoding of v. The output is valid TOML 1.1.
|
||||||
// so it is valid under both TOML 1.0 and 1.1.
|
|
||||||
//
|
//
|
||||||
// Marshal traverses v using reflection and applies the following rules:
|
// Marshal traverses v using reflection and applies the following rules:
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user