X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Fparsergen.mdc;h=6d291312547f0aad1ddadc57ee2affeb7e8b3802;hp=d12a4000d3712f6a44eaf486a284793073e1abf8;hb=afa1be3c3a7f14a8c476d937a33376490272ba45;hpb=e96a9148cef03554ac07203c2e2441277c9b5845 diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index d12a400..6d29131 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -1800,14 +1800,20 @@ counted, and are reported as non-critical. This will not affect a int p = item_prod(itm); int bp = item_index(itm); struct production *pr = g->productions[p]; + struct symbol *s; - if (bp < pr->body_size && - pr->body[bp]->type == Terminal) { - /* shiftable */ - int sym = pr->body[bp]->num; - if (symset_find(&shifts, sym) < 0) - symset_add(&shifts, sym, itm); - } + if (bp >= pr->body_size || + pr->body[bp]->type != Terminal) + /* not shiftable */ + continue; + + s = pr->body[bp]; + if (s->precedence && is->precedence) + /* Precedence resolves this, so no conflict */ + continue; + + if (symset_find(&shifts, s->num) < 0) + symset_add(&shifts, s->num, itm); } /* Now look for reductions and conflicts */ for (j = 0; j < is->items.cnt; j++) {