Method new()
Create a new tree cursor.
Usage
TreeCursor$new(node)
Arguments
node
[tree_sitter_node]
The node to start walking from.
Method reset()
Reset the tree cursor to a new root node.
Usage
TreeCursor$reset(node)
Arguments
node
[tree_sitter_node]
The node to start walking from.
Method node()
Get the current node that the cursor points to.
Method field_name()
Get the field name of the current node.
Usage
TreeCursor$field_name()
Method field_id()
Get the field id of the current node.
Usage
TreeCursor$field_id()
Method descendant_index()
Get the descendent index of the current node.
Usage
TreeCursor$descendant_index()
Method goto_parent()
Go to the current node's parent.
Returns TRUE
if a parent was found, and FALSE
if not.
Usage
TreeCursor$goto_parent()
Method goto_next_sibling()
Go to the current node's next sibling.
Returns TRUE
if a sibling was found, and FALSE
if not.
Usage
TreeCursor$goto_next_sibling()
Method goto_previous_sibling()
Go to the current node's previous sibling.
Returns TRUE
if a sibling was found, and FALSE
if not.
Usage
TreeCursor$goto_previous_sibling()
Method goto_first_child()
Go to the current node's first child.
Returns TRUE
if a child was found, and FALSE
if not.
Usage
TreeCursor$goto_first_child()
Method goto_last_child()
Go to the current node's last child.
Returns TRUE
if a child was found, and FALSE
if not.
Usage
TreeCursor$goto_last_child()
Method depth()
Get the depth of the current node.
Method goto_first_child_for_byte()
Move the cursor to the first child of its current node that extends
beyond the given byte offset.
Returns TRUE
if a child was found, and FALSE
if not.
Usage
TreeCursor$goto_first_child_for_byte(byte)
Arguments
byte
[double(1)]
The byte to move the cursor past.
Method goto_first_child_for_point()
Move the cursor to the first child of its current node that extends
beyond the given point.
Returns TRUE
if a child was found, and FALSE
if not.
Usage
TreeCursor$goto_first_child_for_point(point)
Arguments
point
[tree_sitter_point]
The point to move the cursor past.