- output_token_number_table (&format_obstack, values,
- 0, 1, nstates);
- muscle_insert ("stos", obstack_finish (&format_obstack));
-}
-
-
-/*------------------------------------------------------------------.
-| Decide what to do for each type of token if seen as the lookahead |
-| token in specified state. The value returned is used as the |
-| default action (yydefact) for the state. In addition, actrow is |
-| filled with what to do for each kind of token, index by symbol |
-| number, with zero meaning do the default action. The value |
-| SHRT_MIN, a very negative number, means this situation is an |
-| error. The parser recognizes this value specially. |
-| |
-| This is where conflicts are resolved. The loop over lookahead |
-| rules considered lower-numbered rules last, and the last rule |
-| considered that likes a token gets to handle it. |
-`------------------------------------------------------------------*/
-
-static int
-action_row (state_t *state)
-{
- int i;
- int default_rule = 0;
- reductions *redp = state->reductions;
- shifts *shiftp = state->shifts;
- errs *errp = state->errs;
- /* set nonzero to inhibit having any default reduction */
- int nodefault = 0;
-
- for (i = 0; i < ntokens; i++)
- actrow[i] = 0;
-
- if (redp->nreds >= 1)
- {
- int j;
- /* loop over all the rules available here which require
- lookahead */
- 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++)
- /* and record this rule as the rule to use if that
- token follows. */
- if (bitset_test (LA[state->lookaheadsp + i], j))
- actrow[j] = -LArule[state->lookaheadsp + 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++)
- {
- token_number_t symbol;
- int shift_state = shiftp->shifts[i];
- if (!shift_state)
- continue;
-
- symbol = states[shift_state]->accessing_symbol;
-
- if (ISVAR (symbol))
- break;
-
- actrow[symbol] = shift_state;
-
- /* 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. */
- for (i = 0; i < errp->nerrs; i++)
- {
- int symbol = errp->errs[i];
- actrow[symbol] = SHRT_MIN;
- }
-
- /* Now find the most common reduction and make it the default action
- for this state. */