mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
* src/LR0.c: Attach shifts to states as soon as they are
computed. * src/lalr.c (set_state_table): Instead of assigning shifts to state, just assert that the mapping was properly done.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2001-12-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/LR0.c: Attach shifts to states as soon as they are
|
||||||
|
computed.
|
||||||
|
* src/lalr.c (set_state_table): Instead of assigning shifts to
|
||||||
|
state, just assert that the mapping was properly done.
|
||||||
|
|
||||||
|
|
||||||
2001-12-10 Akim Demaille <akim@epita.fr>
|
2001-12-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/LR0.c (insert_start_shift): Rename as...
|
* src/LR0.c (insert_start_shift): Rename as...
|
||||||
|
|||||||
10
src/LR0.c
10
src/LR0.c
@@ -320,8 +320,8 @@ save_shifts (void)
|
|||||||
shifts *p = shifts_new (nshifts);
|
shifts *p = shifts_new (nshifts);
|
||||||
|
|
||||||
p->number = this_state->number;
|
p->number = this_state->number;
|
||||||
|
|
||||||
shortcpy (p->shifts, shiftset, nshifts);
|
shortcpy (p->shifts, shiftset, nshifts);
|
||||||
|
this_state->shifts = p;
|
||||||
|
|
||||||
if (last_shift)
|
if (last_shift)
|
||||||
last_shift->next = p;
|
last_shift->next = p;
|
||||||
@@ -361,6 +361,7 @@ insert_start_shifting_state (void)
|
|||||||
|
|
||||||
/* Make a shift from this state to (what will be) the final state. */
|
/* Make a shift from this state to (what will be) the final state. */
|
||||||
sp = shifts_new (1);
|
sp = shifts_new (1);
|
||||||
|
statep->shifts = sp;
|
||||||
sp->number = nstates++;
|
sp->number = nstates++;
|
||||||
sp->shifts[0] = nstates;
|
sp->shifts[0] = nstates;
|
||||||
|
|
||||||
@@ -392,6 +393,7 @@ insert_eof_shifting_state (void)
|
|||||||
|
|
||||||
/* Make the shift from the final state to the termination state. */
|
/* Make the shift from the final state to the termination state. */
|
||||||
sp = shifts_new (1);
|
sp = shifts_new (1);
|
||||||
|
statep->shifts = sp;
|
||||||
sp->number = nstates++;
|
sp->number = nstates++;
|
||||||
sp->shifts[0] = nstates;
|
sp->shifts[0] = nstates;
|
||||||
|
|
||||||
@@ -441,6 +443,7 @@ augment_automaton (void)
|
|||||||
initial state to the next-to-final state. */
|
initial state to the next-to-final state. */
|
||||||
|
|
||||||
shifts *sp = shifts_new (1);
|
shifts *sp = shifts_new (1);
|
||||||
|
first_state->shifts = sp;
|
||||||
sp->shifts[0] = nstates;
|
sp->shifts[0] = nstates;
|
||||||
|
|
||||||
/* Initialize the chain of shifts with sp. */
|
/* Initialize the chain of shifts with sp. */
|
||||||
@@ -477,6 +480,7 @@ augment_automaton (void)
|
|||||||
int i;
|
int i;
|
||||||
shifts *sp2 = shifts_new (sp->nshifts + 1);
|
shifts *sp2 = shifts_new (sp->nshifts + 1);
|
||||||
sp2->number = statep->number;
|
sp2->number = statep->number;
|
||||||
|
statep->shifts = sp2;
|
||||||
sp2->shifts[0] = nstates;
|
sp2->shifts[0] = nstates;
|
||||||
for (i = sp->nshifts; i > 0; i--)
|
for (i = sp->nshifts; i > 0; i--)
|
||||||
sp2->shifts[i] = sp->shifts[i - 1];
|
sp2->shifts[i] = sp->shifts[i - 1];
|
||||||
@@ -493,6 +497,7 @@ augment_automaton (void)
|
|||||||
{
|
{
|
||||||
shifts *sp2 = shifts_new (1);
|
shifts *sp2 = shifts_new (1);
|
||||||
sp2->number = statep->number;
|
sp2->number = statep->number;
|
||||||
|
statep->shifts = sp2;
|
||||||
sp2->shifts[0] = nstates;
|
sp2->shifts[0] = nstates;
|
||||||
|
|
||||||
/* Patch sp2 into the chain of shifts between sp1 and sp. */
|
/* Patch sp2 into the chain of shifts between sp1 and sp. */
|
||||||
@@ -512,7 +517,7 @@ augment_automaton (void)
|
|||||||
/* Add one more shift in first_shift,
|
/* Add one more shift in first_shift,
|
||||||
going to the next-to-final state (yet to be made). */
|
going to the next-to-final state (yet to be made). */
|
||||||
sp2 = shifts_new (sp->nshifts + 1);
|
sp2 = shifts_new (sp->nshifts + 1);
|
||||||
|
first_state->shifts = sp2;
|
||||||
/* Stick this shift into the vector at the proper place. */
|
/* Stick this shift into the vector at the proper place. */
|
||||||
statep = first_state->next;
|
statep = first_state->next;
|
||||||
for (k = 0, i = 0; i < sp->nshifts; k++, i++)
|
for (k = 0, i = 0; i < sp->nshifts; k++, i++)
|
||||||
@@ -544,6 +549,7 @@ augment_automaton (void)
|
|||||||
/* The initial state didn't even have any shifts.
|
/* The initial state didn't even have any shifts.
|
||||||
Give it one shift, to the next-to-final state. */
|
Give it one shift, to the next-to-final state. */
|
||||||
shifts *sp = shifts_new (1);
|
shifts *sp = shifts_new (1);
|
||||||
|
first_state->shifts = sp;
|
||||||
sp->shifts[0] = nstates;
|
sp->shifts[0] = nstates;
|
||||||
|
|
||||||
/* Patch sp into the chain of shifts at the beginning. */
|
/* Patch sp into the chain of shifts at the beginning. */
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ set_state_table (void)
|
|||||||
{
|
{
|
||||||
shifts *sp;
|
shifts *sp;
|
||||||
for (sp = first_shift; sp; sp = sp->next)
|
for (sp = first_shift; sp; sp = sp->next)
|
||||||
state_table[sp->number]->shifts = sp;
|
assert (state_table[sp->number]->shifts == sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pessimization, but simplification of the code: make sure all the
|
/* Pessimization, but simplification of the code: make sure all the
|
||||||
|
|||||||
Reference in New Issue
Block a user