Proposal for nesting query predicate operator#1
Closed
pokey wants to merge 1 commit intofidgetingbits:nix-langfrom
Closed
Proposal for nesting query predicate operator#1pokey wants to merge 1 commit intofidgetingbits:nix-langfrom
pokey wants to merge 1 commit intofidgetingbits:nix-langfrom
Conversation
pokey
commented
Feb 2, 2024
Comment on lines
+258
to
+263
| ( | ||
| (apply_expression | ||
| function: (_) @functionCallee | ||
| ) @functionCallee.domain @functionCall | ||
| (#not-type? @functionCallee apply_expression) | ||
| ) |
Author
There was a problem hiding this comment.
This matches the innermost function call, which is why we use the not-type here
pokey
commented
Feb 2, 2024
Comment on lines
265
to
+267
| (apply_expression | ||
| [ | ||
| (select_expression | ||
| expression: (variable_expression | ||
| name: (identifier) | ||
| ) | ||
| ) @functionCallee | ||
| (apply_expression | ||
| [ | ||
| (select_expression | ||
| expression: (variable_expression | ||
| name: (identifier) | ||
| ) | ||
| ) @functionCallee | ||
| (apply_expression | ||
| [ | ||
| (select_expression | ||
| expression: (variable_expression | ||
| name: (identifier) | ||
| ) | ||
| ) @functionCallee | ||
| (apply_expression | ||
| (select_expression | ||
| expression: (variable_expression | ||
| name: (identifier) | ||
| ) | ||
| ) @functionCallee | ||
| ) | ||
| ] | ||
| ) | ||
| ] | ||
| ) | ||
| ] | ||
| ) @functionCall @_.domain | ||
| function: (apply_expression) @functionCallee.domain.input @functionCall.input | ||
| ) @functionCallee.domain.output @functionCall.output |
Author
There was a problem hiding this comment.
then each step goes from an apply_expression to its immediate apply_expression parent
pokey
commented
Feb 2, 2024
Comment on lines
+283
to
286
| ( | ||
| (apply_expression) @argumentOrParameter.iteration | ||
| (#not-parent-type? @argumentOrParameter.iteration apply_expression) | ||
| ) |
Author
There was a problem hiding this comment.
@fidgetingbits this isn't entirely related, but note that we can simply define iteration scope for arg like this, and then "first arg" etc should just work
13 tasks
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.
The idea here is to define
@foo.input/@foo.outputpairs. For any@foocapture, we look to see if there are any@foo.inputcaptures whose range is identical to@foo. If so, we change the range of@footo be the range of@foo.output. We repeat this process until it doesn't match any@foo.inputcapture. This way we can expand up an ancestor tree, traverse across a tree, etcI haven't implemented the operator itself, but I don't think it should be too bad; just do an initial traversal where construct a map of all
@foo.inputcaptures and then use that for doing a lookup when we handle the final capturescc/ @AndreasArvidsson @wenkokke @josharian
Checklist