- register int i;
- register int j;
- register int k;
-
- actrow = NEW2(ntokens, short);
-
- k = action_row(0);
- fprintf(ftable, "\nstatic const short yydefact[] = {%6d", k);
- save_row(0);
-
- j = 10;
- for (i = 1; i < nstates; i++)
- {
- putc(',', ftable);
-
- if (j >= 10)
- {
- putc('\n', ftable);
- j = 1;
- }
- else
- {
- j++;
- }
-
- k = action_row(i);
- fprintf(ftable, "%6d", k);
- save_row(i);
- }
-
- fprintf(ftable, "\n};\n");
- FREE(actrow);
-}
-
-
-
-/* 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 MINSHORT, 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. */
-
-int
-action_row(state)
-int state;
-{
- register int i;
- register int j;
- register int k;
- register int m;
- register int n;
- register int count;
- register int default_rule;
- register int nreds;
- register int max;
- register int rule;
- register int shift_state;
- register int symbol;
- register unsigned mask;
- register unsigned *wordp;
- register reductions *redp;
- register shifts *shiftp;
- register errs *errp;
- int nodefault = 0; /* set nonzero to inhibit having any default reduction */