Don't mutate shared lookahead nodes when setting the extra flag

This commit is contained in:
Max Brunsfeld 2015-12-15 22:28:50 -08:00
parent 71059f1d66
commit 3c3d95345f
3 changed files with 10 additions and 0 deletions

View file

@ -41,6 +41,12 @@ TSTree *ts_tree_make_error(TSLength size, TSLength padding, char lookahead_char)
return result;
}
TSTree *ts_tree_make_copy(TSTree *self) {
TSTree *result = malloc(sizeof(TSTree));
*result = *self;
return result;
}
void ts_tree_assign_parents(TSTree *self) {
TSLength offset = ts_length_zero();
for (size_t i = 0; i < self->child_count; i++) {