X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/5092aba5a75e23dc8bca281a5ea240a7e155eff3..13ca549a750537731955700f92ea2b9288eb3020:/src/lalr.c diff --git a/src/lalr.c b/src/lalr.c index be178b8d..3851350b 100644 --- a/src/lalr.c +++ b/src/lalr.c @@ -171,13 +171,11 @@ set_goto_map (void) shifts *sp = state_table[state]->shifts; for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i) { - int symbol = state_table[sp->shifts[i]]->accessing_symbol; - if (ngotos == MAXSHORT) fatal (_("too many gotos (max %d)"), MAXSHORT); ngotos++; - goto_map[symbol]++; + goto_map[SHIFT_SYMBOL (sp, i)]++; } } @@ -204,12 +202,9 @@ set_goto_map (void) shifts *sp = state_table[state]->shifts; for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i) { - int state2 = sp->shifts[i]; - int symbol = state_table[state2]->accessing_symbol; - - int k = temp_map[symbol]++; + int k = temp_map[SHIFT_SYMBOL (sp, i)]++; from_state[k] = state; - to_state[k] = state2; + to_state[k] = sp->shifts[i]; } } @@ -269,14 +264,11 @@ initialize_F (void) int j; for (j = 0; j < sp->nshifts && SHIFT_IS_SHIFT (sp, j); j++) - { - int symbol = state_table[sp->shifts[j]]->accessing_symbol; - SETBIT (F (i), symbol); - } + SETBIT (F (i), SHIFT_SYMBOL (sp, j)); for (; j < sp->nshifts; j++) { - int symbol = state_table[sp->shifts[j]]->accessing_symbol; + int symbol = SHIFT_SYMBOL (sp, j); if (nullable[symbol]) edge[nedges++] = map_goto (stateno, symbol); }