Skip to content

fix(decode): three decoder cases that diverged from the spec - #355

Merged
johannschopplich merged 5 commits into
mainfrom
fix/quoted-key-and-colon-detection
Oct 5, 2026
Merged

johannschopplich merged 5 commits into
mainfrom
fix/quoted-key-and-colon-detection

Conversation

@johannschopplich

@johannschopplich johannschopplich commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Three decoder cases where the reference diverged from the spec:

  • "a" : 1 threw "Missing colon after key". Key tokens are trimmed like value tokens (§12), so spaces may separate a quoted key from its colon, as they already could for unquoted keys.
  • hello "a:b" threw the same error, because root-form discovery looked for any colon instead of an unquoted one. It now decodes to the string hello "a:b", which the ports already return.
  • In non-strict mode, a bare token after a completed root form ([2]: 1,2 then junk) was dropped. A scalar line outside root primitive position errors in both modes (§5.2); other trailing lines are still skipped.

The first and third cases are fixtures in toon-format/spec#65 and pass with it linked locally; the second follows in spec 4.2. They reach this repo with the spec releases, so this PR adds no hand-written tests.

@johannschopplich johannschopplich changed the title fix(decode): accept "a" : 1 and a root string whose only colon is quoted fix(decode): three decoder cases that diverged from the spec Oct 5, 2026
@johannschopplich
johannschopplich merged commit 4234208 into main Oct 5, 2026
1 check passed
@johannschopplich
johannschopplich deleted the fix/quoted-key-and-colon-detection branch October 5, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant