Rename stack_right_position -> stack_total_tree_size

I want to re-use the stack data structure for storing the
re-usable nodes from the previous parse tree during an edit.
In this case, the stack won't conceptually start at position
zero, so the name 'right_position' doesn't make sense.
This commit is contained in:
Max Brunsfeld 2014-10-08 17:37:20 -07:00
parent 26f9e22193
commit 80b8a0a9fb
3 changed files with 4 additions and 4 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -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; \