-
Notifications
You must be signed in to change notification settings - Fork 0
Proposal for nesting query predicate operator #1
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
Proposal for nesting query predicate operator #1
Conversation
8000 ( | ||
(apply_expression | ||
function: (_) @functionCallee | ||
) @functionCallee.domain @functionCall | ||
(#not-type? @functionCallee apply_expression) | ||
) |
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.
This matches the innermost function call, which is why we use the not-type
here
(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 |
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.
then each step goes from an apply_expression
to its immediate apply_expression
parent
( | ||
(apply_expression) @argumentOrParameter.iteration | ||
(#not-parent-type? @argumentOrParameter.iteration apply_expression) | ||
) |
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.
@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
The idea here is to define
@foo.input
/@foo.output
pairs. For any@foo
capture, we look to see if there are any@foo.input
captures whose range is identical to@foo
. If so, we change the range of@foo
to be the range of@foo.output
. We repeat this process until it doesn't match any@foo.input
capture. 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.input
captures and then use that for doing a lookup when we handle the final capturescc/ @AndreasArvidsson @wenkokke @josharian
Checklist