]> git.saurik.com Git - bison.git/blobdiff - src/LR0.c
* tests/regression.at, tests/torture.at, tests/calc.at: Adjust to
[bison.git] / src / LR0.c
index 6910f3e0862770892053240678dcd4763846f0d8..3fa5ba5bda947b1bf76a52e0ece86e5d1126f681 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -141,7 +141,6 @@ static void
 new_itemsets (void)
 {
   int i;
 new_itemsets (void)
 {
   int i;
-  int shiftcount;
 
   if (trace_flag)
     fprintf (stderr, "Entering new_itemsets, state = %d\n",
 
   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);
     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])
            {
     {
       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]++;
        }
     }
            }
 
          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;
   /* 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)
     {
       int item = ritem[itemset[i]];
       if (item < 0)
@@ -583,6 +580,9 @@ generate_states (void)
 
   while (this_state)
     {
 
   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
       /* 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