docs: explicitly mention behavior of walking outside the given "root" node for a TSTreeCursor
This commit is contained in:
parent
74812ced1b
commit
665f5a0793
1 changed files with 6 additions and 0 deletions
|
|
@ -410,6 +410,12 @@ Internally, copying a syntax tree just entails incrementing an atomic reference
|
|||
|
||||
You can access every node in a syntax tree using the `TSNode` APIs [described above](#retrieving-nodes), but if you need to access a large number of nodes, the fastest way to do so is with a _tree cursor_. A cursor is a stateful object that allows you to walk a syntax tree with maximum efficiency.
|
||||
|
||||
Note that the given input node is considered the root of the cursor, and the
|
||||
cursor cannot walk outside this node, so going to the parent or any sibling
|
||||
of the root node will return `false`. This has no unexpected effects if the given
|
||||
input node is the actual `root` node of the tree, but is something to keep in mind
|
||||
when using nodes that are not the `root` node.
|
||||
|
||||
You can initialize a cursor from any node:
|
||||
|
||||
```c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue