node_text()
returns the document text underlying a node.
Examples
language <- treesitter.r::language()
parser <- parser(language)
text <- "1 + foo"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
node |>
node_child(1) |>
node_child_by_field_name("rhs") |>
node_text()
#> [1] "foo"