feat(regular_expression): add terms visitor to pattern#5951
feat(regular_expression): add terms visitor to pattern#5951
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @camchenry and the rest of your teammates on |
CodSpeed Performance ReportMerging #5951 will not alter performanceComparing Summary
|
|
@DonIsaac I am not familiar with this area...! 😅 Should these be handwritten? Or we need some updates for |
|
I feel like this might be the wrong implementation, but we probably do need some sort of regular expression AST visitor. I think a better approach here would be to create a generic AST visitor that can visit every node type in the Regex: I'm going to mark this as draft for now |
I agree. For the main However, I don't know the details of how it works or whether we should do the same here. @Boshen Would you please help me to review? 🙏🏻 |
|
We can always start with a manual one to test the water, and then migrate to ast_tools. |
|
@camchenry If that's the case, I think there's no problem. Just 1 point, I think it would be nice to separate the file as |
|
closing this in favor of #6055, which is the better implementation I think |
…ST (#6055) - resolves #5977 - supersedes #5951 To facilitate easier traversal of the Regex AST, this PR defines a `Visit` trait with default implementations that will walk the entirety of the Regex AST. Methods in the `Visit` trait can be overridden with custom implementations to do things like analyzing only certain nodes in a regular expression, which will be useful for regex-related `oxc_linter` rules. In the future, we should consider automatically generating this code as it is very repetitive, but for now a handwritten visitor is sufficient.

To make it easier to iterate over the nodes in the regex AST, I attempted to add a pseudo-visitor method for patterns