Repository navigation
Conversation
When specified on a tree template node, this field is used to override/set the location of the node it is attached to. The field itself can contain an iterable of nodes, in which case the location will be the smallest location spanning all of these nodes. The same behaviour applies if there are multiple `location` fields on the same node.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Parsing, range handling, and migrated callers are consistent, with focused regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
Adds location metadata to YEAST tree templates, simplifying source-range overrides used by the Swift extractor.
Changes:
- Supports individual nodes, iterables, and repeated location fields.
- Removes
tree_at!andtree_spanning!, migrating Swift callers. - Updates documentation and adds parser and regression tests.
| File | Description |
|---|---|
| unified/extractor/src/languages/swift/swift.rs | Migrates location overrides to the new syntax. |
| shared/yeast/tests/test.rs | Tests overrides, range unions, and node-only effects. |
| shared/yeast/src/lib.rs | Removes obsolete macro exports. |
| shared/yeast/doc/yeast.md | Documents location-field syntax and behavior. |
| shared/yeast-macros/src/template_parse.rs | Parses location fields and validates their syntax. |
| shared/yeast-macros/src/parse.rs | Removes obsolete macro parsers. |
| shared/yeast-macros/src/lower.rs | Generates location-range union and assignment code. |
| shared/yeast-macros/src/lib.rs | Documents new syntax and removes old macros. |
| shared/yeast-macros/src/ast.rs | Represents location metadata in templates. |
Review effort: Max
This branch has not been deployed
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.
Adds support for a special
locationfield on nodes in tree templates. This field should contain a Rust interpolation, the value of which will be treated as a node (or iterable of nodes) that provides/overrides the location of the node to which the field is attached. If multiple nodes are produced by the iterable, the location will be the smallest source range that contains all of these nodes.The
locationfield can also appear multiple times, in which case we apply the same unioning semantics as for iterables in a single field.This fully supersedes the previous
tree_at!andtree_spanning!macros, which are therefore removed.Can be reviewed commit-by-commit.