- for (j = 0; j < state->nlookaheads; ++j)
- if (bitset_test (LA[state->lookaheadsp + j], i))
- {
- if (count == 0)
- {
- if (state->lookaheadsp + j != default_LA)
- fprintf (out,
- _(" %-4s\treduce using rule %d (%s)\n"),
- symbol_tag_get (symbols[i]),
- LArule[state->lookaheadsp + j]->number - 1,
- symbol_tag_get_n (LArule[state->lookaheadsp + j]->lhs, 1));
- else
- defaulted = 1;
-
- count++;
- }
- else
- {
- if (defaulted)
- fprintf (out,
- _(" %-4s\treduce using rule %d (%s)\n"),
- symbol_tag_get (symbols[i]),
- LArule[default_LA]->number - 1,
- symbol_tag_get_n (LArule[default_LA]->lhs, 1));
- defaulted = 0;
- fprintf (out,
- _(" %-4s\t[reduce using rule %d (%s)]\n"),
- symbol_tag_get (symbols[i]),
- LArule[state->lookaheadsp + j]->number - 1,
- symbol_tag_get_n (LArule[state->lookaheadsp + j]->lhs, 1));
- }
- }
- }
+ /* Report lookahead tokens (or $default) and reductions. */
+ if (reds->lookahead_tokens)
+ for (i = 0; i < ntokens; i++)
+ {
+ bool defaulted = false;
+ bool count = bitset_test (no_reduce_set, i);
+ if (count)
+ default_reduction_only = false;
+
+ for (j = 0; j < reds->num; ++j)
+ if (bitset_test (reds->lookahead_tokens[j], i))
+ {
+ if (! count)
+ {
+ if (reds->rules[j] != default_reduction)
+ {
+ default_reduction_only = false;
+ print_reduction (out, width,
+ symbols[i]->tag,
+ reds->rules[j], true);
+ }
+ else
+ defaulted = true;
+ count = true;
+ }
+ else
+ {
+ default_reduction_only = false;
+ if (defaulted)
+ print_reduction (out, width,
+ symbols[i]->tag,
+ default_reduction, true);
+ defaulted = false;
+ print_reduction (out, width,
+ symbols[i]->tag,
+ reds->rules[j], false);
+ }
+ }
+ }