X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/06a2f464b12323e85887a102d38bb2cefd038931..e89a22bfab22e4d2ee73be49dcb66b51f8d0e892:/src/LR0.c diff --git a/src/LR0.c b/src/LR0.c index 6910f3e0..3fa5ba5b 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -141,7 +141,6 @@ static void new_itemsets (void) { int i; - int shiftcount; if (trace_flag) fprintf (stderr, "Entering new_itemsets, state = %d\n", @@ -151,25 +150,23 @@ new_itemsets (void) kernel_size[i] = 0; shift_symbol = XCALLOC (short, nsyms); - shiftcount = 0; + nshifts = 0; - for (i = 0; i < itemsetsize; ++i) + for (i = 0; i < nitemset; ++i) { int symbol = ritem[itemset[i]]; if (symbol > 0) { if (!kernel_size[symbol]) { - shift_symbol[shiftcount] = symbol; - shiftcount++; + shift_symbol[nshifts] = symbol; + nshifts++; } kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1; kernel_size[symbol]++; } } - - nshifts = shiftcount; } @@ -542,7 +539,7 @@ save_reductions (void) /* Find and count the active items that represent ends of rules. */ count = 0; - for (i = 0; i < itemsetsize; ++i) + for (i = 0; i < nitemset; ++i) { int item = ritem[itemset[i]]; if (item < 0) @@ -583,6 +580,9 @@ generate_states (void) while (this_state) { + if (trace_flag) + fprintf (stderr, "Processing state %d (reached by %s)\n", + this_state->number, tags[this_state->accessing_symbol]); /* 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