X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/190c4f5f0a0dac47157adea6250cb88bf0ac39ff..2e729273d633f1ddaf1b6affdca53f3e63f3715c:/src/LR0.c?ds=sidebyside diff --git a/src/LR0.c b/src/LR0.c index 4ea292a9..5e8caef0 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -316,8 +316,6 @@ static void save_shifts (void) { shifts *p = shifts_new (nshifts); - - p->number = this_state->number; shortcpy (p->shifts, shiftset, nshifts); this_state->shifts = p; } @@ -339,7 +337,7 @@ insert_start_shifting_state (void) 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 @@ -354,7 +352,6 @@ insert_start_shifting_state (void) /* 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; } @@ -375,7 +372,7 @@ insert_eof_shifting_state (void) 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; @@ -383,7 +380,6 @@ insert_eof_shifting_state (void) /* 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; } @@ -459,7 +455,6 @@ augment_automaton (void) 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--) @@ -565,39 +560,6 @@ set_state_table (void) 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; - } } /*-------------------------------------------------------------------.