node_symbol | R Documentation |
node_symbol()
returns the symbol id of the current node as an integer.
node_symbol(x)
x |
A node. |
A single integer.
language <- treesitter.r::language()
parser <- parser(language)
text <- "fn <- function() { 1 + 1 }"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
# Top level program node
node_symbol(node)
# The whole `<-` binary operator node
node <- node_child(node, 1)
node_symbol(node)
# Just the literal `<-` operator itself
node <- node_child_by_field_name(node, "operator")
node_symbol(node)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.