/[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.19 by akim, Mon Nov 19 10:07:44 2001 UTC revision 1.20 by akim, Mon Nov 19 10:08:02 2001 UTC
# Line 42  short *lookaheads; Line 42  short *lookaheads;
42  short *LAruleno;  short *LAruleno;
43  unsigned *LA;  unsigned *LA;
44    
 char *consistent;  
45  short *goto_map;  short *goto_map;
46  short *from_state;  short *from_state;
47  short *to_state;  short *to_state;
# Line 208  initialize_LA (void) Line 207  initialize_LA (void)
207    shifts *sp;    shifts *sp;
208    short *np;    short *np;
209    
   consistent = XCALLOC (char, nstates);  
210    lookaheads = XCALLOC (short, nstates + 1);    lookaheads = XCALLOC (short, nstates + 1);
211    
212    count = 0;    count = 0;
# Line 225  initialize_LA (void) Line 223  initialize_LA (void)
223                || (sp && !ISVAR (state_table[sp->shifts[0]].accessing_symbol))))                || (sp && !ISVAR (state_table[sp->shifts[0]].accessing_symbol))))
224          count += rp->nreds;          count += rp->nreds;
225        else        else
226          consistent[i] = 1;          state_table[i].consistent = 1;
227    
228        if (sp)        if (sp)
229          for (k = 0; k < sp->nshifts; k++)          for (k = 0; k < sp->nshifts; k++)
230            if (state_table[sp->shifts[k]].accessing_symbol            if (state_table[sp->shifts[k]].accessing_symbol
231                == error_token_number)                == error_token_number)
232              {              {
233                consistent[i] = 0;                state_table[i].consistent = 0;
234                break;                break;
235              }              }
236      }      }
# Line 255  initialize_LA (void) Line 253  initialize_LA (void)
253    np = LAruleno;    np = LAruleno;
254    for (i = 0; i < nstates; i++)    for (i = 0; i < nstates; i++)
255      {      {
256        if (!consistent[i])        if (!state_table[i].consistent)
257          {          {
258            if ((rp = state_table[i].reduction_table))            if ((rp = state_table[i].reduction_table))
259              for (j = 0; j < rp->nreds; j++)              for (j = 0; j < rp->nreds; j++)
# Line 580  build_relations (void) Line 578  build_relations (void)
578                states[length++] = stateno;                states[length++] = stateno;
579              }              }
580    
581            if (!consistent[stateno])            if (!state_table[stateno].consistent)
582              add_lookback_edge (stateno, *rulep, i);              add_lookback_edge (stateno, *rulep, i);
583    
584            length--;            length--;

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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