Skip to content

feat: simplify ABNF for v0.1 and introduce section in main document#27

Merged
DecimalTurn merged 22 commits into
JSONC-org:mainfrom
DecimalTurn:abnf5
May 11, 2026
Merged

feat: simplify ABNF for v0.1 and introduce section in main document#27
DecimalTurn merged 22 commits into
JSONC-org:mainfrom
DecimalTurn:abnf5

Conversation

@DecimalTurn
Copy link
Copy Markdown
Member

@DecimalTurn DecimalTurn commented May 3, 2026

This PR:

  • Simplifies the ABNF diagram
    • No longer include mentions of LS (Line Seperator) and PS (Paragraph Seperator)
  • Makes sure the ABNF is self-contained (no longer need to refer to core rules from RFC 5234.
  • Makes the railroad diagram more similar with the style of ECMA railroad diagrams
  • Makes the railroad diagram easier to read by re-ordering elements to make them closer to where they are needed and put the ones that are obvious at the end to save space in the core of the page.

@DecimalTurn DecimalTurn changed the title feat: simplify ABNF for v0.1 and introduce section feat: simplify ABNF for v0.1 and introduce section in main document May 5, 2026
@DecimalTurn DecimalTurn marked this pull request as ready for review May 5, 2026 15:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the JSONC specification site to better surface and simplify the formal grammar, and refreshes the generated railroad diagram to match the revised ABNF and styling goals.

Changes:

  • Add a “Formal grammar” section to the main document linking to the ABNF file and railroad diagram.
  • Simplify and make the ABNF more self-contained (removing reliance on RFC 5234 core rules and removing LS/PS mentions).
  • Update the railroad diagram generator script and the generated HTML/CSS output to reflect the new grammar and a revised visual style/order.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
index.markdown Adds a dedicated section linking to the ABNF grammar and railroad diagram.
grammar/README.md Updates documented paths/examples to use grammar/JSONC.abnf.
grammar/JSONC.abnf Simplifies comment terminators and inlines core-rule equivalents (digit/hexdigit), reorders value, and updates string escape hexdigits rule.
generate-railroad.js Updates default input, adds inlining/reordering logic, and post-processes generated HTML header.
grammar/railroad-diagram.html Regenerated diagram output reflecting the updated grammar and ordering.
grammar/railroad-diagram.css Adjusts diagram styling (terminal/nonterminal appearance and labels).
Comments suppressed due to low confidence (1)

grammar/JSONC.abnf:26

  • single-line-comment-end allows a bare CR (%x0D), but the spec defines a “line ending” as LF or CRLF (index.markdown:23) and defines single-line comments as continuing until a line ending. Please either (a) remove the standalone CR alternative here so the formal grammar matches the spec’s terminology, or (b) update the spec’s line-ending definition to explicitly include lone CR as well.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread generate-railroad.js
@DecimalTurn
Copy link
Copy Markdown
Member Author

DecimalTurn commented May 11, 2026

The suppressed comment:

single-line-comment-end allows a bare CR (%x0D), but the spec defines a “line ending” as LF or CRLF (index.markdown:23) and defines single-line comments as continuing until a line ending. Please either (a) remove the standalone CR alternative here so the formal grammar matches the spec’s terminology, or (b) update the spec’s line-ending definition to explicitly include lone CR as well.

Is actually relevant, the ABNF indeed allows a lone CR as a line-comment-terminator. Similarly, jsonc-parser and EcmaScript also consider that a lone CR is a valid line-comment-terminator. In the case of EcmaScript, a lone CR is a valid LineTerminatorSequence. For these reasons, the text of the spec should actually reflect that acceptance and specify that a lone CR is a valid line line ending.

@DecimalTurn DecimalTurn merged commit d247d1b into JSONC-org:main May 11, 2026
1 check passed
@DecimalTurn DecimalTurn deleted the abnf5 branch May 11, 2026 20:03
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.

2 participants