class TreeSitter::QueryCursor

Direct Known Subclasses

Defined in:

tree_sitter/query_cursor.cr

Constructors

Instance Method Summary

Constructor Detail

def self.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.


[View source]

Instance Method Detail

def exec(node : Node) #

Start running a given query on a given node.

Use #next_capture to fetch the captures.


[View source]
def exec(node : Node, &) #

Start running a given query on a given node.

Yield the capture name and the node


[View source]
def finalize #

[View source]
def next_capture : Capture | Nil #

Returns the next capture or nil.


[View source]
def query : Query #

[View source]
def query=(query : Query) #

[View source]
def set_byte_range(start_byte : UInt32, end_byte : UInt32) #

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


[View source]
def 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.


[View source]
def set_point_range(start_point : Point, end_point : Point) #

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


[View source]
def to_unsafe : LibTreeSitter::TSQueryCursor #

[View source]