/[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.42 by akim, Mon Dec 10 09:10:28 2001 UTC revision 1.43 by akim, Mon Dec 17 17:32:58 2001 UTC
# Line 140  initialize_LA (void) Line 140  initialize_LA (void)
140    short *np;    short *np;
141    reductions *rp;    reductions *rp;
142    
143    size_t nLA = state_table[nstates]->lookaheads;    size_t nLA = state_table[nstates]->lookaheadsp;
144    if (!nLA)    if (!nLA)
145      nLA = 1;      nLA = 1;
146    
# Line 314  add_lookback_edge (int stateno, int rule Line 314  add_lookback_edge (int stateno, int rule
314    int found;    int found;
315    shorts *sp;    shorts *sp;
316    
317    i = state_table[stateno]->lookaheads;    i = state_table[stateno]->lookaheadsp;
318    k = state_table[stateno + 1]->lookaheads;    k = state_table[stateno + 1]->lookaheadsp;
319    found = 0;    found = 0;
320    while (!found && i < k)    while (!found && i < k)
321      {      {
# Line 516  compute_lookaheads (void) Line 516  compute_lookaheads (void)
516    int i;    int i;
517    shorts *sp;    shorts *sp;
518    
519    for (i = 0; i < state_table[nstates]->lookaheads; i++)    for (i = 0; i < state_table[nstates]->lookaheadsp; i++)
520      for (sp = lookback[i]; sp; sp = sp->next)      for (sp = lookback[i]; sp; sp = sp->next)
521        {        {
522          int size = LA (i + 1) - LA (i);          int size = LA (i + 1) - LA (i);
# Line 526  compute_lookaheads (void) Line 526  compute_lookaheads (void)
526        }        }
527    
528    /* Free LOOKBACK. */    /* Free LOOKBACK. */
529    for (i = 0; i < state_table[nstates]->lookaheads; i++)    for (i = 0; i < state_table[nstates]->lookaheadsp; i++)
530      LIST_FREE (shorts, lookback[i]);      LIST_FREE (shorts, lookback[i]);
531    
532    XFREE (lookback);    XFREE (lookback);
# Line 546  initialize_lookaheads (void) Line 546  initialize_lookaheads (void)
546    for (i = 0; i < nstates; i++)    for (i = 0; i < nstates; i++)
547      {      {
548        int k;        int k;
549          int nlookaheads = 0;
550        reductions *rp = state_table[i]->reductions;        reductions *rp = state_table[i]->reductions;
551        shifts *sp = state_table[i]->shifts;        shifts *sp = state_table[i]->shifts;
552    
       state_table[i]->lookaheads = count;  
   
553        if (rp        if (rp
554            && (rp->nreds > 1 || (sp->nshifts && SHIFT_IS_SHIFT (sp, 0))))            && (rp->nreds > 1 || (sp->nshifts && SHIFT_IS_SHIFT (sp, 0))))
555          count += rp->nreds;          nlookaheads += rp->nreds;
556        else        else
557          state_table[i]->consistent = 1;          state_table[i]->consistent = 1;
558    
# Line 563  initialize_lookaheads (void) Line 562  initialize_lookaheads (void)
562              state_table[i]->consistent = 0;              state_table[i]->consistent = 0;
563              break;              break;
564            }            }
565    
566          state_table[i]->nlookaheads = nlookaheads;
567          state_table[i]->lookaheadsp = count;
568          count += nlookaheads;
569      }      }
570    
571    /* Seems to be needed by conflicts.c. */    /* Seems to be needed by conflicts.c. */
572    state_table[nstates] = STATE_ALLOC (0);    state_table[nstates] = STATE_ALLOC (0);
573    state_table[nstates]->lookaheads = count;    state_table[nstates]->lookaheadsp = count;
574  }  }
575    
576  void  void

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

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