bison-patches
[Top][All Lists]
Advanced

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

05-fyi-display-ruleno.patch


From: Akim Demaille
Subject: 05-fyi-display-ruleno.patch
Date: Sat, 29 Dec 2001 15:13:37 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/gram.c (ritem_print): Be sure to subtract 1 when displaying
        rule line numbers.
        * src/closure.c (print_closure): Likewise.
        * src/derives.c (print_derives): Likewise.
        * tests/sets.at (Nullable): Adjust: the rule numbers are correct
        now.

Index: tests/sets.at
--- tests/sets.at Fri, 28 Dec 2001 15:00:09 +0100 akim
+++ tests/sets.at Fri, 28 Dec 2001 15:07:19 +0100 akim
@@ -42,9 +42,9 @@ e: 'e' | /* Nothing */;

 AT_CHECK([[sed 's/[     ]*$//' stderr]], [],
 [[RITEM
-  e  $  (rule 1)
-  'e'  (rule 2)
-  (rule 3)
+  e  $  (rule 0)
+  'e'  (rule 1)
+  (rule 2)


 DERIVES
@@ -89,12 +89,12 @@ TC: Output END

 FDERIVES
        $axiom derives
-               1: e $
-               2: 'e'
-               3:
+               0: e $
+               1: 'e'
+               2:
        e derives
-               2: 'e'
-               3:
+               1: 'e'
+               2:


 Processing state 0 (reached by $)
@@ -102,9 +102,9 @@ Closure: input


 Closure: output
-   0: . e $  (rule 1)
-   3: . 'e'  (rule 2)
-   5: .  (rule 3)
+   0: . e $  (rule 0)
+   3: . 'e'  (rule 1)
+   5: .  (rule 2)


 Entering new_itemsets, state = 0
@@ -117,22 +117,22 @@ Closure: output
 Exiting get_state => 2
 Processing state 1 (reached by 'e')
 Closure: input
-   4: .  (rule 2)
+   4: .  (rule 1)


 Closure: output
-   4: .  (rule 2)
+   4: .  (rule 1)


 Entering new_itemsets, state = 1
 Entering append_states, state = 1
 Processing state 2 (reached by e)
 Closure: input
-   1: . $  (rule 1)
+   1: . $  (rule 0)


 Closure: output
-   1: . $  (rule 1)
+   1: . $  (rule 0)


 Entering new_itemsets, state = 2
@@ -142,11 +142,11 @@ Closure: output
 Exiting get_state => 3
 Processing state 3 (reached by $)
 Closure: input
-   2: .  (rule 1)
+   2: .  (rule 0)


 Closure: output
-   2: .  (rule 1)
+   2: .  (rule 0)


 Entering new_itemsets, state = 3
Index: src/closure.c
--- src/closure.c Thu, 27 Dec 2001 15:45:59 +0100 akim
+++ src/closure.c Fri, 28 Dec 2001 15:00:23 +0100 akim
@@ -62,7 +62,7 @@
       fprintf (stderr, "  %2d: .", array[i]);
       for (rp = &ritem[array[i]]; *rp >= 0; ++rp)
        fprintf (stderr, " %s", tags[*rp]);
-      fprintf (stderr, "  (rule %d)\n", -*rp);
+      fprintf (stderr, "  (rule %d)\n", -*rp - 1);
     }
   fputs ("\n\n", stderr);
 }
@@ -100,8 +100,8 @@
        if (BITISSET (FDERIVES (i), j))
          {
            short *rhsp;
-           fprintf (stderr, "\t\t%d:", j);
-           for (rhsp = ritem + rule_table[j].rhs; *rhsp >= 0; ++rhsp)
+           fprintf (stderr, "\t\t%d:", j - 1);
+           for (rhsp = &ritem[rule_table[j].rhs]; *rhsp >= 0; ++rhsp)
              fprintf (stderr, " %s", tags[*rhsp]);
            fputc ('\n', stderr);
          }
Index: src/derives.c
--- src/derives.c Fri, 28 Dec 2001 14:55:09 +0100 akim
+++ src/derives.c Fri, 28 Dec 2001 15:01:00 +0100 akim
@@ -43,7 +43,7 @@
        {
          short *rhsp;
          fprintf (stderr, "\t\t%d:", *sp);
-         for (rhsp = ritem + rule_table[*sp].rhs; *rhsp >= 0; ++rhsp)
+         for (rhsp = &ritem[rule_table[*sp].rhs]; *rhsp >= 0; ++rhsp)
            fprintf (stderr, " %s", tags[*rhsp]);
          fprintf (stderr, " (rule %d)\n", -*rhsp - 1);
        }
Index: src/gram.c
--- src/gram.c Fri, 28 Dec 2001 14:44:45 +0100 akim
+++ src/gram.c Fri, 28 Dec 2001 15:00:23 +0100 akim
@@ -66,7 +66,7 @@
     if (ritem[i] >= 0)
       fprintf (out, "  %s", tags[ritem[i]]);
     else
-      fprintf (out, "  (rule %d)\n", -ritem[i]);
+      fprintf (out, "  (rule %d)\n", -ritem[i] - 1);
   fputs ("\n\n", out);
 }



reply via email to

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