* 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:
Akim Demaille
2001-12-27 18:10:48 +00:00
parent 13ca549a75
commit 2cec70b9f1
7 changed files with 70 additions and 45 deletions

View File

@@ -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;
}