Include rows and columns in TSLength

This way, we don't have to have separate 1D and 2D versions for so many values
This commit is contained in:
Max Brunsfeld 2015-12-04 20:20:29 -08:00
parent 22c76fc71b
commit d2bf88d5fe
14 changed files with 186 additions and 241 deletions

View file

@ -126,18 +126,15 @@ static StackNode *stack_node_new(StackNode *next, TSStateId state, TSTree *tree)
ts_tree_retain(tree);
stack_node_retain(next);
TSLength position = ts_tree_total_size(tree);
TSPoint position_point = ts_tree_total_size_point(tree);
if (next) {
if (next)
position = ts_length_add(next->entry.position, position);
position_point = ts_point_add(next->entry.position_point, position_point);
}
*self = (StackNode){
.ref_count = 1,
.successor_count = 1,
.successors = { next, NULL, NULL },
.entry =
{
.state = state, .tree = tree, .position = position, .position_point = position_point,
.state = state, .tree = tree, .position = position
},
};
return self;