bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

12-fyi-more-state-t.patch


From: Akim Demaille
Subject: 12-fyi-more-state-t.patch
Date: Mon, 19 Nov 2001 10:02:37 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/lalr.h (consistent): Removed array, which contents is now
        member of...
        (state_t): this structure.
        * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c:
        Adjust.

Index: src/print_graph.c
--- src/print_graph.c Thu, 15 Nov 2001 23:03:10 +0100 akim
+++ src/print_graph.c Thu, 15 Nov 2001 23:07:55 +0100 akim
@@ -178,7 +178,7 @@
        obstack_sgrow (node_obstack, "\\n");
     }
 
-  if (consistent[state] && redp)
+  if (state_table[state].consistent && redp)
     {
       rule = redp->rules[0];
       symbol = rlhs[rule];
Index: src/conflicts.c
--- src/conflicts.c Thu, 15 Nov 2001 23:03:10 +0100 akim
+++ src/conflicts.c Thu, 15 Nov 2001 23:07:44 +0100 akim
@@ -191,7 +191,7 @@
   unsigned *fp1;
   int symbol;
 
-  if (consistent[state])
+  if (state_table[state].consistent)
     return;
 
   for (i = 0; i < tokensetsize; i++)
Index: src/lalr.c
--- src/lalr.c Thu, 15 Nov 2001 23:03:10 +0100 akim
+++ src/lalr.c Thu, 15 Nov 2001 23:07:27 +0100 akim
@@ -42,7 +42,6 @@
 short *LAruleno;
 unsigned *LA;
 
-char *consistent;
 short *goto_map;
 short *from_state;
 short *to_state;
@@ -208,7 +207,6 @@
   shifts *sp;
   short *np;
 
-  consistent = XCALLOC (char, nstates);
   lookaheads = XCALLOC (short, nstates + 1);
 
   count = 0;
@@ -225,14 +223,14 @@
              || (sp && !ISVAR (state_table[sp->shifts[0]].accessing_symbol))))
        count += rp->nreds;
       else
-       consistent[i] = 1;
+       state_table[i].consistent = 1;
 
       if (sp)
        for (k = 0; k < sp->nshifts; k++)
          if (state_table[sp->shifts[k]].accessing_symbol
              == error_token_number)
            {
-             consistent[i] = 0;
+             state_table[i].consistent = 0;
              break;
            }
     }
@@ -255,7 +253,7 @@
   np = LAruleno;
   for (i = 0; i < nstates; i++)
     {
-      if (!consistent[i])
+      if (!state_table[i].consistent)
        {
          if ((rp = state_table[i].reduction_table))
            for (j = 0; j < rp->nreds; j++)
@@ -580,7 +578,7 @@
              states[length++] = stateno;
            }
 
-         if (!consistent[stateno])
+         if (!state_table[stateno].consistent)
            add_lookback_edge (stateno, *rulep, i);
 
          length--;
Index: src/lalr.h
--- src/lalr.h Thu, 15 Nov 2001 23:03:10 +0100 akim
+++ src/lalr.h Thu, 15 Nov 2001 23:08:54 +0100 akim
@@ -49,12 +49,6 @@
 extern short *from_state;
 extern short *to_state;
 
-/* CONSISTENT[S] is nonzero if no lookahead is needed to decide what
-   to do in state S.  */
-
-extern char *consistent;
-
-
 /* LARULENO is a vector which records the rules that need lookahead in
    various states.  The elements of LARULENO that apply to state S are
    those from LOOKAHEADS[S] through LOOKAHEADS[S+1]-1.  Each element
@@ -85,6 +79,10 @@
 
   shifts *shift_table;
   reductions *reduction_table;
+
+  /* Nonzero if no lookahead is needed to decide what to do in state
+     S.  */
+  char consistent;
 } state_t;
 
 /* All the decorated states, indexed by the state number.  Warning:
Index: src/output.c
--- src/output.c Thu, 15 Nov 2001 23:03:10 +0100 akim
+++ src/output.c Thu, 15 Nov 2001 23:07:57 +0100 akim
@@ -620,7 +620,7 @@
 
   if (nreds >= 1 && !nodefault)
     {
-      if (consistent[state])
+      if (state_table[state].consistent)
        default_rule = redp->rules[0];
       else
        {
Index: src/print.c
--- src/print.c Thu, 15 Nov 2001 23:03:10 +0100 akim
+++ src/print.c Thu, 15 Nov 2001 23:07:57 +0100 akim
@@ -165,7 +165,7 @@
        fputc ('\n', out);
     }
 
-  if (consistent[state] && redp)
+  if (state_table[state].consistent && redp)
     {
       rule = redp->rules[0];
       symbol = rlhs[rule];



reply via email to

[Prev in Thread] Current Thread [Next in Thread]