/* Display the lookaheads? */
if (report_flag & report_lookaheads)
- {
- int j, k;
- int nlookaheads = 0;
- /* Look for lookaheads corresponding to this rule. */
- for (j = 0; j < state->nlookaheads; ++j)
- for (k = 0; k < ntokens; ++k)
- if (bitset_test (LA[state->lookaheadsp + j], k)
- && LArule[state->lookaheadsp + j]->number == rule)
- nlookaheads++;
- if (nlookaheads)
- {
- fprintf (out, " [");
- for (j = 0; j < state->nlookaheads; ++j)
- for (k = 0; k < ntokens; ++k)
- if (bitset_test (LA[state->lookaheadsp + j], k)
- && LArule[state->lookaheadsp + j]->number == rule)
- fprintf (out, "%s%s",
- symbol_tag_get (symbols[k]),
- --nlookaheads ? ", " : "");
- fprintf (out, "]");
- }
- }
+ state_rule_lookaheads_print (state, &rules[rule], out);
fprintf (out, _(" (rule %d)"), rule - 1);
fputc ('\n', out);
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
- int state1 = shiftp->shifts[i];
+ state_number_t state1 = shiftp->shifts[i];
symbol_number_t symbol = states[state1]->accessing_symbol;
fprintf (out,
_(" %-4s\tshift, and go to state %d\n"),
for (; i < shiftp->nshifts; i++)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
- int state1 = shiftp->shifts[i];
+ state_number_t state1 = shiftp->shifts[i];
symbol_number_t symbol = states[state1]->accessing_symbol;
fprintf (out, _(" %-4s\tgo to state %d\n"),
symbol_tag_get (symbols[symbol]), state1);
if (state->nlookaheads == 1 && !nodefault)
{
- rule_t *default_rule = LArule[state->lookaheadsp];
+ rule_t *default_rule = state->lookaheads_rule[0];
- bitset_and (lookaheadset, LA[state->lookaheadsp], shiftset);
+ bitset_and (lookaheadset, state->lookaheads[0], shiftset);
for (i = 0; i < ntokens; i++)
if (bitset_test (lookaheadset, i))
int count = 0;
int j;
- bitset_andn (lookaheadset, LA[state->lookaheadsp + i], shiftset);
+ bitset_andn (lookaheadset, state->lookaheads[i], shiftset);
for (j = 0; j < ntokens; j++)
if (bitset_test (lookaheadset, j))
if (count > cmax)
{
cmax = count;
- default_LA = state->lookaheadsp + i;
- default_rule = LArule[state->lookaheadsp + i];
+ default_LA = i;
+ default_rule = state->lookaheads_rule[i];
}
bitset_or (shiftset, shiftset, lookaheadset);
int count = bitset_test (shiftset, i);
for (j = 0; j < state->nlookaheads; ++j)
- if (bitset_test (LA[state->lookaheadsp + j], i))
+ if (bitset_test (state->lookaheads[j], i))
{
if (count == 0)
{
- if (state->lookaheadsp + j != default_LA)
+ if (j != default_LA)
fprintf (out,
_(" %-4s\treduce using rule %d (%s)\n"),
symbol_tag_get (symbols[i]),
- LArule[state->lookaheadsp + j]->number - 1,
- symbol_tag_get_n (LArule[state->lookaheadsp + j]->lhs, 1));
+ state->lookaheads_rule[j]->number - 1,
+ symbol_tag_get_n (state->lookaheads_rule[j]->lhs, 1));
else
defaulted = 1;
fprintf (out,
_(" %-4s\treduce using rule %d (%s)\n"),
symbol_tag_get (symbols[i]),
- LArule[default_LA]->number - 1,
- symbol_tag_get_n (LArule[default_LA]->lhs, 1));
+ state->lookaheads_rule[default_LA]->number - 1,
+ symbol_tag_get_n (state->lookaheads_rule[default_LA]->lhs, 1));
defaulted = 0;
fprintf (out,
_(" %-4s\t[reduce using rule %d (%s)]\n"),
symbol_tag_get (symbols[i]),
- LArule[state->lookaheadsp + j]->number - 1,
- symbol_tag_get_n (LArule[state->lookaheadsp + j]->lhs, 1));
+ state->lookaheads_rule[j]->number - 1,
+ symbol_tag_get_n (state->lookaheads_rule[j]->lhs, 1));
}
}
}
if (shiftp->nshifts == 0 && redp->nreds == 0)
{
- if (final_state == state->number)
+ if (state->number == final_state->number)
fprintf (out, _(" $default\taccept\n"));
else
fprintf (out, _(" NO ACTIONS\n"));
void
print_results (void)
{
- size_t i;
+ state_number_t i;
/* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
that conflicts with Posix. */