X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/e41fdc9310174cd2718308bb8fb52d86c479e204..0c2d3f4cba35c4bbea660794ab3cf91c030aafd3:/src/reduce.c diff --git a/src/reduce.c b/src/reduce.c index 2d51a24c..fd6f9e15 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -306,11 +306,17 @@ nonterminals_reduce (void) free (symbols_sorted + ntokens); } - for (i = 0; i < nritems; ++i) - if (ISVAR (ritem[i])) - ritem[i] = token_number_as_item_number (nontermmap[ritem[i]]); - - start_symbol = nontermmap[start_symbol]; + { + int r; + for (r = 1; r < nrules + 1; ++r) + { + item_number_t *rhsp; + for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) + if (ISVAR (*rhsp)) + *rhsp = token_number_as_item_number (nontermmap[*rhsp]); + } + start_symbol = nontermmap[start_symbol]; + } nsyms -= nuseless_nonterminals; nvars -= nuseless_nonterminals;