Repository navigation
Yeast: A few straightforward refactors - #23292
Conversation
| #[derive(Debug, Clone, Default)] | ||
| pub struct TranslatedCaptures { | ||
| captures: BTreeMap<&'static str, Vec<OutputId>>, | ||
| captures: Captures<OutputId>, |
There was a problem hiding this comment.
We could also turn TranslatedCaptures into a type alias for Captures<OutputId>, but maybe we do want it as its own type.
There was a problem hiding this comment.
🟡 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
ReptoRepetitionand 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)
tausbn
left a comment
There was a problem hiding this comment.
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 { |
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>
cd03455 to
95a4dba
Compare
|
Thanks for the review @tausbn. I've rebased on main and dropped the commit that touched |


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.