mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
* src/LR0.c (state_list_t, state_list_append): New.
(first_state, last_state): Now symbol_list_t. (this_state): Remove. (new_itemsets, append_states, save_reductions): Take a state_t as argument. (set_states, generate_states): Adjust. (save_shifts): Remove, replaced by... * src/state.h, src/state.c (state_shifts_set): New. (shifts): Rename as... (shifts_t): this. Adjust all dependencies. * src/state.h (state_t): Remove the `next' member.
This commit is contained in:
25
src/state.c
25
src/state.c
@@ -36,14 +36,15 @@
|
||||
`---------------------------------------*/
|
||||
|
||||
#define SHIFTS_ALLOC(Nshifts) \
|
||||
(shifts *) xcalloc ((unsigned) (sizeof (shifts) \
|
||||
+ (Nshifts - 1) * sizeof (short)), 1)
|
||||
(shifts_t *) xcalloc ((unsigned) (sizeof (shifts_t) \
|
||||
+ (Nshifts - 1) * sizeof (state_number_t)), 1)
|
||||
|
||||
shifts *
|
||||
shifts_new (int n)
|
||||
static shifts_t *
|
||||
shifts_new (int nshifts, state_number_t *shifts)
|
||||
{
|
||||
shifts *res = SHIFTS_ALLOC (n);
|
||||
res->nshifts = n;
|
||||
shifts_t *res = SHIFTS_ALLOC (nshifts);
|
||||
res->nshifts = nshifts;
|
||||
memcpy (res->shifts, shifts, nshifts * sizeof (shifts[0]));
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -147,6 +148,18 @@ state_new (symbol_number_t accessing_symbol,
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------.
|
||||
| Set the shifts of STATE. |
|
||||
`--------------------------*/
|
||||
|
||||
void
|
||||
state_shifts_set (state_t *state, int nshifts, state_number_t *shifts)
|
||||
{
|
||||
state->shifts = shifts_new (nshifts, shifts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------.
|
||||
| Print on OUT all the lookaheads such that this STATE wants to |
|
||||
| reduce this RULE. |
|
||||
|
||||
Reference in New Issue
Block a user