Repository navigation
Improve the tree query syntax - #615
Merged
Merged
Conversation
Signed-off-by: Patrick Thomson <[email protected]>
1. Use '_' instead of '*'. 2. Add '*' as a postfix operator for zero-or-more repetitions Signed-off-by: Patrick Thomson <[email protected]>
maxbrunsfeld
force-pushed
the
new-query-syntax
branch
from
May 11, 2020 23:00
61fb558 to
db346c6
Compare
maxbrunsfeld
force-pushed
the
new-query-syntax
branch
from
May 11, 2020 23:19
db346c6 to
fce5c50
Compare
stsewd
added a commit
to stsewd/tree-sitter
that referenced
this pull request
Aug 15, 2020
These were added in tree-sitter#615 and tree-sitter#630 Closes tree-sitter#704
This comment was marked as spam.
This comment was marked as spam.
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.
This PR changes the tree query syntax in the ways described in #612, plus some additional ways.
Changes
1. Wildcards with
_The "wildcard" node is now written
_(to match wildcard patterns in Rust and Haskell) instead of*.2. Repetition with
*There is now a
*postfix operator to go along with the+and?operators, and they all now match their counterpart in regular expression syntax (*is zero-or-more,+is one-or-more,?is zero-or-one).3. Grouping everywhere with
()Parentheses can now be used everywhere for grouping sibling nodes.
4. Predicates with
#To disambiguate predicate expressions for named nodes, predicate names now must begin with
#. I think this makes patterns with predicates much more readable, and it simplifies the parser.Example:
Notes
#, and the predicate name did not end with?or!.