X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/0e78e603f696b4b820231b56fdb21c2a173e6bd3..e9f87b5b7df2e328d2e4196d276c0d96594c906b:/src/LR0.c?ds=sidebyside diff --git a/src/LR0.c b/src/LR0.c index 47ce6dd2..e914c6ef 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -113,6 +113,7 @@ allocate_storage (void) shiftset = XCALLOC (short, nsyms); redset = XCALLOC (short, nrules + 1); state_hash = XCALLOC (state_t *, STATE_HASH_SIZE); + shift_symbol = XCALLOC (short, nsyms); } @@ -154,7 +155,6 @@ new_itemsets (void) for (i = 0; i < nsyms; i++) kernel_size[i] = 0; - shift_symbol = XCALLOC (short, nsyms); nshifts = 0; for (i = 0; i < nitemset; ++i) @@ -188,7 +188,7 @@ new_state (int symbol) if (trace_flag) fprintf (stderr, "Entering new_state, state = %d, symbol = %d (%s)\n", - this_state->number, symbol, tags[symbol]); + this_state->number, symbol, symbols[symbol]->tag); if (nstates >= MAXSHORT) fatal (_("too many states (max %d)"), MAXSHORT); @@ -227,7 +227,7 @@ get_state (int symbol) if (trace_flag) fprintf (stderr, "Entering get_state, state = %d, symbol = %d (%s)\n", - this_state->number, symbol, tags[symbol]); + this_state->number, symbol, symbols[symbol]->tag); /* Add up the target state's active item numbers to get a hash key. */ @@ -365,14 +365,14 @@ save_reductions (void) /*--------------------. -| Build STATE_TABLE. | +| Build STATES. | `--------------------*/ static void -set_state_table (void) +set_states (void) { state_t *sp; - state_table = XCALLOC (state_t *, nstates); + states = XCALLOC (state_t *, nstates); for (sp = first_state; sp; sp = sp->next) { @@ -386,7 +386,7 @@ set_state_table (void) if (!sp->reductions) sp->reductions = reductions_new (0); - state_table[sp->number] = sp; + states[sp->number] = sp; } } @@ -406,7 +406,8 @@ generate_states (void) { if (trace_flag) fprintf (stderr, "Processing state %d (reached by %s)\n", - this_state->number, tags[this_state->accessing_symbol]); + this_state->number, + symbols[this_state->accessing_symbol]->tag); /* Set up ruleset and itemset for the transitions out of this state. ruleset gets a 1 bit for each rule that could reduce now. itemset gets a vector of all the items that could be @@ -431,6 +432,6 @@ generate_states (void) free_closure (); free_storage (); - /* Set up STATE_TABLE. */ - set_state_table (); + /* Set up STATES. */ + set_states (); }