Return: ~
(`TSNode?`)
TSNode:end_() *TSNode:end_()*
Get the node's end position. Return three values: the row, column and
total byte count (all zero-based).
Return (multiple): ~
(`integer`)
(`integer`)
(`integer`)
TSNode:equal({node}) *TSNode:equal()*
Check if {node} refers to the same node within the same tree.
Parameters: ~
• {node} (`TSNode`)
Return: ~
(`boolean`)
TSNode:extra() *TSNode:extra()*
Check if the node is extra. Extra nodes represent things like comments,
which are not required by the grammar but can appear anywhere.
Return: ~
(`boolean`)
TSNode:field({name}) *TSNode:field()*
Returns a list of all the node's children that have the given field name.
Parameters: ~
• {name} (`string`)
Return: ~
(`TSNode[]`)
TSNode:has_changes() *TSNode:has_changes()*
Check if a syntax node has been edited.
Return: ~
(`boolean`)
TSNode:has_error() *TSNode:has_error()*
Check if the node is a syntax error or contains any syntax errors.
Return: ~
(`boolean`)
TSNode:id() *TSNode:id()*
Get a unique identifier for the node inside its own tree.
No guarantees are made about this identifier's internal representation,
except for being a primitive Lua type with value equality (so not a
table). Presently it is a (non-printable) string.
Note: The `id` is not guaranteed to be unique for nodes from different
trees.
Return: ~
(`string`)
TSNode:iter_children() *TSNode:iter_children()*
Iterates over all the direct children of {TSNode}, regardless of whether
they are named or not. Returns the child node plus the eventual field name
corresponding to this child node.
Return: ~
(`fun(): TSNode, string`)
TSNode:missing() *TSNode:missing()*
Check if the node is missing. Missing nodes are inserted by the parser in
order to recover from certain kinds of syntax errors.
Return: ~
(`boolean`)
TSNode:named() *TSNode:named()*
Check if the node is named. Named nodes correspond to named rules in the
grammar, whereas anonymous nodes correspond to string literals in the
grammar.
Return: ~
(`boolean`)
TSNode:named_child({index}) *TSNode:named_child()*
Get the node's named child at the given {index}, where zero represents the
first named child.
Parameters: ~
• {index} (`integer`)
Return: ~
(`TSNode?`)
TSNode:named_child_count() *TSNode:named_child_count()*
Get the node's number of named children.
Return: ~
(`integer`)
TSNode:named_children() *TSNode:named_children()*
Returns a list of the node's named children.
Return: ~
(`TSNode[]`)
*TSNode:named_descendant_for_range()*
TSNode:named_descendant_for_range({start_row}, {start_col}, {end_row},
{end_col})
Get the smallest named node within this node that spans the given range of
(row, column) positions
Parameters: ~
• {start_row} (`integer`)
• {start_col} (`integer`)
• {end_row} (`integer`)
• {end_col} (`integer`)
Return: ~
(`TSNode?`)
TSNode:next_named_sibling() *TSNode:next_named_sibling()*
Get the node's next named sibling.
Return: ~
(`TSNode?`)
TSNode:next_sibling() *TSNode:next_sibling()*