]> git.saurik.com Git - bison.git/blobdiff - src/LR0.c
Stop storing rules from 1 to nrules + 1.
[bison.git] / src / LR0.c
index a7a62e5921478a59858eeef62047f9abad25c77b..80f69a9eda9af33cacdba037daf4415d4e1b65fb 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -105,7 +105,7 @@ allocate_itemsets (void)
   int count = 0;
   short *symbol_count = XCALLOC (short, nsyms + nuseless_nonterminals);
 
-  for (r = 1; r < nrules + 1; ++r)
+  for (r = 0; r < nrules; ++r)
     for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
       {
        count++;
@@ -140,7 +140,7 @@ allocate_storage (void)
   allocate_itemsets ();
 
   shiftset = XCALLOC (state_number_t, nsyms);
-  redset = XCALLOC (short, nrules + 1);
+  redset = XCALLOC (short, nrules);
   state_hash_new ();
   shift_symbol = XCALLOC (symbol_number_t, nsyms);
 }
@@ -233,7 +233,7 @@ get_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
 | Use the information computed by new_itemsets to find the state    |
 | numbers reached by each shift transition from STATE.              |
 |                                                                   |
-| TRANSITIONSET is set up as a vector of state numbers of those states.  |
+| SHIFTSET is set up as a vector of state numbers of those states.  |
 `------------------------------------------------------------------*/
 
 static void
@@ -292,7 +292,7 @@ save_reductions (state_t *state)
     {
       int item = ritem[itemset[i]];
       if (item < 0)
-       redset[count++] = -item;
+       redset[count++] = item_number_as_rule_number (item);
     }
 
   /* Make a reductions structure and copy the data into it.  */