save_shifts (void)
{
shifts *p = shifts_new (nshifts);
-
- p->number = this_state->number;
shortcpy (p->shifts, shiftset, nshifts);
this_state->shifts = p;
}
shifts *sp;
statep = STATE_ALLOC (0);
- statep->number = nstates;
+ statep->number = nstates++;
/* The distinctive feature of this state from the
eof_shifting_state, is that it is labeled as post-start-symbol
/* Make a shift from this state to (what will be) the final state. */
sp = shifts_new (1);
statep->shifts = sp;
- sp->number = nstates++;
sp->shifts[0] = nstates;
}
next-to-final state.
The symbol for that shift is 0 (end-of-file). */
statep = STATE_ALLOC (0);
- statep->number = nstates;
+ statep->number = nstates++;
last_state->next = statep;
last_state = statep;
/* Make the shift from the final state to the termination state. */
sp = shifts_new (1);
statep->shifts = sp;
- sp->number = nstates++;
sp->shifts[0] = nstates;
}
shifts *sp = statep->shifts;
shifts *sp1 = shifts_new (sp->nshifts + 1);
- sp1->number = statep->number;
statep->shifts = sp1;
sp1->shifts[0] = nstates;
for (i = sp->nshifts; i > 0; i--)
if (!state_table[i]->shifts)
state_table[i]->shifts = shifts_new (0);
}
-
- /* Initializing the lookaheads members. Please note that it must be
- performed after having set some of the other members which are
- used below. Change with extreme caution. */
- {
- int i;
- int count = 0;
- for (i = 0; i < nstates; i++)
- {
- int k;
- reductions *rp = state_table[i]->reductions;
- shifts *sp = state_table[i]->shifts;
-
- state_table[i]->lookaheads = count;
-
- if (rp
- && (rp->nreds > 1 || (sp->nshifts && SHIFT_IS_SHIFT (sp, 0))))
- count += rp->nreds;
- else
- state_table[i]->consistent = 1;
-
- for (k = 0; k < sp->nshifts; k++)
- if (SHIFT_IS_ERROR (sp, k))
- {
- state_table[i]->consistent = 0;
- break;
- }
- }
-
- /* Seems to be needed by conflicts.c. */
- state_table[nstates] = STATE_ALLOC (0);
- state_table[nstates]->lookaheads = count;
- }
}
/*-------------------------------------------------------------------.