Repository navigation
Yeast: Remove duplication in macros and formatting - #23362
Merged
Merged
Conversation
The `dump_node` function contained writing logic that was already in `dump_node_inline`. The new `is_leaf(node)` added to `dump_node_header` matches the code removed from `dump_node` and doesn't affect the existing caller which only calls `dump_node_inline` for leaf nodes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7cf5e9a9-33db-472c-bb72-e66af26a856f
Makes `parse_pattern_list` and `parse_list` reuse existing parsing function. `parse_pattern_list` now uses `parse_pattern_atom` for the bulk of its work and `parse_list` uses `parse_one` Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7cf5e9a9-33db-472c-bb72-e66af26a856f
Uses APIs from `syn` that makes parsing more consice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7cf5e9a9-33db-472c-bb72-e66af26a856f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7cf5e9a9-33db-472c-bb72-e66af26a856f
Factor out common parts into two new function `parse_templates_with_schema` and `parse_schema_declaration`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7cf5e9a9-33db-472c-bb72-e66af26a856f
paldepind
marked this pull request as ready for review
December 4, 2026 13:24
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The refactor spans shared procedural-macro parsing, schema-path resolution, and generated code across multiple macros, requiring broader compile-time fixture validation than the focused static review provides.
No open issues 🎉
What changed in this PR
Refactors Yeast dump formatting and procedural-macro parsing to remove duplicated logic while preserving existing behavior.
Changes:
- Extracts shared node-header formatting.
- Consolidates template, pattern, schema-path, and macro expansion helpers.
- Simplifies parsing with Syn APIs.
| File | Description |
|---|---|
| shared/yeast/src/dump.rs | Reuses shared node-header formatting for AST dumps. |
| shared/yeast-macros/src/template_parse.rs | Simplifies template-list parsing. |
| shared/yeast-macros/src/rule_parse.rs | Simplifies query-pattern list parsing. |
| shared/yeast-macros/src/parse.rs | Consolidates macro, schema, template, and path parsing helpers. |
| shared/yeast-macros/src/lib.rs | Centralizes procedural-macro expansion error handling. |
Review effort: Lite (adaptive)
tausbn
approved these changes
Dec 4, 2026
tausbn
left a comment
Contributor
There was a problem hiding this comment.
Very nice. I like the additional context in the commit messages. 👍
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.
This PR factors out some duplicated code and implements this review suggestion from #23225.
All the code changes are done by Copilot, I've reviewed the changes and I've written the commit descriptions to explain what's going on.
These refactors reduce line count by 146.