node_get_root | R Documentation |
Recover the tree root from a node
node_get_root(x)
x |
A node, either from |
A list of two elements: start
and end
. Each of those is a vector
with two values indicating the row and column. Those are 0-indexed.
src <- "
print('hi')
fn <- function() {
print('hello')
}
"
root <- src |>
tree_new() |>
tree_root()
root |>
node_find(ast_rule(pattern = "print($A)")) |>
node_get_root() |>
tree_root() |>
node_text()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.