mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 22:03:02 +00:00
* src/closure.c (print_firsts, print_fderives, closure):
Use BITSET_EXECUTE. * src/lalr.c (lookaheads_print): Likewise. * src/state.c (state_rule_lookaheads_print): Likewise. * src/print_graph.c (print_core): Likewise. * src/print.c (print_reductions): Likewise. * src/output.c (action_row): Likewise. Use SHIFT_IS_DISABLED, SHIFT_IS_SHIFT and SHIFT_SYMBOL.
This commit is contained in:
45
src/output.c
45
src/output.c
@@ -447,41 +447,34 @@ action_row (state_t *state)
|
||||
for (i = state->nlookaheads - 1; i >= 0; --i)
|
||||
/* and find each token which the rule finds acceptable
|
||||
to come next */
|
||||
for (j = 0; j < ntokens; j++)
|
||||
BITSET_EXECUTE (state->lookaheads[i], 0, j,
|
||||
{
|
||||
/* and record this rule as the rule to use if that
|
||||
token follows. */
|
||||
if (bitset_test (state->lookaheads[i], j))
|
||||
{
|
||||
if (actrow[j] != 0)
|
||||
conflicted = conflrow[j] = 1;
|
||||
actrow[j] = -state->lookaheads_rule[i]->number;
|
||||
}
|
||||
if (actrow[j] != 0)
|
||||
conflicted = conflrow[j] = 1;
|
||||
actrow[j] = -state->lookaheads_rule[i]->number;
|
||||
});
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
for (i = 0; i < shiftp->nshifts; i++)
|
||||
{
|
||||
symbol_number_t symbol;
|
||||
state_number_t shift_state = shiftp->shifts[i];
|
||||
if (!shift_state)
|
||||
continue;
|
||||
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
symbol_number_t symbol = SHIFT_SYMBOL (shiftp, i);
|
||||
state_number_t shift_state = shiftp->shifts[i];
|
||||
|
||||
symbol = states[shift_state]->accessing_symbol;
|
||||
if (actrow[symbol] != 0)
|
||||
conflicted = conflrow[symbol] = 1;
|
||||
actrow[symbol] = state_number_as_int (shift_state);
|
||||
|
||||
if (ISVAR (symbol))
|
||||
break;
|
||||
|
||||
if (actrow[symbol] != 0)
|
||||
conflicted = conflrow[symbol] = 1;
|
||||
actrow[symbol] = state_number_as_int (shift_state);
|
||||
|
||||
/* Do not use any default reduction if there is a shift for
|
||||
error */
|
||||
if (symbol == errtoken->number)
|
||||
nodefault = 1;
|
||||
}
|
||||
/* Do not use any default reduction if there is a shift for
|
||||
error */
|
||||
if (symbol == errtoken->number)
|
||||
nodefault = 1;
|
||||
}
|
||||
|
||||
/* See which tokens are an explicit error in this state (due to
|
||||
%nonassoc). For them, record SHRT_MIN as the action. */
|
||||
|
||||
Reference in New Issue
Block a user