Skip to content

Yeast: A few straightforward refactors - #23292

Merged
paldepind merged 10 commits into
mainfrom
yeast/tweaks
Dec 1, 2026
Merged

paldepind merged 10 commits into
mainfrom
yeast/tweaks

Conversation

@paldepind

@paldepind paldepind commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

A few small refactors to YEAST. I think these should be pretty easy to review commit-by-commit. Not counting tests this removes around 90 lines of code.

@paldepind paldepind changed the title Yeast: Simplify YEAST internals Yeast: A few straightforward refactors Nov 29, 2026
Comment thread shared/yeast/src/captures.rs Outdated
#[derive(Debug, Clone, Default)]
pub struct TranslatedCaptures {
captures: BTreeMap<&'static str, Vec<OutputId>>,
captures: Captures<OutputId>,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could also turn TranslatedCaptures into a type alias for Captures<OutputId>, but maybe we do want it as its own type.

@paldepind
paldepind marked this pull request as ready for review November 30, 2026 07:14
@paldepind
paldepind requested a review from a team as a code owner November 30, 2026 07:14
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 07:14

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.

🟡 Changes recommended

The refactor removes the public yeast::query::Rep API without preserving compatibility, and the PR description still lacks the requested DCA comparison results.

2 open issues
What changed in this PR

This PR performs behavior-preserving refactors across YEAST, simplifying traversal, range aggregation, capture handling, and query repetition naming while adding focused documentation and tests.

Changes:

  • Simplifies visitor traversal, child iteration, range aggregation, identifier lookup, and rule matching.
  • Renames Rep to Repetition and updates generated query references.
  • Adds point ordering and range-union tests while reformatting YEAST documentation.
File Description
shared/​yeast/​src/​visitor.rs Simplifies node traversal and field insertion logic.
shared/​yeast/​src/​range.rs Adds point ordering, simplifies range-union logic, and expands focused tests.
shared/​yeast/​src/​query.rs Renames and documents the query repetition representation.
shared/​yeast/​src/​lib.rs Simplifies child iteration, range aggregation, identifier lookup, and rule matching.
shared/​yeast/​src/​captures.rs Centralizes singleton capture handling and reuses common capture storage for translated values.
shared/​yeast/​doc/​yeast.md Reformats architecture and annotation documentation.
shared/​yeast-macros/​src/​lower.rs Updates generated query code to use Repetition.

Review effort: Lite (adaptive)

Comment thread shared/yeast/src/query.rs Resolved
Comment thread shared/yeast/src/lib.rs Resolved
@paldepind
paldepind requested a review from tausbn November 30, 2026 16:24

@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.

Overall, this looks good to me, though it will conflict slightly with the work that removes eager translation (linked below).


/// Output ids produced by eagerly translating non-raw query captures.
#[derive(Debug, Clone, Default)]
pub struct TranslatedCaptures {

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.

With #23302, this struct goes away entirely.

paldepind and others added 10 commits November 30, 2026 20:20
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@paldepind

Copy link
Copy Markdown
Contributor Author

Thanks for the review @tausbn. I've rebased on main and dropped the commit that touched TranslatedCaptures.

@paldepind
paldepind requested a review from tausbn November 30, 2026 19:23

@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.

Great work! ❤️

@paldepind
paldepind merged commit 0b57b92 into main Dec 1, 2026
22 checks passed
@paldepind
paldepind deleted the yeast/tweaks branch December 1, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants