-
Notifications
You must be signed in to change notification settings - Fork 2k
yeast: Add support for a user-managed context during rule rewrites #22054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e0fa6cf
yeast: Reify the context and allow user-defined data in it
tausbn 5f73754
yeast: Make transforms return `Result`
tausbn a523c7f
yeast: Pass raw captures to `Rule::new` rules
tausbn 1ee142d
yeast: Add macro for fine-grained rules
tausbn 85c39c0
yeast: Hide desugaring behind Desugarer trait
tausbn 6d138c2
yeast: Simplify Swift rules using the new machinery
tausbn 0d845c2
unified/swift: Propagate parameter default values via context
tausbn ae4ccc6
unified/swift: Translate protocol properties using context
tausbn 199489a
unified/swift: Propagate enum_entry outer modifiers via context
tausbn 474bcd4
unified/swift: Propagate property_declaration modifiers via context
tausbn 5136d87
unified/swift: Replace reduce_left with Rust helpers
tausbn 1c4552e
unified/swift: Use `tree!` instead of ctx.node
tausbn af7ae8c
Apply rustfmt
tausbn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the name 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think I just had a good idea (dangerous, I know). What if instead of having a separate macro that auto-translates nothing (and one that auto-translates everything), we add a way to annotate a capture as "raw" or "untranslated"?
Then we could -- at the cost of relatively little syntax -- get the best of both worlds. Non-raw captures get auto-translated before the body of the rule target is executed, everything else is up to the user.
As for the syntax, I'm thinking either
@!fooor perhaps@@foo-- something that stands out sufficiently to remind the user that there's a raw capture that needs to be dealt with.Also, in that case I would auto-wrap the entire body of (the result of expanding)
manual_ruleinOkto avoid having to writeOk(...)at the end. This is whatruledoes currently anyway, and it wouldn't change the expressivity (since we need to returnResultanyway).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry about the syntax becoming a soup of symbols tbh. Can we keep
manual_ruleas it is for now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I'll postpone those changes for a different PR.