language_next_state {treesitter} | R Documentation |
Language state advancement
Description
Get the next state in the grammar.
Usage
language_next_state(x, state, symbol)
Arguments
x |
A tree-sitter language object. |
state , symbol |
Vectors of equal length containing the current state and symbol information. |
Value
A single integer representing the next state.
Examples
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)
[Package treesitter version 0.1.0 Index]