+ default_rule = state_default_rule (state);
+
+ bitset_zero (shiftset);
+ FOR_EACH_SHIFT (transitions, i)
+ bitset_set (shiftset, TRANSITION_SYMBOL (transitions, i));
+
+ /* Compute the width of the lookaheads column. */
+ if (default_rule)
+ width = strlen (_("$default"));
+
+ if (redp->lookaheads)
+ for (i = 0; i < ntokens; i++)
+ {
+ int count = bitset_test (shiftset, i);
+
+ for (j = 0; j < redp->num; ++j)
+ if (bitset_test (redp->lookaheads[j], i))
+ {
+ if (count == 0)
+ {
+ if (redp->rules[j] != default_rule)
+ max_length (&width, symbols[i]->tag);
+ count++;
+ }
+ else
+ {
+ max_length (&width, symbols[i]->tag);
+ }
+ }
+ }
+
+ /* Nothing to report. */
+ if (!width)
+ return;
+
+ fputc ('\n', out);
+ width += 2;
+
+ /* Report lookaheads (or $default) and reductions. */
+ if (redp->lookaheads)
+ for (i = 0; i < ntokens; i++)
+ {
+ int defaulted = 0;
+ int count = bitset_test (shiftset, i);
+
+ for (j = 0; j < redp->num; ++j)
+ if (bitset_test (redp->lookaheads[j], i))
+ {
+ if (count == 0)
+ {
+ if (redp->rules[j] != default_rule)
+ print_reduction (out, width,
+ symbols[i]->tag,
+ redp->rules[j], true);
+ else
+ defaulted = 1;
+ count++;
+ }
+ else
+ {
+ if (defaulted)
+ print_reduction (out, width,
+ symbols[i]->tag,
+ default_rule, true);
+ defaulted = 0;
+ print_reduction (out, width,
+ symbols[i]->tag,
+ redp->rules[j], false);
+ }
+ }
+ }
+
+ if (default_rule)
+ print_reduction (out, width,
+ _("$default"), default_rule, true);