Query#
- class tree_sitter.Query(language, source)#
A set of patterns that match nodes in a syntax tree.
Added in version 0.22.0: constructor
Methods#
- captures(node, *, start_point=None, end_point=None, start_byte=None, end_byte=None)#
Get a list of captures within the given node.
You can optionally limit the captures to a range of row/column points or of bytes.
Hint
This method returns all of the captures while
matches()
only returns the last match.
- matches(node, *, start_point=None, end_point=None, start_byte=None, end_byte=None)#
Get a list of matches within the given node.
You can optionally limit the matches to a range of row/column points or of bytes.