Skip to content

Yeast: Remove duplication in macros and formatting - #23362

Merged
paldepind merged 5 commits into
mainfrom
yeast/cleanup-dupl
Dec 4, 2026
Merged

paldepind merged 5 commits into
mainfrom
yeast/cleanup-dupl

Conversation

@paldepind

@paldepind paldepind commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

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.

paldepind and others added 5 commits December 4, 2026 12:44
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 paldepind changed the title Yeast: Remove duplication in macros and dump formatting Yeast: Remove duplication in macros and formatting Dec 4, 2026
@paldepind
paldepind marked this pull request as ready for review December 4, 2026 13:24
@paldepind
paldepind requested a review from a team as a code owner December 4, 2026 13:24
Copilot AI adaptive review requested due to automatic review settings December 4, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 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 tausbn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very nice. I like the additional context in the commit messages. 👍

@paldepind
paldepind merged commit c9365b0 into main Dec 4, 2026
24 checks passed
@paldepind
paldepind deleted the yeast/cleanup-dupl branch December 4, 2026 14:04
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.

3 participants