-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor large parser modules into smaller components under 400 lines (#223) #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leynos
wants to merge
25
commits into
main
Choose a base branch
from
refactor-parser-modules-d2nyz5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8802bab
refactor(parser): modularize rule classification and expression parsing
leynos d916021
Extract struct literal scope handling
leynos 4257685
Resolve Cargo for non-login make runs
leynos 6d8c068
Share counted expression error fixtures
leynos 147aea3
Fix whitespace-only assignment value diagnostics and expand pratt mod…
leynos 7082666
Relax diff-marker early peek-and-error to defer validation to postfix…
leynos a7a827e
Apply cargo fmt to expression_postfix.rs
leynos ccb5ff8
Add atom_diff and atom_delay test helpers with postfix fixture coverage
leynos 27ec6f6
Add S'(x) and A()-<10> postfix fixture cases
leynos 1c531ff
Fix pratt postfix architectural violations and record issue #223 in r…
leynos e36fb4c
Split postfix expression fixture groups
leynos bd73231
Limit Markdown lint to branch changes
leynos 15f3f2d
Propagate Markdown lint setup failures
leynos 7de8f93
Preserve Markdown lint failures
leynos 0549ba9
Document parser module boundaries (#223)
leynos 333a035
Add parser module regression tests (#223)
leynos 82aad29
Clarify AtomDiff test helpers
leynos 841ef5f
Align postfix fixture helper body
leynos a0508e5
Bind comma token consume in postfix parser
leynos 1a6f9b8
Cover postfix diff and delay branches
leynos bdd4bd9
Report trailing comma errors at the separator
leynos 324810e
Tighten postfix parser test coverage (#223)
leynos dab06f2
Strengthen postfix parser assertions (#223)
leynos de3e89f
Narrow classification test lint expectations (#223)
leynos 81c28f5
Cover parser fixture docs and postfix helpers (#223)
leynos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Developer guide | ||
|
|
||
| This guide records the parser module structure introduced by issue `#223`. | ||
| It is intentionally narrow and documents ownership boundaries rather than the | ||
| full parsing pipeline. | ||
|
|
||
| ## Parser module structure | ||
|
|
||
| ### `src/parser/ast/expr/sexpr.rs` | ||
|
|
||
| - Owns S-expression rendering helpers for `Expr`. | ||
| - Supports test and fixture comparisons without coupling callers to debug | ||
| formatting. | ||
| - Should remain presentation-only; parsing and semantic classification belong | ||
| elsewhere. | ||
|
|
||
| ### `src/parser/ast/rule/classification.rs` | ||
|
|
||
| - Owns rule-body term classification for raw literals. | ||
| - Handles assignment parsing, aggregation detection, and `for`-loop lowering | ||
| within the rule-body helper path. | ||
| - Keeps rule-body classification separate from the public `Rule` wrapper so | ||
| `rule.rs` stays focused on the surface API. | ||
|
|
||
| ### `src/parser/expression/pratt/postfix.rs` | ||
|
|
||
| - Owns postfix dispatch for the Pratt parser. | ||
| - Routes function calls, bit slices, field access, tuple indexing, method | ||
| calls, and delay postfixes to the appropriate helper. | ||
| - Coordinates the pending diff-marker state across the postfix chain. | ||
|
|
||
| ### `src/parser/expression/pratt/diff.rs` | ||
|
|
||
| - Owns diff-marker tracking and validation. | ||
| - Wraps completed postfix expressions in `Expr::AtomDiff` when a diff marker | ||
| is pending. | ||
| - Emits the targeted diagnostics for duplicate, misplaced, or dangling diff | ||
| markers. | ||
|
|
||
| ### `src/parser/expression/pratt/delay.rs` | ||
|
|
||
| - Owns `expr -<N>` postfix parsing. | ||
| - Consumes the `-<` token pair, reads the delay literal, and returns | ||
| `Expr::AtomDelay` on success. | ||
| - Keeps delay-specific validation separate from the generic postfix loop. | ||
|
|
||
| ## Boundary rules | ||
|
|
||
| - Keep formatting helpers in `sexpr.rs` rather than mixing them into the core | ||
| expression parser. | ||
| - Keep rule-body classification in `classification.rs` rather than adding | ||
| helper-stage logic to `rule.rs`. | ||
| - Keep postfix dispatch in `postfix.rs`; add new postfix behaviour there only | ||
| when it needs shared chain state. | ||
| - Keep diff-marker state and delay parsing in their dedicated submodules so | ||
| `pratt.rs` remains the central parser entry point. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.