+ /* 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);
+}
+
+
+/*--------------------------------------------------------------.
+| Report on OUT all the actions (shifts, gotos, reductions, and |
+| explicit erros from %nonassoc) of S. |
+`--------------------------------------------------------------*/
+
+static void
+print_actions (FILE *out, state *s)
+{
+ /* Print shifts. */
+ print_transitions (s, out, true);
+ print_errs (out, s);
+ print_reductions (out, s);
+ /* Print gotos. */
+ print_transitions (s, out, false);