NAME

Text::Treesitter::QueryCursor - stores the result of a tree-sitter node query

SYNOPSIS

TODO

DESCRIPTION

Instances of this class store the result of performing a query pattern match operation against the node tree of a parse result. Once executed it will contain the matched patterns and captured nodes, which can then be queried.

CONSTRUCTOR

new

$qc = Text::Treesitter::QueryCursor->new;

Returns a new blank instance.

METHODS

exec

$qc->exec( $query, $node );

Performs the query pattern-matching operation by attempting to match node subtrees from the given (root) node, against patterns defined by the query.

This method does not return a result; instead the matches are stored within the object itself and can be iterated using "next_match".

next_match

$match = $qc->next_match;

Returns the next stored match from the most recent "exec" operation, or undef if there are no more matches. The match is returned as an instance of Text::Treesitter::QueryMatch.

TODO

The following C library functions are currently unhandled:

ts_query_cursor_...
ts_query_cursor_exec
ts_query_cursor_did_exceed_match_limit
ts_query_cursor_match_limit
ts_query_cursor_set_match_limit
ts_query_cursor_set_byte_range
ts_query_cursor_set_point_range
ts_query_cursor_next_match
ts_query_cursor_remove_match
ts_query_cursor_next_capture

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>