tree_walk | R Documentation |
TreeCursor
iteratortree_walk()
creates a TreeCursor starting at the root node. You can
use it to "walk" the tree more efficiently than using node_child()
and
other similar node functions.
tree_walk(x)
x |
A tree. |
A TreeCursor
object.
language <- treesitter.r::language()
parser <- parser(language)
text <- "1 + foo"
tree <- parser_parse(parser, text)
cursor <- tree_walk(tree)
cursor$goto_first_child()
cursor$goto_first_child()
cursor$node()
cursor$goto_next_sibling()
cursor$node()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.