I’m trying to iterate through the syntax tree generated by a the lezer parser using the .next() method and process all of the leaf nodes. I’ve been looking through the lezer reference manual and I’m curious about the best way to do the following:
- Determine whether a TreeCursor is pointing to a leaf node.
- Determine whether a TreeCursor is pointing at the last node in the tree (in terms of a DFS pre-order). Alternatively, it seems that the .next() method brings the cursor back to the top of the tree after the last node, so
- Determine whether the TreeCursor is pointing at the top of the tree.