fix(lib): validate subtypes in supertype queries

This commit is contained in:
Amaan Qureshi 2025-09-26 16:58:10 -04:00 committed by Amaan Qureshi
parent bd02be25d5
commit 341665824c
4 changed files with 104 additions and 10 deletions

View file

@ -115,6 +115,12 @@ match a `binary_expression` only if it is a child of `expression`:
(expression/binary_expression) @binary-expression
```
This also applies to anonymous nodes. For example, this pattern would match `"()"` only if it is a child of `expression`:
```query
(expression/"()") @empty-expression
```
[grammar]: ../../creating-parsers/3-writing-the-grammar.md#structuring-rules-well
[node-field-names]: ../2-basic-parsing.md#node-field-names
[named-vs-anonymous-nodes]: ../2-basic-parsing.md#named-vs-anonymous-nodes

View file

@ -140,7 +140,7 @@ see fit.
```query
((comment) @injection.content
(#lua-match? @injection.content "/[*\/][!*\/]<?[^a-zA-Z]")
(#match? @injection.content "/[*\/][!*\/]<?[^a-zA-Z]")
(#set! injection.language "doxygen"))
```