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

Diff of /bison/src/lalr.c

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

revision 1.49 by akim, Thu Dec 27 18:10:30 2001 UTC revision 1.50 by akim, Thu Dec 27 18:11:06 2001 UTC
# Line 137  initialize_LA (void) Line 137  initialize_LA (void)
137    int i;    int i;
138    int j;    int j;
139    short *np;    short *np;
   reductions *rp;  
140    
141    /* Avoid having to special case 0.  */    /* Avoid having to special case 0.  */
142    if (!nLA)    if (!nLA)
# Line 150  initialize_LA (void) Line 149  initialize_LA (void)
149    np = LAruleno;    np = LAruleno;
150    for (i = 0; i < nstates; i++)    for (i = 0; i < nstates; i++)
151      if (!state_table[i]->consistent)      if (!state_table[i]->consistent)
152        if ((rp = state_table[i]->reductions))        for (j = 0; j < state_table[i]->reductions->nreds; j++)
153          for (j = 0; j < rp->nreds; j++)          *np++ = state_table[i]->reductions->rules[j];
           *np++ = rp->rules[j];  
154  }  }
155    
156    
# Line 525  initialize_lookaheads (void) Line 523  initialize_lookaheads (void)
523        reductions *rp = state_table[i]->reductions;        reductions *rp = state_table[i]->reductions;
524        shifts *sp = state_table[i]->shifts;        shifts *sp = state_table[i]->shifts;
525    
526        if (rp        /* We need a lookahead either to distinguish different
527            && (rp->nreds > 1 || (sp->nshifts && SHIFT_IS_SHIFT (sp, 0))))           reductions (i.e., there are two or more), or to distinguish a
528             reduction from a shift.  Otherwise, it is straightforward,
529             and the state is `consistent'.  */
530          if (rp->nreds > 1
531              || (rp->nreds == 1 && sp->nshifts && SHIFT_IS_SHIFT (sp, 0)))
532          nlookaheads += rp->nreds;          nlookaheads += rp->nreds;
533        else        else
534          state_table[i]->consistent = 1;          state_table[i]->consistent = 1;

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

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