language_next_state | R Documentation |
Get the next state in the grammar.
language_next_state(x, state, symbol)
x |
A tree-sitter language object. |
state , symbol |
Vectors of equal length containing the current state and symbol information. |
A single integer representing the next state.
language <- treesitter.r::language()
parser <- parser(language)
text <- "fn <- function() { 1 + 1 }"
tree <- parser_parse(parser, text)
node <- tree_root_node(tree)
# Navigate to function definition
node <- node_child(node, 1)
node <- node_child(node, 3)
node
state <- node_parse_state(node)
symbol <- node_grammar_symbol(node)
# Function definition symbol
language_symbol_name(language, 85)
# Next state (this is all grammar dependent)
language_next_state(language, state, symbol)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.