Skip to content

Prefer #any-of? predicate over #match? with alternation #80

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 1 commit into from
Jan 24, 2025

Conversation

the-mikedavis
Copy link
Member

The (#match? @foo "^(bar|baz)$") predicate was a workaround necessary when #any-of? was not broadly supported. Now that it has been standard for a while, we can switch these uses of #match? to #any-of?.

https://tree-sitter.github.io/tree-sitter/using-parsers/queries/3-predicates-and-directives.html#the-any-of-predicate

The `(#match? @foo "^(bar|baz)$")` predicate was a workaround necessary
when `#any-of?` was not broadly supported. Now that it has been standard
for a while, we can switch these uses of `#match?` to `#any-of?`.
Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@the-mikedavis the-mikedavis merged commit 0e8eb7f into main Jan 24, 2025
1 check passed
@the-mikedavis the-mikedavis deleted the md-any-of branch January 24, 2025 16:20
williamthome added a commit to williamthome/tree-sitter-herl that referenced this pull request Feb 23, 2025
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.

2 participants