mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 07:43:03 +00:00
* src/state.h, src/state.c (reductions_new): New.
* src/LR0.c (set_state_table): Let all the states have a `reductions', even if reduced to 0. (save_reductions): Adjust. * src/lalr.c (initialize_LA, initialize_lookaheads): Adjust. * src/print.c (print_reductions, print_actions): Adjust. * src/output.c (action_row): Adjust.
This commit is contained in:
16
src/LR0.c
16
src/LR0.c
@@ -522,15 +522,8 @@ save_reductions (void)
|
||||
}
|
||||
|
||||
/* Make a reductions structure and copy the data into it. */
|
||||
|
||||
if (count)
|
||||
{
|
||||
reductions *p = REDUCTIONS_ALLOC (count);
|
||||
p->nreds = count;
|
||||
shortcpy (p->rules, redset, count);
|
||||
|
||||
this_state->reductions = p;
|
||||
}
|
||||
this_state->reductions = reductions_new (count);
|
||||
shortcpy (this_state->reductions->rules, redset, count);
|
||||
}
|
||||
|
||||
|
||||
@@ -547,11 +540,14 @@ set_state_table (void)
|
||||
for (sp = first_state; sp; sp = sp->next)
|
||||
{
|
||||
/* Pessimization, but simplification of the code: make sure all
|
||||
the states have a shifts and errs, even if reduced to 0. */
|
||||
the states have a shifts, errs, and reductions, even if
|
||||
reduced to 0. */
|
||||
if (!sp->shifts)
|
||||
sp->shifts = shifts_new (0);
|
||||
if (!sp->errs)
|
||||
sp->errs = errs_new (0);
|
||||
if (!sp->reductions)
|
||||
sp->reductions = reductions_new (0);
|
||||
|
||||
state_table[sp->number] = sp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user