bison-patches
[Top][All Lists]
Advanced

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

Re: preparing for 2.3b


From: Joel E. Denny
Subject: Re: preparing for 2.3b
Date: Thu, 6 Mar 2008 19:24:34 -0500 (EST)

On Thu, 6 Mar 2008, Akim Demaille wrote:

> Le 6 mars 08 ? 03:20, Joel E. Denny a ?crit :
> 
> > This patch, not yet committed, adds the above and fixes a few other
> > things.  Does this work for you?
> 
> Thanks for fixing all the mistakes I left :(

Thanks for getting this going!

> > address@hidden -g
> > address@hidden address@hidden
> > address@hidden address@hidden
> 
> Presented like this, one cannot see that the argument is optional.
> I would write

> >       fputs (_("\
> > -Mandatory arguments to long options are mandatory for short options too.\n\
> > +Mandatory arguments to long options are mandatory for short options too.
> > The\n\
> > +same is true for optional arguments with one exception: unlike --defines,
> > -d\n\
> > +cannot take an argument since POSIX Yacc requires that -d can be bundled
> > with\n\
> > +other short options.\n\
> > "), stdout);
> 
> I would make the second sentence another fputs, to please the
> translators.  In particular if at some point we manage to
> get rid of this exception.

Thanks.  Here's an update to the patch with the above corrections.  It 
also implements -D, documents -d as a separate option, and let's -W take 
an argument.

But should we reserve -D just in case we ever want it to do something like 
gcc's -D?  I don't know.

I haven't committed yet.

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1778
diff -p -u -r1.1778 ChangeLog
--- ChangeLog   28 Feb 2008 16:28:07 -0000      1.1778
+++ ChangeLog   7 Mar 2008 00:17:37 -0000
@@ -1,3 +1,18 @@
+2008-03-06  Joel E. Denny  <address@hidden>
+
+       * NEWS (2.3a+): Mention that -g now takes an argument.  Mention the new
+       -D option as the short version of --defines, and mention that -d is
+       separate since, for POSIX Yacc, it does not take an argument.
+       * doc/bison.texinfo (Bison Options): Reword -W entry a little for
+       consistency.  Update the -g and -x entries now that they take arguments.
+       Use brackets to indicate optional arguments.  Document -D.
+       * src/getargs.c (usage): Explain the relationship between arguments of
+       long and short options more completely.  Document -D and -d.
+       (short_options): Implement -D, and let -W take an optional argument
+       like --warnings.
+       (long_options): Implement -D.
+       (getargs): Implement -D, and sort cases.
+
 2008-02-28  Akim Demaille  <address@hidden>
 
        * doc/bison.texinfo: Fix a few typos.
Index: NEWS
===================================================================
RCS file: /sources/bison/bison/NEWS,v
retrieving revision 1.187
diff -p -u -r1.187 NEWS
--- NEWS        23 Feb 2008 04:26:14 -0000      1.187
+++ NEWS        7 Mar 2008 00:17:37 -0000
@@ -32,7 +32,8 @@ Changes in version 2.3a+ (????-??-??):
   feedback will help to stabilize it.
 
 * The -g and --graph options now output graphs in Graphviz DOT format,
-  not VCG format.
+  not VCG format.  Like --graph, -g now also takes an optional FILE argument
+  and thus cannot be bundled with other short options.
 
 * Java
 
@@ -184,6 +185,9 @@ Changes in version 2.3a+ (????-??-??):
 * The nonfunctional --no-parser, -n, and %no-parser options have been
   completely removed from Bison.
 
+* Bison now accepts -D as the short equivalent of --defines.  Unlike -d, both
+  -D and --defines take an argument.
+
 Changes in version 2.3a, 2006-09-13:
 
 * Instead of %union, you can define and use your own union type
Index: doc/bison.texinfo
===================================================================
RCS file: /sources/bison/bison/doc/bison.texinfo,v
retrieving revision 1.254
diff -p -u -r1.254 bison.texinfo
--- doc/bison.texinfo   28 Feb 2008 16:28:07 -0000      1.254
+++ doc/bison.texinfo   7 Mar 2008 00:17:41 -0000
@@ -7782,16 +7782,16 @@ Output warnings falling in @var{category
 of:
 @table @code
 @item midrule-values
-Warn about about mid-rule values that are set but not used within any of
-the actions of the parent rule.  For example, Bison warns about unused
address@hidden in:
+Warn about mid-rule values that are set but not used within any of the actions
+of the parent rule.
+For example, warn about unused @code{$2} in:
 
 @example
 exp: '1' @{ $$ = 1; @} '+' exp @{ $$ = $1 + $4; @};
 @end example
 
-It also warns about mid-rule values that are used but not set.  For
-example, Bison warns about unset @code{$$} in the mid-rule action in:
+Also warn about mid-rule values that are used but not set.
+For example, warn about unset @code{$$} in the mid-rule action in:
 
 @example
  exp: '1' @{ $1 = 1; @} '+' exp @{ $$ = $2 + $4; @};
@@ -7799,18 +7799,18 @@ example, Bison warns about unset @code{$
 
 These warnings are not enabled by default since they sometimes prove to
 be false alarms in existing grammars employing the Yacc constructs
address@hidden or @address@hidden (where @var{n} is some positive integer).
address@hidden or @address@hidden (where @var{n} is some positive integer).
 
 
 @item yacc
 Incompatibilities with @acronym{POSIX} Yacc.
 
 @item all
-all the warnings
+All the warnings.
 @item none
-turn off all the warnings
+Turn off all the warnings.
 @item error
-treat warnings as errors
+Treat warnings as errors.
 @end table
 
 A category can be turned off by prefixing its name with @samp{no-}.  For
@@ -7876,14 +7876,16 @@ Pretend that @code{%token-table} was spe
 Adjust the output:
 
 @table @option
address@hidden -d
address@hidden --defines
address@hidden address@hidden
address@hidden address@hidden
 Pretend that @code{%defines} was specified, i.e., write an extra output
 file containing macro definitions for the token type names defined in
 the grammar, as well as a few other declarations.  @xref{Decl Summary}.
 
address@hidden address@hidden
-Same as above, but save in the file @var{defines-file}.
address@hidden -d
+This is the same as @code{-D} except @code{-d} does not accept a @var{file}
+argument since POSIX Yacc requires that @code{-d} can be bundled with other
+short options.
 
 @item -b @var{file-prefix}
 @itemx address@hidden
@@ -7925,22 +7927,19 @@ Specify the @var{file} for the parser fi
 The other output files' names are constructed from @var{file} as
 described under the @samp{-v} and @samp{-d} options.
 
address@hidden -g
address@hidden address@hidden
address@hidden address@hidden
 Output a graphical representation of the @acronym{LALR}(1) grammar
 automaton computed by Bison, in @uref{http://www.graphviz.org/, Graphviz}
 @uref{http://www.graphviz.org/doc/info/lang.html, @acronym{DOT}} format.
-If the grammar file is @file{foo.y}, the output file will
-be @file{foo.dot}.
-
address@hidden address@hidden
-The behavior of @var{--graph} is the same as @samp{-g}.  The only
-difference is that it has an optional argument which is the name of
-the output graph file.
address@hidden@var{file}} is optional.
+If omitted and the grammar file is @file{foo.y}, the output file will be
address@hidden
 
address@hidden -x
address@hidden address@hidden
address@hidden address@hidden
address@hidden address@hidden
 Output an XML report of the @acronym{LALR}(1) automaton computed by Bison.
address@hidden@var{file}} is optional.
address@hidden@var{file}} is optional.
 If omitted and the grammar file is @file{foo.y}, the output file will be
 @file{foo.xml}.
 (The current XML schema is experimental and may evolve.
Index: src/getargs.c
===================================================================
RCS file: /sources/bison/bison/src/getargs.c,v
retrieving revision 1.105
diff -p -u -r1.105 getargs.c
--- src/getargs.c       28 Feb 2008 16:01:16 -0000      1.105
+++ src/getargs.c       7 Mar 2008 00:17:41 -0000
@@ -254,6 +254,9 @@ Generate LALR(1) and GLR parsers.\n\
       fputs (_("\
 Mandatory arguments to long options are mandatory for short options too.\n\
 "), stdout);
+      fputs (_("\
+The same is true for optional arguments.\n\
+"), stdout);
 
       fputs (_("\
 \n\
@@ -281,7 +284,8 @@ Parser:\n\
 
       fputs (_("\
 Output:\n\
-  -d, --defines[=FILE]       also produce a header file\n\
+  -D, --defines[=FILE]       also produce a header file\n\
+  -d                         like -D but cannot specify FILE (for POSIX 
Yacc)\n\
   -r, --report=THINGS        also produce details on the automaton\n\
       --report-file=FILE     write report to FILE\n\
   -v, --verbose              same as `--report=state'\n\
@@ -406,11 +410,12 @@ language_argmatch (char const *arg, int 
 /* Shorts options.
    Should be computed from long_options.  */
 static char const short_options[] =
+  "D::"
   "L:"
   "S:"
   "T::"
   "V"
-  "W"
+  "W::"
   "b:"
   "d"
   "e"
@@ -464,7 +469,7 @@ static struct option const long_options[
   { "trace",         optional_argument,   0,     'T' },
 
   /* Output.  */
-  { "defines",     optional_argument,   0,   'd' },
+  { "defines",     optional_argument,   0,   'D' },
 
   /* Operation modes.  */
   { "fixed-output-files", no_argument,  0,   'y' },
@@ -503,27 +508,16 @@ getargs (int argc, char *argv[])
        /* Certain long options cause getopt_long to return 0.  */
        break;
 
-      case 'b':
-       spec_file_prefix = AS_FILE_NAME (optarg);
-       break;
-
-      case 'g':
-       /* Here, the -g and --graph=FILE options are differentiated.  */
-       graph_flag = true;
+      case 'D':
+       defines_flag = true;
        if (optarg)
-         spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+         spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
        break;
 
-      case 'x':
-       /* Here, the -x and --xml=FILE options are differentiated.  */
-       xml_flag = true;
-       if (optarg)
-         spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+      case 'I':
+       include = AS_FILE_NAME (optarg);
        break;
 
-      case 'h':
-       usage (EXIT_SUCCESS);
-
       case 'L':
        language_argmatch (optarg, 0, NULL);
        break;
@@ -532,17 +526,38 @@ getargs (int argc, char *argv[])
        skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
        break;
 
-      case 'I':
-       include = AS_FILE_NAME (optarg);
+      case 'T':
+       FLAGS_ARGMATCH (trace, optarg);
+       break;
+
+      case 'V':
+       version ();
+       exit (EXIT_SUCCESS);
+
+      case 'W':
+       if (optarg)
+         FLAGS_ARGMATCH (warnings, optarg);
+       else
+         warnings_flag |= warnings_all;
+       break;
+
+      case 'b':
+       spec_file_prefix = AS_FILE_NAME (optarg);
        break;
 
       case 'd':
-       /* Here, the -d and --defines options are differentiated.  */
        defines_flag = true;
+       break;
+
+      case 'g':
+       graph_flag = true;
        if (optarg)
-         spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+         spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
        break;
 
+      case 'h':
+       usage (EXIT_SUCCESS);
+
       case 'k':
        token_table_flag = true;
        break;
@@ -563,35 +578,22 @@ getargs (int argc, char *argv[])
        FLAGS_ARGMATCH (report, optarg);
        break;
 
-      case REPORT_FILE_OPTION:
-       spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
-       break;
-
-      case 'T':
-       FLAGS_ARGMATCH (trace, optarg);
-       break;
-
       case 't':
        debug_flag = true;
        break;
 
-      case 'V':
-       version ();
-       exit (EXIT_SUCCESS);
-
       case 'v':
        report_flag |= report_states;
        break;
 
-      case 'y':
-       yacc_flag = true;
+      case 'x':
+       xml_flag = true;
+       if (optarg)
+         spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
        break;
 
-      case 'W':
-       if (optarg)
-         FLAGS_ARGMATCH (warnings, optarg);
-       else
-         warnings_flag |= warnings_all;
+      case 'y':
+       yacc_flag = true;
        break;
 
       case LOCATIONS_OPTION:
@@ -606,6 +608,10 @@ getargs (int argc, char *argv[])
        printf ("%s\n", compute_pkgdatadir ());
        exit (EXIT_SUCCESS);
 
+      case REPORT_FILE_OPTION:
+       spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
+       break;
+
       default:
        usage (EXIT_FAILURE);
       }

reply via email to

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