]> git.saurik.com Git - bison.git/blobdiff - src/output.c
* src/lalr.h (LA): New macro to access to the variable LA.
[bison.git] / src / output.c
index a971af70a9e15d6f1870adac5e2550d4bc66d15e..8ae1cff91d7f95f7f5f9c959dc958b3d7afa2b72 100644 (file)
@@ -200,7 +200,11 @@ output_gram (void)
 static void
 output_stos (void)
 {
-  output_table_data (&output_obstack, accessing_symbol,
+  int i;
+  short *values = (short *) alloca (sizeof (short) * nstates);
+  for (i = 0; i < nstates; ++i)
+    values[i] = state_table[i].accessing_symbol;
+  output_table_data (&output_obstack, values,
                     0, 1, nstates);
   muscle_insert ("stos", obstack_finish (&output_obstack));
 }
@@ -334,7 +338,7 @@ action_row (int state)
 
   default_rule = 0;
   nreds = 0;
-  redp = reduction_table[state];
+  redp = state_table[state].reduction_table;
 
   if (redp)
     {
@@ -344,13 +348,13 @@ action_row (int state)
        {
          /* loop over all the rules available here which require
             lookahead */
-         m = lookaheads[state];
-         n = lookaheads[state + 1];
+         m = state_table[state].lookaheads;
+         n = state_table[state + 1].lookaheads;
 
          for (i = n - 1; i >= m; i--)
            {
              rule = -LAruleno[i];
-             wordp = LA + i * tokensetsize;
+             wordp = LA (i);
              mask = 1;
 
              /* and find each token which the rule finds acceptable
@@ -373,7 +377,7 @@ action_row (int state)
        }
     }
 
-  shiftp = shift_table[state];
+  shiftp = state_table[state].shift_table;
 
   /* Now see which tokens are allowed for shifts in this state.  For
      them, record the shift as the thing to do.  So shift is preferred
@@ -389,7 +393,7 @@ action_row (int state)
          if (!shift_state)
            continue;
 
-         symbol = accessing_symbol[shift_state];
+         symbol = state_table[shift_state].accessing_symbol;
 
          if (ISVAR (symbol))
            break;
@@ -424,7 +428,7 @@ action_row (int state)
 
   if (nreds >= 1 && !nodefault)
     {
-      if (consistent[state])
+      if (state_table[state].consistent)
        default_rule = redp->rules[0];
       else
        {
@@ -548,8 +552,6 @@ free_shifts (void)
 {
   shifts *sp, *sptmp;  /* JF derefrenced freed ptr */
 
-  XFREE (shift_table);
-
   for (sp = first_shift; sp; sp = sptmp)
     {
       sptmp = sp->next;
@@ -563,8 +565,6 @@ free_reductions (void)
 {
   reductions *rp, *rptmp;      /* JF fixed freed ptr */
 
-  XFREE (reduction_table);
-
   for (rp = first_reduction; rp; rp = rptmp)
     {
       rptmp = rp->next;
@@ -928,10 +928,8 @@ output_actions (void)
   token_actions ();
   free_shifts ();
   free_reductions ();
-  XFREE (lookaheads);
   XFREE (LA);
   XFREE (LAruleno);
-  XFREE (accessing_symbol);
 
   goto_actions ();
   XFREE (goto_map + ntokens);
@@ -945,6 +943,7 @@ output_actions (void)
   output_table ();
 
   output_check ();
+  XFREE (state_table);
 }
 
 \f
@@ -1030,9 +1029,6 @@ static void
 free_itemsets (void)
 {
   core *cp, *cptmp;
-
-  XFREE (state_table);
-
   for (cp = first_state; cp; cp = cptmp)
     {
       cptmp = cp->next;