]> git.saurik.com Git - bison.git/commitdiff
* src/LR0.c (augment_automaton): Call `insert_eof_shifting_state'
authorAkim Demaille <akim@epita.fr>
Mon, 10 Dec 2001 09:09:14 +0000 (09:09 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 10 Dec 2001 09:09:14 +0000 (09:09 +0000)
only when appropriate: when insert_start_shifting_state' is not
invoked.
* tests/regression.at (Rule Line Numbers): Adjust.

ChangeLog
src/LR0.c
tests/regression.at

index a29c27e309a7db9e3e0758797fe6eb828cc35974..bcb0024a5b6ca62f9d418670695d6a51df7769c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-12-10  Akim Demaille  <akim@epita.fr>
+
+       * 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.
+
+       
 2001-12-10  Akim Demaille  <akim@epita.fr>
 
        * src/LR0.c (augment_automaton): Now that all states have shifts,
index 9de75782b6c53c55f68752253deca379f5b685d4..d21a946f89ccbefa0f58ae6a0af56319534dd972 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -457,18 +457,22 @@ augment_automaton (void)
   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 @@ augment_automaton (void)
              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 @@ augment_automaton (void)
 
          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 70e3420bf08ea4b2e40c93b9afa3511e161c8e4d..d8788f8824def7d63e014a32f8b92cbde438b27f 100644 (file)
@@ -382,12 +382,6 @@ state 6
 
 state 7
 
-    $          go to state 8
-
-
-
-state 8
-
     $default   accept