mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
* src/state.h, src/state.c (errs_new, errs_dup): New.
* src/LR0.c (set_state_table): Let all the states have an errs, even if reduced to 0. * src/print.c (print_errs, print_reductions): Adjust. * src/output.c (output_actions, action_row): Adjust. * src/conflicts.c (resolve_sr_conflict): Adjust.
This commit is contained in:
31
src/state.c
31
src/state.c
@@ -26,6 +26,10 @@
|
||||
| Create a new array of N shitfs. |
|
||||
`---------------------------------*/
|
||||
|
||||
#define SHIFTS_ALLOC(Nshifts) \
|
||||
(shifts *) xcalloc ((unsigned) (sizeof (shifts) \
|
||||
+ (Nshifts - 1) * sizeof (short)), 1)
|
||||
|
||||
shifts *
|
||||
shifts_new (int n)
|
||||
{
|
||||
@@ -33,3 +37,30 @@ shifts_new (int n)
|
||||
res->nshifts = n;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------.
|
||||
| Create a new array of N errs. |
|
||||
`-------------------------------*/
|
||||
|
||||
#define ERRS_ALLOC(Nerrs) \
|
||||
(errs *) xcalloc ((unsigned) (sizeof (errs) \
|
||||
+ (Nerrs - 1) * sizeof (short)), 1)
|
||||
|
||||
|
||||
errs *
|
||||
errs_new (int n)
|
||||
{
|
||||
errs *res = ERRS_ALLOC (n);
|
||||
res->nerrs = n;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
errs *
|
||||
errs_dup (errs *src)
|
||||
{
|
||||
errs *res = errs_new (src->nerrs);
|
||||
memcpy (res->errs, src->errs, src->nerrs);
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user