/[bison]/bison/src/LR0.c
ViewVC logotype

Diff of /bison/src/LR0.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.38 by akim, Mon Dec 10 09:08:46 2001 UTC revision 1.39 by akim, Mon Dec 10 09:09:00 2001 UTC
# Line 437  insert_accepting_state (void) Line 437  insert_accepting_state (void)
437  static void  static void
438  augment_automaton (void)  augment_automaton (void)
439  {  {
440    if (!first_shift->nshifts)    if (!first_state->shifts->nshifts)
441      {      {
442        /* There are no shifts for any state.  Make one shift, from the        /* The first state has no shifts.  Make one shift, from the
443           initial state to the next-to-final state.  */           initial state to the next-to-final state.  */
444    
445        shifts *sp = shifts_new (1);        shifts *sp = shifts_new (1);
# Line 454  augment_automaton (void) Line 454  augment_automaton (void)
454           what will be the final state.  */           what will be the final state.  */
455        insert_start_shifting_state ();        insert_start_shifting_state ();
456      }      }
457    else if (first_shift->number == 0)    else
458      {      {
459        state_t *statep = first_state->next;        state_t *statep = first_state->next;
460        shifts *sp = first_shift;        shifts *sp = first_shift;
# Line 544  augment_automaton (void) Line 544  augment_automaton (void)
544            insert_start_shifting_state ();            insert_start_shifting_state ();
545          }          }
546      }      }
   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 ();  
     }  
547    
548    insert_eof_shifting_state ();    insert_eof_shifting_state ();
549    insert_accepting_state ();    insert_accepting_state ();

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26