Page
Library
Module
Module type
Parameter
Class
Class type
Source
Tree_sitter.Tree_cursorSourceEfficient tree traversal cursors.
A Tree_cursor.t walks a syntax tree without allocating a new Node.t at each step. Prefer this over Node navigation functions (e.g. Node.child, Node.next_sibling) when visiting many nodes.
The type for tree cursors. Automatically garbage collected, but delete can release resources sooner.
create node is a cursor starting at node. The cursor cannot walk above node.
delete cursor frees resources immediately. The cursor must not be used after this call.
current_field_name cursor is the field name of the current node in its parent, if any.
current_field_id cursor is the field ID of the current node, or 0 if it has no field.
current_depth cursor is the depth of the current node relative to the cursor's starting node.
goto_parent cursor moves to the parent. Returns false if already at the starting node.
goto_first_child cursor moves to the first child. Returns false if the current node has no children.
goto_last_child cursor moves to the last child. Returns false if the current node has no children.
goto_next_sibling cursor moves to the next sibling. Returns false if there is no next sibling.
goto_previous_sibling cursor moves to the previous sibling. Returns false if there is no previous sibling.