[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
16-fyi-duplicate-eof-state.patch
From: |
Akim Demaille |
Subject: |
16-fyi-duplicate-eof-state.patch |
Date: |
Mon, 10 Dec 2001 09:36:34 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/LR0.c (augment_automaton): Call `insert_eof_shifting_state'
only when appropriate: when insert_start_shifting_state' is not
invoked.
* tests/regression.at (Rule Line Numbers): Adjust.
Index: src/LR0.c
--- src/LR0.c Sat, 08 Dec 2001 20:55:46 +0100 akim
+++ src/LR0.c Sat, 08 Dec 2001 21:37:58 +0100 akim
@@ -457,18 +457,22 @@
else
{
state_t *statep = first_state->next;
- shifts *sp = first_shift;
+ shifts *sp = first_state->shifts;
shifts *sp1 = NULL;
/* The states reached by shifts from FIRST_STATE are numbered
- 1..(SP->NSHIFTS). Look for one reached by START_SYMBOL. */
+ 1..(SP->NSHIFTS). Look for one reached by START_SYMBOL.
+ This is typical of `start: start ... ;': there is a state
+ with the item `start: start . ...'. We want to add a `shift
+ on EOF to eof-shifting state here. */
while (statep->accessing_symbol != start_symbol
&& statep->number < sp->nshifts)
statep = statep->next;
if (statep->accessing_symbol == start_symbol)
{
- /* We already have a next-to-final state.
- Make sure it has a shift to what will be the final state. */
+ /* We already have a next-to-final state, i.e., for `start:
+ start . ...'. Make sure it has a shift to what will be
+ the final state. */
while (sp && sp->number < statep->number)
{
sp1 = sp;
@@ -506,9 +510,11 @@
if (sp == 0)
last_shift = sp2;
}
+ insert_eof_shifting_state ();
}
else
{
+ /* There is no state for `start: start . ...'. */
int i, k;
shifts *sp2;
sp = first_shift;
@@ -539,13 +545,12 @@
XFREE (sp);
- /* Create the next-to-final state, with shift to
- what will be the final state. */
+ /* Create the next-to-final state, with shift to what will
+ be the final state. Corresponds to `start: start . ...'. */
insert_start_shifting_state ();
}
}
- insert_eof_shifting_state ();
insert_accepting_state ();
}
Index: tests/regression.at
--- tests/regression.at Sat, 08 Dec 2001 13:25:21 +0100 akim
+++ tests/regression.at Sat, 08 Dec 2001 21:24:41 +0100 akim
@@ -382,12 +382,6 @@ expr:
state 7
- $ go to state 8
-
-
-
-state 8
-
$default accept
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 16-fyi-duplicate-eof-state.patch,
Akim Demaille <=