diff --git a/src/runtime/parser.c b/src/runtime/parser.c index 4363add3..15424cd9 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -33,7 +33,7 @@ static TSLength breakdown_stack(TSParser *parser, TSInputEdit *edit) { } TSStack *stack = &parser->stack; - TSLength position = ts_stack_right_position(stack); + TSLength position = ts_stack_total_tree_size(stack); for (;;) { TSTree *node = ts_stack_top_node(stack); @@ -71,7 +71,7 @@ static TSLength breakdown_stack(TSParser *parser, TSInputEdit *edit) { static void resize_error(TSParser *parser, TSTree *error) { error->size = ts_length_sub(ts_length_sub(parser->lexer.token_start_position, - ts_stack_right_position(&parser->stack)), + ts_stack_total_tree_size(&parser->stack)), error->padding); } diff --git a/src/runtime/stack.c b/src/runtime/stack.c index 5958fc8e..72e90e71 100644 --- a/src/runtime/stack.c +++ b/src/runtime/stack.c @@ -47,7 +47,7 @@ void ts_stack_shrink(TSStack *stack, size_t new_size) { stack->size = new_size; } -TSLength ts_stack_right_position(const TSStack *stack) { +TSLength ts_stack_total_tree_size(const TSStack *stack) { TSLength result = ts_length_zero(); for (size_t i = 0; i < stack->size; i++) { TSTree *node = stack->entries[i].node; diff --git a/src/runtime/stack.h b/src/runtime/stack.h index 2e7c9ab9..bbf3580d 100644 --- a/src/runtime/stack.h +++ b/src/runtime/stack.h @@ -24,7 +24,7 @@ void ts_stack_shrink(TSStack *stack, size_t new_size); void ts_stack_push(TSStack *stack, TSStateId state, TSTree *node); TSStateId ts_stack_top_state(const TSStack *stack); TSTree *ts_stack_top_node(const TSStack *stack); -TSLength ts_stack_right_position(const TSStack *stack); +TSLength ts_stack_total_tree_size(const TSStack *stack); #define TS_STACK_FROM_TOP(stack, entry) \ for (TSStackEntry *entry = (stack).entries + (stack).size - 1; \