class

TreeSitter::QueryCursor

Inherits Reference / Object

Constructors

new(query : TreeSitter::Query)

Create a new cursor for executing a given query.

The cursor stores the state that is needed to iteratively search for matches. To use the query cursor, call QueryCursor#exec to start running the given query on a given syntax node.

Source

Instance methods

each_capture
Source
exec(node : Node)

Start running a given query on a given node.

Use #next_capture to fetch the captures.

Source
exec(node : Node, &)

Start running a given query on a given node.

Yield the capture name and the node

Source
finalize
Source
next_capture

Returns the next capture or nil.

Source
query
Source
query=(query : Query)
Source
set_byte_range(start_byte : UInt32, end_byte : UInt32)

Set the range of bytes in which the query will be executed.

Source
set_point_range(start_row : Int32, start_column : Int32, end_row : Int32, end_column : Int32)

Set the range of row, column positions in which the query will be executed.

Source
set_point_range(start_point : Point, end_point : Point)

Set the range of row, column positions in which the query will be executed.

Source
to_unsafe
Source