- int i;
- shifts *shiftp = state->shifts;
- reductions *redp = state->reductions;
- errs *errp = state->errs;
- int nodefault = 0;
-
- if (state->consistent)
- {
- int rule = redp->rules[0];
- int symbol = rule_table[rule].lhs;
- fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"),
- rule, tags[symbol]);
- return;
- }
-
- for (i = 0; i < tokensetsize; i++)
- shiftset[i] = 0;
-
- for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
- if (!SHIFT_IS_DISABLED (shiftp, i))
- {
- /* if this state has a shift for the error token, don't use a
- default rule. */
- if (SHIFT_IS_ERROR (shiftp, i))
- nodefault = 1;
- SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
- }
-
- if (errp)
- for (i = 0; i < errp->nerrs; i++)
- if (errp->errs[i])
- SETBIT (shiftset, errp->errs[i]);
-
- if (state->nlookaheads == 1 && !nodefault)
- {
- int k;
- int default_rule = LAruleno[state->lookaheadsp];
-
- for (k = 0; k < tokensetsize; ++k)
- lookaheadset[k] = LA (state->lookaheadsp)[k] & shiftset[k];
-
- for (i = 0; i < ntokens; i++)
- if (BITISSET (lookaheadset, i))
- fprintf (out, _(" %-4s\t[reduce using rule %d (%s)]\n"),
- tags[i], default_rule,
- tags[rule_table[default_rule].lhs]);