Create ambiguity nodes when joining stack heads

This commit is contained in:
Max Brunsfeld 2015-05-28 15:06:39 -07:00
parent 1ca5f4ab15
commit 381f89f8ba
13 changed files with 130 additions and 72 deletions

View file

@ -120,6 +120,18 @@ TSTree *ts_tree_make_node(TSSymbol symbol, size_t child_count,
return result;
}
TSTree *ts_tree_make_ambiguity(size_t alternative_count, TSTree **alternatives) {
TSTree *result = malloc(sizeof(TSTree));
*result = (TSTree) { .ref_count = 1,
.symbol = ts_builtin_sym_ambiguity,
.size = alternatives[0]->size,
.padding = alternatives[0]->padding,
.child_count = alternative_count,
.children = alternatives,
.options = 0 };
return result;
}
void ts_tree_retain(TSTree *tree) { tree->ref_count++; }
void ts_tree_release(TSTree *tree) {