Repository navigation
docs(grammar): generate docs/GRAMMAR.md from grammar.pest (#643 PR 4) - #653
Merged
Merged
Conversation
tests/grammar_doc.rs renders tests/grammar/grammar.pest as EBNF with pest_meta (dev-dependency, already built for pest_derive) and fails when docs/GRAMMAR.md is stale; UPDATE_GRAMMAR_DOC=1 rewrites it. Lookaheads become EBNF comments, atomic rules are marked (* token *), section titles come from the grammar's // ── X ── lines, WHITESPACE becomes a note, and the verifier's edn_value_only entry rule is left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #643 (PR 4 of the plan, steps 14–18). No closing keyword: #643 closes by hand after PR 5.
What
tests/grammar_doc.rs(not wasm32) parsestests/grammar/grammar.pestwithpest_metaand renders EBNF intodocs/GRAMMAR.md.grammar_doc_is_currentfails when the file is stale, printing the first differing line andUPDATE_GRAMMAR_DOC=1 cargo test --test grammar_doc.~→ juxtaposition; choices and sequences flattened and parenthesized only where needed;snake_case→kebab-case;SOI/EOIand rule modifiers dropped;ASCII_DIGIT/ASCII_ALPHA/ASCII_ALPHANUMERIC/ANY→digit/letter/(letter | digit)/any-char;!x/&x→(* not followed by x *)/(* followed by x *);e{n}asncopies (and{n,},{,n},{m,n}); atomic rules marked(* token *);WHITESPACE→ a prose note generated from its literals;// ── X ──lines → section comments;edn_value_onlyskipped. Long top-level alternations break before|at 88 columns.pest_meta = "2"dev-dependency: the same 2.9.4 thatpest_derivealready pulls in (cargo tree -dshows no duplicate).Deviations from the plan
consume_rulesreturnsast::Rulewithout spans, andconsume_rules_with_spansis private. Same result (text order).WHITESPACE's header)."\"is one backslash), and the verifier claim says "for every input up to a size bound".Docs site
project-minigraf/minigraf-docs#47 adds the
grammarsnapshot page (Reference,since = "v3.0.0"). It needs this PR merged first: until thenorigin/v3has nodocs/GRAMMAR.md. Built locally against this branch:dist/v3.0.0/grammar/renders, and v3.0.0's Datalog reference links to it.Counts
1659 tests (1649 passing, 10 ignored), up 9.
CLAUDE.md,README.md,docs/TEST_COVERAGE.md,CHANGELOG.md(v3.0.0 Documentation) updated.🤖 Generated with Claude Code
https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT