tree_root_node | R Documentation |
tree_root_node()
is the entry point for accessing nodes within
a specific tree. It returns the "root" of the tree, from which you
can use other node_*()
functions to navigate around.
tree_root_node(x)
x |
A tree. |
A node.
language <- treesitter.r::language()
parser <- parser(language)
text <- "fn <- function() { 1 + 1 }"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
# Trees and nodes have a similar print method, but you can
# only use other `node_*()` functions on nodes.
tree
node
node |>
node_child(1) |>
node_children()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.