Skip to content
Discussion options

You must be logged in to vote

Thanks, I was able to reproduce the behavior you reported.

I noticed in the grammar that for flag_decl, there is an anonymous node flag:

        flag_decl: $ => seq(
            repeat($.comment),
            'flag',
            field('name', $.section_name),
            field('properties', $.property_block),
        ),

and the query in question uses both an anchor . and the type of wildcard node _ which matches both named and anonymous nodes:

(cabal (sections (flag_decl . _ @type name: (section_name)? @name)))

At the end of the Anchors section of the docs, I see this text:

The restrictions placed on a pattern by an anchor operator ignore anonymous nodes.

I wonder if this is involved i…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@magthe
Comment options

@sogaiu
Comment options

sogaiu Mar 29, 2023
Collaborator

@magthe
Comment options

Comment options

You must be logged in to vote
3 replies
@magthe
Comment options

@sogaiu
Comment options

sogaiu Mar 29, 2023
Collaborator

@magthe
Comment options

Answer selected by ObserverOfTime
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants