Class Tree
A syntax tree.
Analogous to TSTree
.
Methods
Tree:copy () | Create a shallow copy of the syntax tree. |
Tree:root_node () | Get the root node of the syntax tree. |
Tree:root_node (byte_offset, point_offset) | Get the root node of the syntax tree, with its position shifted forward by the given offset. |
Tree:language () | Get the language that was used to parse the syntax tree. |
Tree:included_ranges () | Get the array of included ranges that was used to parse the syntax tree. |
Tree:edit (start_byte, old_end_byte, new_end_byte, start_point, old_end_point, new_end_point) | Edit the syntax tree to keep it in sync with source code that has been edited. |
Metamethods
Tree:__eq (other) | Check equality of two trees by their root node. |
Methods
- Tree:copy ()
-
Create a shallow copy of the syntax tree.
You need to copy a syntax tree in order to use it on more than one thread at a time, as syntax trees are not thread safe.
Returns:
- Tree:root_node ()
-
Get the root node of the syntax tree.
Returns:
- Tree:root_node (byte_offset, point_offset)
-
Get the root node of the syntax tree, with its position shifted forward
by the given offset.
Parameters:
- byte_offset integer
- point_offset Point
Returns:
- Tree:language ()
-
Get the language that was used to parse the syntax tree.
Returns:
See also:
- Tree:included_ranges ()
-
Get the array of included ranges that was used to parse the syntax tree.
Returns:
See also:
- Tree:edit (start_byte, old_end_byte, new_end_byte, start_point, old_end_point, new_end_point)
-
Edit the syntax tree to keep it in sync with source code that has been
edited.
The edits have to be described in both byte offsets and Points.
Parameters: