- int symbol;
- int state1 = shiftp->shifts[i];
- if (!state1)
- continue;
- symbol = state_table[state1].accessing_symbol;
- fprintf (out, _(" %-4s\tgo to state %d\n"),
- tags[symbol], state1);
+ int j;
+ int defaulted = 0;
+ int count = BITISSET (shiftset, i);
+
+ for (j = 0; j < state->nlookaheads; ++j)
+ {
+ if (BITISSET (LA (state->lookaheadsp + j), i))
+ {
+ if (count == 0)
+ {
+ if (state->lookaheadsp + j != default_LA)
+ fprintf (out,
+ _(" %-4s\treduce using rule %d (%s)\n"),
+ escape (symbols[i]->tag),
+ LAruleno[state->lookaheadsp + j] - 1,
+ escape2 (symbols[rules[LAruleno[state->lookaheadsp + j]].lhs]->tag));
+ else
+ defaulted = 1;
+
+ count++;
+ }
+ else
+ {
+ if (defaulted)
+ fprintf (out,
+ _(" %-4s\treduce using rule %d (%s)\n"),
+ escape (symbols[i]->tag),
+ LAruleno[default_LA] - 1,
+ escape2 (symbols[rules[LAruleno[default_LA]].lhs]->tag));
+ defaulted = 0;
+ fprintf (out,
+ _(" %-4s\t[reduce using rule %d (%s)]\n"),
+ escape (symbols[i]->tag),
+ LAruleno[state->lookaheadsp + j] - 1,
+ escape2 (symbols[rules[LAruleno[state->lookaheadsp + j]].lhs]->tag));
+ }
+ }
+ }