mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13: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:
@@ -93,8 +93,8 @@ resolve_sr_conflict (state_t *state, int lookahead)
|
||||
int i;
|
||||
/* find the rule to reduce by to get precedence of reduction */
|
||||
int redprec = rule_table[LAruleno[lookahead]].prec;
|
||||
errs *errp = ERRS_ALLOC (ntokens + 1);
|
||||
short *errtokens = errp->errs;
|
||||
errs *errp = errs_new (ntokens + 1);
|
||||
errp->nerrs = 0;
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (BITISSET (LA (lookahead), i)
|
||||
@@ -137,17 +137,14 @@ resolve_sr_conflict (state_t *state, int lookahead)
|
||||
flush_shift (state, i);
|
||||
flush_reduce (lookahead, i);
|
||||
/* Record an explicit error for this token. */
|
||||
*errtokens++ = i;
|
||||
errp->errs[errp->nerrs++] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
errp->nerrs = errtokens - errp->errs;
|
||||
/* Some tokens have been explicitly made errors. Allocate a
|
||||
permanent errs structure for this state, to record them. */
|
||||
i = (char *) errtokens - (char *) errp;
|
||||
state->errs = ERRS_ALLOC (i + 1);
|
||||
memcpy (state->errs, errp, i);
|
||||
state->errs = errs_dup (errp);
|
||||
free (errp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user