Skip to content
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

feat(es/plugin): Add AST query API #6270

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Oct 27, 2022

Description:

Typically, finding an ast node involves 3 ~ 8 levels of nested pattern matching, but I think it can be reduced with this.

  • Basically, it consists of a pattern matcher and an operator
  • Pattern matcher can be written using query! macro
  • $n is one capture group.
  • $n can capture an expression, pattern, or a statement
  • The operator is a closure (need more thinking)
  • Operators are called once for each target node
  • Operators are called with the target AST node of the query by default and called with captured node if there are one or more capturing ($n).

Related issue:

@kdy1 kdy1 added this to the Planned milestone Oct 27, 2022
@kdy1 kdy1 self-assigned this Oct 27, 2022
@kdy1 kdy1 changed the title feat(es/plugin): Add AST query api feat(es/plugin): Add AST query API Oct 27, 2022
@kdy1 kdy1 removed their assignment Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant