3 Commits
Author SHA1 Message Date
petrbalvin 942c4b1489 docs(security): list the newest release as supported
Test / test (push) Successful in 1m33s
Assisted-by: DeepSeek V4.1 Flash
2026-09-19 02:24:24 +02:00
petrbalvin 8f0eae6604 docs: drop the TOML 1.0 compatibility promise
Assisted-by: DeepSeek V4.1 Flash
2026-09-19 02:24:24 +02:00
petrbalvin 1c7329aeea build: move the module path to /v2
Test / test (push) Successful in 1m32s
Assisted-by: GLM 5.3 Flash
2026-09-19 00:14:39 +02:00
12 changed files with 31 additions and 21 deletions
+1 -1
View File
@@ -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
+12
View File
@@ -11,6 +11,18 @@ 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`.
## [1.1.0] - 2026-09-18
### Added
+4 -4
View File
@@ -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
@@ -29,7 +29,7 @@ the entire official [toml-test](https://github.com/toml-lang/toml-test) suite:
As a library:
```sh
go get sourcedock.dev/petrbalvin/interpres
go get sourcedock.dev/petrbalvin/interpres/v2
```
Requires Go 1.27.1 or newer. The module imports only the standard library.
+1 -1
View File
@@ -7,7 +7,7 @@ releases do not receive them.
| Version | Supported |
|---|---|
| 1.0.0 | yes |
| 1.1.0 | yes |
| older releases | no |
## Reporting a vulnerability
+1 -1
View File
@@ -25,7 +25,7 @@ import (
"strconv"
"time"
"sourcedock.dev/petrbalvin/interpres"
"sourcedock.dev/petrbalvin/interpres/v2"
)
func main() {
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"testing"
"time"
"sourcedock.dev/petrbalvin/interpres"
"sourcedock.dev/petrbalvin/interpres/v2"
)
func TestRunParsesValidTOML(t *testing.T) {
+5 -6
View File
@@ -1,16 +1,15 @@
# API
The library exports the surface below from the `sourcedock.dev/petrbalvin/interpres`
The library exports the surface below from the `sourcedock.dev/petrbalvin/interpres/v2`
package. The snippets assume:
```go
import "sourcedock.dev/petrbalvin/interpres"
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
+2 -2
View File
@@ -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. |
+1 -1
View File
@@ -5,7 +5,7 @@ the toml-test harness adapter, and it also validates documents. Install it
with Go itself, no release assets involved:
```sh
go install sourcedock.dev/petrbalvin/interpres/cmd/interpres-decode@latest
go install sourcedock.dev/petrbalvin/interpres/v2/cmd/interpres-decode@latest
```
## Synopsis
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"os"
"time"
"sourcedock.dev/petrbalvin/interpres"
"sourcedock.dev/petrbalvin/interpres/v2"
)
// document is a small but realistic configuration: it has scalars, a
+1 -1
View File
@@ -1,3 +1,3 @@
module sourcedock.dev/petrbalvin/interpres
module sourcedock.dev/petrbalvin/interpres/v2
go 1.27.1
+1 -2
View File
@@ -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:
//