Struct tree_sitter::QueryCursor [−][src]
pub struct QueryCursor { /* fields omitted */ }
Expand description
A stateful object for executing a Query
on a syntax Tree
.
Implementations
Create a new cursor for executing a given query.
The cursor stores the state that is needed to iteratively search for matches.
Return the maximum number of in-progress matches for this cursor.
Set the maximum number of in-progress matches for this cursor. The limit must be > 0 and <= 65536.
Check if, on its last execution, this cursor exceeded its maximum number of in-progress matches.
pub fn matches<'a, 'tree: 'a, T: TextProvider<'a> + 'a>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_provider: T
) -> QueryMatches<'a, 'tree, T>ⓘNotable traits for QueryMatches<'a, 'tree, T>impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryMatches<'a, 'tree, T> type Item = QueryMatch<'a, 'tree>;
pub fn matches<'a, 'tree: 'a, T: TextProvider<'a> + 'a>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_provider: T
) -> QueryMatches<'a, 'tree, T>ⓘNotable traits for QueryMatches<'a, 'tree, T>impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryMatches<'a, 'tree, T> type Item = QueryMatch<'a, 'tree>;
impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryMatches<'a, 'tree, T> type Item = QueryMatch<'a, 'tree>;
Iterate over all of the matches in the order that they were found.
Each match contains the index of the pattern that matched, and a list of captures. Because multiple patterns can match the same set of nodes, one match may contain captures that appear before some of the captures from a previous match.
pub fn captures<'a, 'tree: 'a, T: TextProvider<'a> + 'a>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_provider: T
) -> QueryCaptures<'a, 'tree, T>ⓘNotable traits for QueryCaptures<'a, 'tree, T>impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryCaptures<'a, 'tree, T> type Item = (QueryMatch<'a, 'tree>, usize);
pub fn captures<'a, 'tree: 'a, T: TextProvider<'a> + 'a>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_provider: T
) -> QueryCaptures<'a, 'tree, T>ⓘNotable traits for QueryCaptures<'a, 'tree, T>impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryCaptures<'a, 'tree, T> type Item = (QueryMatch<'a, 'tree>, usize);
impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryCaptures<'a, 'tree, T> type Item = (QueryMatch<'a, 'tree>, usize);
Iterate over all of the individual captures in the order that they appear.
This is useful if don’t care about which pattern matched, and just want a single, ordered sequence of captures.
Set the range in which the query will be executed, in terms of byte offsets.
Set the range in which the query will be executed, in terms of rows and columns.