QueryPredicate#
- class tree_sitter.QueryPredicate#
Bases:
ProtocolA custom query predicate that runs on a pattern.
Special Methods#
- __call__(predicate, args, pattern_index, captures)#
- Parameters:
predicate (str) – The name of the predicate.
args (list[tuple[str, Literal['capture', 'string']]]) – The arguments to the predicate.
pattern_index (int) – The index of the pattern within the query.
captures (dict[str, list[Node]]) – The captures contained in the pattern.
- Returns:
Trueif the predicate matches,Falseotherwise.
Tip
You don’t need to create an actual class, just a function with this signature.