+ bitset_zero (shiftset);
+
+ for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
+ if (!SHIFT_IS_DISABLED (shiftp, i))
+ bitset_set (shiftset, SHIFT_SYMBOL (shiftp, i));
+
+ for (i = 0; i < ntokens; i++)
+ {
+ int j;
+ int defaulted = 0;
+ int count = bitset_test (shiftset, i);
+
+ 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"),
+ 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));
+ }
+ }
+ }
+ }
+
+ if (default_LA >= 0)
+ fprintf (out, _(" $default\treduce using rule %d (%s)\n"),
+ default_rule - 1,
+ escape (symbols[rules[default_rule].lhs]->tag));
+ }
+}
+
+
+static void
+print_actions (FILE *out, state_t *state)
+{
+ reductions *redp = state->reductions;
+ shifts *shiftp = state->shifts;
+
+ if (shiftp->nshifts == 0 && redp->nreds == 0)
+ {
+ if (final_state == state->number)
+ fprintf (out, _(" $default\taccept\n"));
+ else
+ fprintf (out, _(" NO ACTIONS\n"));
+ return;