/[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.85 by akim, Thu Jul 25 21:21:02 2002 UTC revision 1.86 by akim, Mon Jul 29 17:31:46 2002 UTC
# Line 86  initialize_LA (void) Line 86  initialize_LA (void)
86    for (i = 0; i < nstates; i++)    for (i = 0; i < nstates; i++)
87      if (!states[i]->consistent)      if (!states[i]->consistent)
88        for (j = 0; j < states[i]->reductions->num; j++)        for (j = 0; j < states[i]->reductions->num; j++)
89          *np++ = &rules[states[i]->reductions->rules[j]];          *np++ = states[i]->reductions->rules[j];
90  }  }
91    
92    
# Line 141  set_goto_map (void) Line 141  set_goto_map (void)
141          {          {
142            int k = temp_map[TRANSITION_SYMBOL (sp, i)]++;            int k = temp_map[TRANSITION_SYMBOL (sp, i)]++;
143            from_state[k] = state;            from_state[k] = state;
144            to_state[k] = sp->states[i];            to_state[k] = sp->states[i]->number;
145          }          }
146      }      }
147    
# Line 200  initialize_F (void) Line 200  initialize_F (void)
200        transitions_t *sp = states[stateno]->transitions;        transitions_t *sp = states[stateno]->transitions;
201    
202        int j;        int j;
203        for (j = 0; j < sp->num && TRANSITION_IS_SHIFT (sp, j); j++)        FOR_EACH_SHIFT (sp, j)
204          bitset_set (F[i], TRANSITION_SYMBOL (sp, j));          bitset_set (F[i], TRANSITION_SYMBOL (sp, j));
205    
206        for (; j < sp->num; j++)        for (; j < sp->num; j++)
# Line 375  states_lookaheads_count (void) Line 375  states_lookaheads_count (void)
375           reduction from a shift.  Otherwise, it is straightforward,           reduction from a shift.  Otherwise, it is straightforward,
376           and the state is `consistent'.  */           and the state is `consistent'.  */
377        if (rp->num > 1        if (rp->num > 1
378            || (rp->num == 1 && sp->num && TRANSITION_IS_SHIFT (sp, 0)))            || (rp->num == 1 && sp->num &&
379                  !TRANSITION_IS_DISABLED (sp, 0) && TRANSITION_IS_SHIFT (sp, 0)))
380          nlookaheads += rp->num;          nlookaheads += rp->num;
381        else        else
382          states[i]->consistent = 1;          states[i]->consistent = 1;
383    
384        for (k = 0; k < sp->num; k++)        for (k = 0; k < sp->num; k++)
385          if (TRANSITION_IS_ERROR (sp, k))          if (!TRANSITION_IS_DISABLED (sp, k) && TRANSITION_IS_ERROR (sp, k))
386            {            {
387              states[i]->consistent = 0;              states[i]->consistent = 0;
388              break;              break;

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

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