node-grammar | R Documentation |
node_grammar_type()
gets the node's type as it appears in the grammar,
ignoring aliases.
node_grammar_symbol()
gets the node's symbol (the type as a numeric id)
as it appears in the grammar, ignoring aliases. This should be used in
language_next_state()
rather than node_symbol()
.
node_grammar_type(x)
node_grammar_symbol(x)
x |
A node. |
node_type()
, node_symbol()
language <- treesitter.r::language()
parser <- parser(language)
text <- "fn <- function() { 1 + 1 }"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
# Examples for these functions are highly specific to the grammar,
# because they relies on the placement of `alias()` calls in the grammar.
node_grammar_type(node)
node_grammar_symbol(node)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.