+ default_rule = state_default_rule (s);
+
+ bitset_zero (shift_set);
+ FOR_EACH_SHIFT (trans, i)
+ bitset_set (shift_set, TRANSITION_SYMBOL (trans, i));
+
+ /* Compute the width of the look-ahead token column. */
+ if (default_rule)
+ width = strlen (_("$default"));
+
+ if (reds->look_ahead_tokens)
+ for (i = 0; i < ntokens; i++)
+ {
+ bool count = bitset_test (shift_set, i);
+
+ for (j = 0; j < reds->num; ++j)
+ if (bitset_test (reds->look_ahead_tokens[j], i))
+ {
+ if (! count)
+ {
+ if (reds->rules[j] != default_rule)
+ max_length (&width, symbols[i]->tag);
+ count = true;
+ }
+ else
+ {
+ max_length (&width, symbols[i]->tag);
+ }
+ }
+ }
+
+ /* Nothing to report. */
+ if (!width)
+ return;
+
+ fputc ('\n', out);
+ width += 2;
+
+ /* Report look-ahead tokens (or $default) and reductions. */
+ if (reds->look_ahead_tokens)
+ for (i = 0; i < ntokens; i++)
+ {
+ bool defaulted = false;
+ bool count = bitset_test (shift_set, i);
+
+ for (j = 0; j < reds->num; ++j)
+ if (bitset_test (reds->look_ahead_tokens[j], i))
+ {
+ if (! count)
+ {
+ if (reds->rules[j] != default_rule)
+ print_reduction (out, width,
+ symbols[i]->tag,
+ reds->rules[j], true);
+ else
+ defaulted = true;
+ count = true;
+ }
+ else
+ {
+ if (defaulted)
+ print_reduction (out, width,
+ symbols[i]->tag,
+ default_rule, true);
+ defaulted = false;
+ print_reduction (out, width,
+ symbols[i]->tag,
+ reds->rules[j], false);
+ }
+ }
+ }
+
+ if (default_rule)
+ print_reduction (out, width,
+ _("$default"), default_rule, true);