bison-patches
[Top][All Lists]
Advanced

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

extra lookahead sets in report


From: Joel E. Denny
Subject: extra lookahead sets in report
Date: Wed, 17 Oct 2007 00:36:10 -0400 (EDT)

I committed this.  Is it significant enough for NEWS?

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1737
diff -p -u -r1.1737 ChangeLog
--- ChangeLog   11 Oct 2007 16:40:08 -0000      1.1737
+++ ChangeLog   17 Oct 2007 04:25:21 -0000
@@ -1,3 +1,16 @@
+2007-10-17  Joel E. Denny  <address@hidden>
+
+       * doc/bison.texinfo (Bison Options): Add entry for --print-datadir.
+       (Option Cross Key): Likewise.
+
+       * src/print-xml.c (print_core): Don't print a reduction's lookahead set
+       next to an item whose dot is not at the end of the RHS even if it
+       happens to be associated with the same rule.
+       * src/print.c (print_core): Likewise.
+       * tests/conflicts.at (Unresolved SR Conflicts): Update output.
+       (Resolved SR Conflicts): Update output.
+       * tests/regression.at (Extra lookahead sets in report): New test case.
+
 2007-10-11  Wojciech Polak  <address@hidden>
 
        * src/print-xml.c (print_core): Remove item set
Index: doc/bison.texinfo
===================================================================
RCS file: /sources/bison/bison/doc/bison.texinfo,v
retrieving revision 1.238
diff -p -u -r1.238 bison.texinfo
--- doc/bison.texinfo   8 Oct 2007 10:09:06 -0000       1.238
+++ doc/bison.texinfo   17 Oct 2007 04:25:25 -0000
@@ -7649,6 +7649,9 @@ Print the version number of Bison and ex
 @item --print-localedir
 Print the name of the directory containing locale-dependent data.
 
address@hidden --print-datadir
+Print the name of the directory containing skeletons and XSLT.
+
 @item -y
 @itemx --yacc
 Act more like the traditional Yacc command.  This can cause
@@ -7810,6 +7813,7 @@ the corresponding short option.
 @item @option{--no-lines}                   @tab @option{-l}
 @item @address@hidden       @tab @option{-o @var{outfile}}
 @item @option{--print-localedir}            @tab
address@hidden @option{--print-datadir}              @tab
 @item @option{--token-table}                @tab @option{-k}
 @item @option{--verbose}                    @tab @option{-v}
 @item @option{--version}                    @tab @option{-V}
Index: src/print-xml.c
===================================================================
RCS file: /sources/bison/bison/src/print-xml.c,v
retrieving revision 1.6
diff -p -u -r1.6 print-xml.c
--- src/print-xml.c     11 Oct 2007 16:36:49 -0000      1.6
+++ src/print-xml.c     17 Oct 2007 04:25:25 -0000
@@ -122,7 +122,8 @@ print_core (FILE *out, int level, state 
       sp = rules[r].rhs;
 
       /* Display the lookahead tokens?  */
-      if (report_flag & report_lookahead_tokens)
+      if (report_flag & report_lookahead_tokens
+          && item_number_is_rule_number (*sp1))
        {
          reductions *reds = s->reductions;
          int red = state_reduction_find (s, &rules[r]);
Index: src/print.c
===================================================================
RCS file: /sources/bison/bison/src/print.c,v
retrieving revision 1.105
diff -p -u -r1.105 print.c
--- src/print.c 9 Oct 2007 08:48:43 -0000       1.105
+++ src/print.c 17 Oct 2007 04:25:25 -0000
@@ -110,7 +110,8 @@ print_core (FILE *out, state *s)
        fprintf (out, " %s", symbols[*sp]->tag);
 
       /* Display the lookahead tokens?  */
-      if (report_flag & report_lookahead_tokens)
+      if (report_flag & report_lookahead_tokens
+          && item_number_is_rule_number (*sp1))
        state_rule_lookahead_tokens_print (s, &rules[r], out);
 
       fputc ('\n', out);
Index: tests/conflicts.at
===================================================================
RCS file: /sources/bison/bison/tests/conflicts.at,v
retrieving revision 1.36
diff -p -u -r1.36 conflicts.at
--- tests/conflicts.at  15 Aug 2007 20:21:32 -0000      1.36
+++ tests/conflicts.at  17 Oct 2007 04:25:25 -0000
@@ -212,7 +212,7 @@ state 4
 
 state 5
 
-    1 exp: exp . OP exp  [$end, OP]
+    1 exp: exp . OP exp
     1    | exp OP exp .  [$end, OP]
 
     OP  shift, and go to state 4
@@ -315,7 +315,7 @@ state 4
 
 state 5
 
-    1 exp: exp . OP exp  [$end, OP]
+    1 exp: exp . OP exp
     1    | exp OP exp .  [$end, OP]
 
     $default  reduce using rule 1 (exp)
Index: tests/regression.at
===================================================================
RCS file: /sources/bison/bison/tests/regression.at,v
retrieving revision 1.114
diff -p -u -r1.114 regression.at
--- tests/regression.at 15 Aug 2007 20:21:33 -0000      1.114
+++ tests/regression.at 17 Oct 2007 04:25:25 -0000
@@ -1140,3 +1140,43 @@ start: 'a' "A" 'b';
 AT_CHECK([bison -t -o input.c input.y])
 
 AT_CLEANUP
+
+
+
+## -------------------------------- ##
+## Extra lookahead sets in report.  ##
+## -------------------------------- ##
+
+AT_SETUP([[Extra lookahead sets in report]])
+
+# Within a single state, Bison used to print a reduction's lookahead set next
+# to all items of the associated rule.  Instead, it should only print it next
+# to the item that is of the associated rule and whose dot is at the end of the
+# RHS.  Printing it next to items whose dot is not at the end of the RHS is
+# sometimes redundant and, as in this test case, is sometimes incorrect.
+
+AT_DATA([[input.y]],
+[[%%
+start: a | 'a' a 'a' ;
+a: 'a' ;
+]])
+
+AT_CHECK([[bison --report=all input.y]])
+AT_CHECK([[sed -n '/^state 1$/,/^state 2$/p' input.output]], [[0]],
+[[state 1
+
+    2 start: 'a' . a 'a'
+    3 a: . 'a'
+    3  | 'a' .  [$end]
+
+    'a'  shift, and go to state 4
+
+    $default  reduce using rule 3 (a)
+
+    a  go to state 5
+
+
+state 2
+]])
+
+AT_CLEANUP




reply via email to

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