mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
* src/LR0.c (augment_automaton): Now that all states have shifts,
merge the two cases addition shifts to the initial state.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2001-12-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/LR0.c (augment_automaton): Now that all states have shifts,
|
||||||
|
merge the two cases addition shifts to the initial state.
|
||||||
|
|
||||||
|
|
||||||
2001-12-10 Akim Demaille <akim@epita.fr>
|
2001-12-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/lalr.c (set_state_table): Move to...
|
* src/lalr.c (set_state_table): Move to...
|
||||||
|
|||||||
22
src/LR0.c
22
src/LR0.c
@@ -437,9 +437,9 @@ insert_accepting_state (void)
|
|||||||
static void
|
static void
|
||||||
augment_automaton (void)
|
augment_automaton (void)
|
||||||
{
|
{
|
||||||
if (!first_shift->nshifts)
|
if (!first_state->shifts->nshifts)
|
||||||
{
|
{
|
||||||
/* There are no shifts for any state. Make one shift, from the
|
/* The first state has no shifts. Make one shift, from the
|
||||||
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);
|
||||||
@@ -454,7 +454,7 @@ augment_automaton (void)
|
|||||||
what will be the final state. */
|
what will be the final state. */
|
||||||
insert_start_shifting_state ();
|
insert_start_shifting_state ();
|
||||||
}
|
}
|
||||||
else if (first_shift->number == 0)
|
else
|
||||||
{
|
{
|
||||||
state_t *statep = first_state->next;
|
state_t *statep = first_state->next;
|
||||||
shifts *sp = first_shift;
|
shifts *sp = first_shift;
|
||||||
@@ -544,22 +544,6 @@ augment_automaton (void)
|
|||||||
insert_start_shifting_state ();
|
insert_start_shifting_state ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The initial state didn't even have any shifts.
|
|
||||||
Give it one shift, to the next-to-final state. */
|
|
||||||
shifts *sp = shifts_new (1);
|
|
||||||
first_state->shifts = sp;
|
|
||||||
sp->shifts[0] = nstates;
|
|
||||||
|
|
||||||
/* Patch sp into the chain of shifts at the beginning. */
|
|
||||||
sp->next = first_shift;
|
|
||||||
first_shift = sp;
|
|
||||||
|
|
||||||
/* Create the next-to-final state, with shift to
|
|
||||||
what will be the final state. */
|
|
||||||
insert_start_shifting_state ();
|
|
||||||
}
|
|
||||||
|
|
||||||
insert_eof_shifting_state ();
|
insert_eof_shifting_state ();
|
||||||
insert_accepting_state ();
|
insert_accepting_state ();
|
||||||
|
|||||||
Reference in New Issue
Block a user