Replies: 3 comments 6 replies
-
About:
What's worked for me is something like:
FWIW, I leanred this via the invocation |
Beta Was this translation helpful? Give feedback.
-
Thanks, I was able to reproduce the behavior you reported. I noticed in the grammar that for flag_decl: $ => seq(
repeat($.comment),
'flag',
field('name', $.section_name),
field('properties', $.property_block),
), and the query in question uses both an anchor
At the end of the Anchors section of the docs, I see this text:
I wonder if this is involved in the unexpected behavior. Sorry, the above may not really help with directly addressing your original point. |
Beta Was this translation helpful? Give feedback.
-
I think answers to all my questions, as well as a very workable solution to my problem, can be found above. Thus I'm closing this discussion. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to run this query
against a parse tree with the following shape
I get the following result
which surprised me a bit; I didn't expect the
@type
to capture multiple times within a node like that. Apparently this is by design, but I also found that I'm not the first one to be suprised. The problem now is that I can't seem to find a way to prevent multiple captures of@type
.Using anchoring I can reduce the result slightly
gives
Isn't this actually a bug? The first child should be captured in
@type
, but here both the first and the second are.Some more questions:
field('type', 'common')
, but the resulting parser doesn't put a field on the node. Is that intended?tree-sitter query
, but I'm not sure how to get it working. Are there instructions to be found somewhere?Beta Was this translation helpful? Give feedback.
All reactions