[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help needed with query

From: Perry Smith
Subject: Help needed with query
Date: Sat, 10 Dec 2022 08:43:01 -0600

Can someone help explain constructs like this?

           ((query "(for_statement initializer: (_) @indent)") parent-bol 5)

This rule is coming from the indent rules for c-ts-mode.

I’m doing:

           ((query "((method_parameters \"(\" _ @indent))") first-sibling 1)

and it seems to be working for me.

Two questions:
The ‘_’ seems to be a “match all” but I’m currently using just ‘_’  and not 
‘(_)’ and it seems to be working for me.  What is the difference?
    • The @indent seems to be necessary to get the query to match.  Things do 
not seem to match without it but it doesn’t need to be @indent… it can be @foo. 
 So, what is it doing and does the name matter?

I can’t recall now but when I was working on the font lock rules, I needed 
matching constructs and a type of “match anything except” type of construct.

Thank you for your time,

Attachment: signature.asc
Description: Message signed with OpenPGP

reply via email to

[Prev in Thread] Current Thread [Next in Thread]