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

Diff of /bison/src/conflicts.c

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

revision 1.22.2.25 by akim, Wed Dec 5 09:20:22 2001 UTC revision 1.22.2.26 by akim, Wed Dec 5 09:20:41 2001 UTC
# Line 184  set_conflicts (int state) Line 184  set_conflicts (int state)
184  {  {
185    int i, j;    int i, j;
186    shifts *shiftp;    shifts *shiftp;
   int symbol;  
187    
188    if (state_table[state].consistent)    if (state_table[state].consistent)
189      return;      return;
# Line 194  set_conflicts (int state) Line 193  set_conflicts (int state)
193    
194    shiftp = state_table[state].shift_table;    shiftp = state_table[state].shift_table;
195    if (shiftp)    if (shiftp)
196      for (i = 0; i < shiftp->nshifts; i++)      for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
197        {        SETBIT (lookaheadset, SHIFT_SYMBOL (shiftp, i));
         symbol = state_table[shiftp->shifts[i]].accessing_symbol;  
         if (ISVAR (symbol))  
           break;  
         SETBIT (lookaheadset, symbol);  
       }  
198    
199    /* Loop over all rules which require lookahead in this state.  First    /* Loop over all rules which require lookahead in this state.  First
200       check for shift-reduce conflict, and try to resolve using       check for shift-reduce conflict, and try to resolve using
# Line 269  count_sr_conflicts (int state) Line 263  count_sr_conflicts (int state)
263      }      }
264    
265    for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)    for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
266      {      SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
       int symbol = state_table[shiftp->shifts[i]].accessing_symbol;  
       SETBIT (shiftset, symbol);  
     }  
267    
268    for (i = state_table[state].lookaheads;    for (i = state_table[state].lookaheads;
269         i < state_table[state + 1].lookaheads;         i < state_table[state + 1].lookaheads;
# Line 451  print_reductions (FILE *out, int state) Line 442  print_reductions (FILE *out, int state)
442  {  {
443    int i;    int i;
444    int j;    int j;
   int symbol;  
445    int m;    int m;
446    int n;    int n;
447    shifts *shiftp;    shifts *shiftp;
# Line 463  print_reductions (FILE *out, int state) Line 453  print_reductions (FILE *out, int state)
453    
454    shiftp = state_table[state].shift_table;    shiftp = state_table[state].shift_table;
455    if (shiftp)    if (shiftp)
456      for (i = 0; i < shiftp->nshifts; i++)      for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
457        {        {
458          if (!shiftp->shifts[i])          /* if this state has a shift for the error token, don't use a
459            continue;             default rule.  */
460          symbol = state_table[shiftp->shifts[i]].accessing_symbol;          if (SHIFT_IS_ERROR (shiftp, i))
         if (ISVAR (symbol))  
           break;  
         /* if this state has a shift for the error token,  
            don't use a default rule.  */  
         if (symbol == error_token_number)  
461            nodefault = 1;            nodefault = 1;
462          SETBIT (shiftset, symbol);          SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
463        }        }
464    
465    errp = err_table[state];    errp = err_table[state];
# Line 538  print_reductions (FILE *out, int state) Line 523  print_reductions (FILE *out, int state)
523          shiftset[i] = 0;          shiftset[i] = 0;
524    
525        if (shiftp)        if (shiftp)
526          for (i = 0; i < shiftp->nshifts; i++)          for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
527            {            SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
             if (!shiftp->shifts[i])  
               continue;  
             symbol = state_table[shiftp->shifts[i]].accessing_symbol;  
             if (ISVAR (symbol))  
               break;  
             SETBIT (shiftset, symbol);  
           }  
528    
529        for (i = 0; i < ntokens; i++)        for (i = 0; i < ntokens; i++)
530          {          {

Legend:
Removed from v.1.22.2.25  
changed lines
  Added in v.1.22.2.26

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