Pessimize the code to simplify it: from now on, all the states

have a valid SHIFTS, which NSHIFTS is possibly 0.
* src/LR0.c (shifts_new): Be global and move to..
* src/state.c, src/state.h: here.
* src/conflicts, src/lalr.c, src/output.c, src/print.c,
* src/print_graph: Adjust.
This commit is contained in:
Akim Demaille
2001-12-05 09:34:55 +00:00
parent 9839bbe557
commit d954473dee
9 changed files with 155 additions and 199 deletions

View File

@@ -399,40 +399,33 @@ action_row (int state)
}
}
shiftp = state_table[state].shift_table;
/* Now see which tokens are allowed for shifts in this state. For
them, record the shift as the thing to do. So shift is preferred
to reduce. */
shiftp = state_table[state].shift_table;
if (shiftp)
for (i = 0; i < shiftp->nshifts; i++)
{
k = shiftp->nshifts;
shift_state = shiftp->shifts[i];
if (!shift_state)
continue;
for (i = 0; i < k; i++)
{
shift_state = shiftp->shifts[i];
if (!shift_state)
continue;
symbol = state_table[shift_state].accessing_symbol;
symbol = state_table[shift_state].accessing_symbol;
if (ISVAR (symbol))
break;
if (ISVAR (symbol))
break;
actrow[symbol] = shift_state;
actrow[symbol] = shift_state;
/* Do not use any default reduction if there is a shift for
error */
if (symbol == error_token_number)
nodefault = 1;
}
/* Do not use any default reduction if there is a shift for
error */
if (symbol == error_token_number)
nodefault = 1;
}
errp = err_table[state];
/* See which tokens are an explicit error in this state (due to
%nonassoc). For them, record MINSHORT as the action. */
errp = err_table[state];
if (errp)
{