bison-patches
[Top][All Lists]
Advanced

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

Re: --print-datadir


From: Joel E. Denny
Subject: Re: --print-datadir
Date: Sat, 24 Nov 2007 16:15:49 -0500 (EST)

On Sun, 30 Sep 2007, Joel E. Denny wrote:

> On Sun, 30 Sep 2007, Akim Demaille wrote:

> > > By the way, I combine --report=all and --xml to get the full report in XML
> > > format, but why should the .output file be generated at the same time?
> > 
> > If you are saying that --report changes the output of --xml,
> > then I think this is a misfeature.  It is to maintain compatibility
> > that --report was introduced, but it was meant to be related to
> > the *.output only.  In the case of XML, every bit of information
> > should always be output IMHO.
> 
> That makes more sense to me too.

I haven't yet committed the following, which implements the above.

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1758
diff -p -u -r1.1758 ChangeLog
--- ChangeLog   24 Nov 2007 19:41:24 -0000      1.1758
+++ ChangeLog   24 Nov 2007 21:11:20 -0000
@@ -1,5 +1,19 @@
 2007-11-24  Joel E. Denny  <address@hidden>
 
+       Don't let --report affect XML output; always print all information.
+       Discussed at
+       <http://lists.gnu.org/archive/html/bison-patches/2007-09/msg00020.html>.
+       * src/conflicts.c (log_resolution): Implement.
+       * src/print-xml.c (print_core): Implement.
+       (print_state): Implement.
+       (print_xml): Implement.
+
+       * NEWS (2.3a+): Fix quotes.
+       * src/parse-gram.y (prologue_declaration): For consistency with -v,
+       don't let %verbose clear the list specified by --report.
+
+2007-11-24  Joel E. Denny  <address@hidden>
+
        In the XML output, list useless and unused symbols and rules with the
        useful ones and add a "usefulness" attribute.  Discussed starting at
        <http://lists.gnu.org/archive/html/bison-patches/2007-09/msg00017.html>.
Index: NEWS
===================================================================
RCS file: /sources/bison/bison/NEWS,v
retrieving revision 1.183
diff -p -u -r1.183 NEWS
--- NEWS        24 Nov 2007 19:41:24 -0000      1.183
+++ NEWS        24 Nov 2007 21:11:20 -0000
@@ -18,7 +18,7 @@ Changes in version 2.3a+ (????-??-??):
 * Push Parsing
 
   Bison can now generate an LALR(1) parser in C with a push interface.  That
-  is, instead of invoking yyparse, which pulls tokens from `yylex', you can
+  is, instead of invoking `yyparse', which pulls tokens from `yylex', you can
   push one token at a time to the parser using `yypush_parse', which will
   return to the caller after processing each token.  By default, the push
   interface is disabled.  Either of the following directives will enable it:
Index: src/conflicts.c
===================================================================
RCS file: /sources/bison/bison/src/conflicts.c,v
retrieving revision 1.124
diff -p -u -r1.124 conflicts.c
--- src/conflicts.c     9 Oct 2007 08:48:43 -0000       1.124
+++ src/conflicts.c     24 Nov 2007 21:11:21 -0000
@@ -135,78 +135,78 @@ log_resolution (rule *r, symbol_number t
        }
 
       obstack_sgrow (&solved_conflicts_obstack, ".\n");
+    }
 
-      /* XML report */
-      if (xml_flag)
-       {
-         /* The description of the resolution. */
-         switch (resolution)
-           {
-           case shift_resolution:
-           case right_resolution:
-             obstack_fgrow2 (&solved_conflicts_xml_obstack,
-                             "        <resolution rule=\"%d\" symbol=\"%s\""
-                             " type=\"shift\">",
-                             r->number,
-                             xml_escape (symbols[token]->tag));
-             break;
-
-           case reduce_resolution:
-           case left_resolution:
-             obstack_fgrow2 (&solved_conflicts_xml_obstack,
-                             "        <resolution rule=\"%d\" symbol=\"%s\""
-                             " type=\"reduce\">",
-                             r->number,
-                             xml_escape (symbols[token]->tag));
-             break;
-
-           case nonassoc_resolution:
-             obstack_fgrow2 (&solved_conflicts_xml_obstack,
-                             "        <resolution rule=\"%d\" symbol=\"%s\""
-                             " type=\"error\">",
-                             r->number,
-                             xml_escape (symbols[token]->tag));
-             break;
-           }
-
-         /* The reason. */
-         switch (resolution)
-           {
-           case shift_resolution:
-             obstack_fgrow2 (&solved_conflicts_xml_obstack,
-                             "%s &lt; %s",
-                             xml_escape_n (0, r->prec->tag),
-                             xml_escape_n (1, symbols[token]->tag));
-             break;
-
-           case reduce_resolution:
-             obstack_fgrow2 (&solved_conflicts_xml_obstack,
-                             "%s &lt; %s",
-                             xml_escape_n (0, symbols[token]->tag),
-                             xml_escape_n (1, r->prec->tag));
-             break;
-
-           case left_resolution:
-             obstack_fgrow1 (&solved_conflicts_xml_obstack,
-                             "%%left %s",
-                             xml_escape (symbols[token]->tag));
-             break;
-
-           case right_resolution:
-             obstack_fgrow1 (&solved_conflicts_xml_obstack,
-                             "%%right %s",
-                             xml_escape (symbols[token]->tag));
-             break;
-
-           case nonassoc_resolution:
-             obstack_fgrow1 (&solved_conflicts_xml_obstack,
-                             "%%nonassoc %s",
-                             xml_escape (symbols[token]->tag));
-         break;
-           }
+  /* XML report */
+  if (xml_flag)
+    {
+      /* The description of the resolution. */
+      switch (resolution)
+        {
+        case shift_resolution:
+        case right_resolution:
+          obstack_fgrow2 (&solved_conflicts_xml_obstack,
+                          "        <resolution rule=\"%d\" symbol=\"%s\""
+                          " type=\"shift\">",
+                          r->number,
+                          xml_escape (symbols[token]->tag));
+          break;
+
+        case reduce_resolution:
+        case left_resolution:
+          obstack_fgrow2 (&solved_conflicts_xml_obstack,
+                          "        <resolution rule=\"%d\" symbol=\"%s\""
+                          " type=\"reduce\">",
+                          r->number,
+                          xml_escape (symbols[token]->tag));
+          break;
+
+        case nonassoc_resolution:
+          obstack_fgrow2 (&solved_conflicts_xml_obstack,
+                          "        <resolution rule=\"%d\" symbol=\"%s\""
+                          " type=\"error\">",
+                          r->number,
+                          xml_escape (symbols[token]->tag));
+          break;
+        }
+
+      /* The reason. */
+      switch (resolution)
+        {
+        case shift_resolution:
+          obstack_fgrow2 (&solved_conflicts_xml_obstack,
+                          "%s &lt; %s",
+                          xml_escape_n (0, r->prec->tag),
+                          xml_escape_n (1, symbols[token]->tag));
+          break;
+
+        case reduce_resolution:
+          obstack_fgrow2 (&solved_conflicts_xml_obstack,
+                          "%s &lt; %s",
+                          xml_escape_n (0, symbols[token]->tag),
+                          xml_escape_n (1, r->prec->tag));
+          break;
+
+        case left_resolution:
+          obstack_fgrow1 (&solved_conflicts_xml_obstack,
+                          "%%left %s",
+                          xml_escape (symbols[token]->tag));
+          break;
+
+        case right_resolution:
+          obstack_fgrow1 (&solved_conflicts_xml_obstack,
+                          "%%right %s",
+                          xml_escape (symbols[token]->tag));
+          break;
+
+        case nonassoc_resolution:
+          obstack_fgrow1 (&solved_conflicts_xml_obstack,
+                          "%%nonassoc %s",
+                          xml_escape (symbols[token]->tag));
+      break;
+        }
 
-         obstack_sgrow (&solved_conflicts_xml_obstack, "</resolution>\n");
-       }
+      obstack_sgrow (&solved_conflicts_xml_obstack, "</resolution>\n");
     }
 }
 
Index: src/parse-gram.y
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.y,v
retrieving revision 1.122
diff -p -u -r1.122 parse-gram.y
--- src/parse-gram.y    29 Oct 2007 17:36:39 -0000      1.122
+++ src/parse-gram.y    24 Nov 2007 21:11:21 -0000
@@ -305,7 +305,7 @@ prologue_declaration:
       skeleton_arg (skeleton_user, 1, &@1);
     }
 | "%token-table"                { token_table_flag = true; }
-| "%verbose"                    { report_flag = report_states; }
+| "%verbose"                    { report_flag |= report_states; }
 | "%yacc"                       { yacc_flag = true; }
 | /*FIXME: Err?  What is this horror doing here? */ ";"
 ;
Index: src/print-xml.c
===================================================================
RCS file: /sources/bison/bison/src/print-xml.c,v
retrieving revision 1.11
diff -p -u -r1.11 print-xml.c
--- src/print-xml.c     24 Nov 2007 19:41:25 -0000      1.11
+++ src/print-xml.c     24 Nov 2007 21:11:22 -0000
@@ -63,12 +63,9 @@ print_core (FILE *out, int level, state 
   size_t snritems = s->nitems;
 
   /* Output all the items of a state, not only its kernel.  */
-  if (report_flag & report_itemsets)
-    {
-      closure (sitems, snritems);
-      sitems = itemset;
-      snritems = nitemset;
-    }
+  closure (sitems, snritems);
+  sitems = itemset;
+  snritems = nitemset;
 
   if (!snritems) {
     xml_puts (out, level, "<itemset/>");
@@ -93,8 +90,7 @@ print_core (FILE *out, int level, state 
       sp = rules[r].rhs;
 
       /* Display the lookahead tokens?  */
-      if (report_flag & report_lookahead_tokens
-          && item_number_is_rule_number (*sp1))
+      if (item_number_is_rule_number (*sp1))
        {
          reductions *reds = s->reductions;
          int red = state_reduction_find (s, &rules[r]);
@@ -365,7 +361,7 @@ print_state (FILE *out, int level, state
   xml_printf (out, level, "<state number=\"%d\">", s->number);
   print_core (out, level + 1, s);
   print_actions (out, level + 1, s);
-  if ((report_flag & report_solved_conflicts) && s->solved_conflicts_xml)
+  if (s->solved_conflicts_xml)
     {
       xml_puts (out, level + 1, "<solved-conflicts>");
       fputs (s->solved_conflicts_xml, out);
@@ -563,8 +559,7 @@ print_xml (void)
   /* print grammar */
   print_grammar (out, level + 1);
 
-  if (report_flag & report_itemsets)
-    new_closure (nritems);
+  new_closure (nritems);
   no_reduce_set =  bitset_create (ntokens, BITSET_FIXED);
 
   /* print automaton */
@@ -575,8 +570,7 @@ print_xml (void)
   xml_puts (out, level + 1, "</automaton>");
 
   bitset_free (no_reduce_set);
-  if (report_flag & report_itemsets)
-    free_closure ();
+  free_closure ();
 
   xml_puts (out, 0, "</bison-xml-report>");
 




reply via email to

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