diff --git a/src/backends/lr.c b/src/backends/lr.c index 392d3f6..4ab53bc 100644 --- a/src/backends/lr.c +++ b/src/backends/lr.c @@ -170,11 +170,19 @@ HLRAction *h_lr_conflict(HArena *arena, HLRAction *action, HLRAction *new) action->type = HLR_CONFLICT; action->branches = h_slist_new(arena); h_slist_push(action->branches, old); + h_slist_push(action->branches, new); + } else { + // check if 'new' is already among branches + HSlistNode *x; + for(x=action->branches->head; x; x=x->next) { + if(x->elem == new) + break; + } + // add 'new' if it is not already in list + if(x == NULL) + h_slist_push(action->branches, new); } - assert(action->type == HLR_CONFLICT); - h_slist_push(action->branches, new); - return action; }