Subject: bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode

From: Yuan Fu <[email-masked]>
Date: Fri, 17 Jan 2025 23:59:52 -0800

> On Jan 13, 2025, at 11:52 PM, Juri Linkov <[email-masked]> wrote:
> 
>>>   (sentence
>>>    ,(rx (or (and bos (or "declaration"
>>>                          "enum_specifier"
>>>                          "union_specifier")
>>>                  eos)
>>>             (or "preproc"
>>>                 "statement"))))
>> 
>> Looks good. I’ve always used rx, it has the additional benefit of being macro expanded at compile time.
>> 
>> Also, I finally added support for ‘and’, ‘named’ and ‘anonymous’. I haven’t test it yet (sorry).
> 
> Thanks!  Does it make sense also to add predicates to define
> whether the node names should be matched completely?
> Then maybe add two separate predicates for strict and lax matching,
> e.g. for the same thing as above:
> 
>  (sentence
>   (or (strict ,(rx (or "declaration"
>                        "enum_specifier"
>                        "union_specifier")))
>       (lax ,(rx (or "preproc"
>                     "statement")))))

Hmm, I don’t know. Seems messy to implement, and we already have perfectly good solution: rx with bos or eos.
Yuan