* NEWS (2.3a+): Mention that -g now takes 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.
* src/getargs.c (usage): Explain the relationship between arguments of
long and short options more completely.  Document --defines and -d
separately since the former takes an argument but, for POSIX Yacc, the
latter does not.
(short_options): Let -W take an optional argument like --warnings.
(getargs): Sort cases.
This commit is contained in:
Joel E. Denny
2008-03-08 20:49:57 +00:00
parent 59c5ac7244
commit 8e55b3aac2
5 changed files with 90 additions and 70 deletions

View File

@@ -1,3 +1,16 @@
2008-03-08 Joel E. Denny <jdenny@ces.clemson.edu>
* NEWS (2.3a+): Mention that -g now takes 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.
* src/getargs.c (usage): Explain the relationship between arguments of
long and short options more completely. Document --defines and -d
separately since the former takes an argument but, for POSIX Yacc, the
latter does not.
(short_options): Let -W take an optional argument like --warnings.
(getargs): Sort cases.
2008-02-28 Akim Demaille <demaille@gostai.com> 2008-02-28 Akim Demaille <demaille@gostai.com>
* doc/bison.texinfo: Fix a few typos. * doc/bison.texinfo: Fix a few typos.

3
NEWS
View File

@@ -32,7 +32,8 @@ Changes in version 2.3a+ (????-??-??):
feedback will help to stabilize it. feedback will help to stabilize it.
* The -g and --graph options now output graphs in Graphviz DOT format, * 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 * Java

View File

@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
.TH BISON "1" "February 2008" "bison 2.3a+" "User Commands" .TH BISON "1" "March 2008" "bison 2.3a+" "User Commands"
.SH NAME .SH NAME
bison \- GNU Project parser generator (yacc replacement) bison \- GNU Project parser generator (yacc replacement)
.SH SYNOPSIS .SH SYNOPSIS
@@ -61,6 +61,7 @@ connect the option name and the argument with
Generate LALR(1) and GLR parsers. Generate LALR(1) and GLR parsers.
.PP .PP
Mandatory arguments to long options are mandatory for short options too. Mandatory arguments to long options are mandatory for short options too.
The same is true for optional arguments.
.SS "Operation modes:" .SS "Operation modes:"
.TP .TP
\fB\-h\fR, \fB\-\-help\fR \fB\-h\fR, \fB\-\-help\fR
@@ -104,9 +105,12 @@ don't generate `#line' directives
include a table of token names include a table of token names
.SS "Output:" .SS "Output:"
.TP .TP
\fB\-d\fR, \fB\-\-defines\fR[=\fIFILE\fR] \fB\-\-defines\fR[=\fIFILE\fR]
also produce a header file also produce a header file
.TP .TP
\fB\-d\fR
likewise but cannot specify FILE (for POSIX Yacc)
.TP
\fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR \fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
also produce details on the automaton also produce details on the automaton
.TP .TP

View File

@@ -7782,16 +7782,16 @@ Output warnings falling in @var{category}. @var{category} can be one
of: of:
@table @code @table @code
@item midrule-values @item midrule-values
Warn about about mid-rule values that are set but not used within any of Warn about mid-rule values that are set but not used within any of the actions
the actions of the parent rule. For example, Bison warns about unused of the parent rule.
@code{$2} in: For example, warn about unused @code{$2} in:
@example @example
exp: '1' @{ $$ = 1; @} '+' exp @{ $$ = $1 + $4; @}; exp: '1' @{ $$ = 1; @} '+' exp @{ $$ = $1 + $4; @};
@end example @end example
It also warns about mid-rule values that are used but not set. For Also warn about mid-rule values that are used but not set.
example, Bison warns about unset @code{$$} in the mid-rule action in: For example, warn about unset @code{$$} in the mid-rule action in:
@example @example
exp: '1' @{ $1 = 1; @} '+' exp @{ $$ = $2 + $4; @}; exp: '1' @{ $1 = 1; @} '+' exp @{ $$ = $2 + $4; @};
@@ -7799,18 +7799,18 @@ example, Bison warns about unset @code{$$} in the mid-rule action in:
These warnings are not enabled by default since they sometimes prove to These warnings are not enabled by default since they sometimes prove to
be false alarms in existing grammars employing the Yacc constructs be false alarms in existing grammars employing the Yacc constructs
@code{$0} or @code{$-@var{b}} (where @var{n} is some positive integer). @code{$0} or @code{$-@var{n}} (where @var{n} is some positive integer).
@item yacc @item yacc
Incompatibilities with @acronym{POSIX} Yacc. Incompatibilities with @acronym{POSIX} Yacc.
@item all @item all
all the warnings All the warnings.
@item none @item none
turn off all the warnings Turn off all the warnings.
@item error @item error
treat warnings as errors Treat warnings as errors.
@end table @end table
A category can be turned off by prefixing its name with @samp{no-}. For A category can be turned off by prefixing its name with @samp{no-}. For
@@ -7876,14 +7876,15 @@ Pretend that @code{%token-table} was specified. @xref{Decl Summary}.
Adjust the output: Adjust the output:
@table @option @table @option
@item -d @item --defines[=@var{file}]
@itemx --defines
Pretend that @code{%defines} was specified, i.e., write an extra output Pretend that @code{%defines} was specified, i.e., write an extra output
file containing macro definitions for the token type names defined in file containing macro definitions for the token type names defined in
the grammar, as well as a few other declarations. @xref{Decl Summary}. the grammar, as well as a few other declarations. @xref{Decl Summary}.
@item --defines=@var{defines-file} @item -d
Same as above, but save in the file @var{defines-file}. This is the same as @code{--defines} 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} @item -b @var{file-prefix}
@itemx --file-prefix=@var{prefix} @itemx --file-prefix=@var{prefix}
@@ -7925,22 +7926,19 @@ Specify the @var{file} for the parser file.
The other output files' names are constructed from @var{file} as The other output files' names are constructed from @var{file} as
described under the @samp{-v} and @samp{-d} options. described under the @samp{-v} and @samp{-d} options.
@item -g @item -g[@var{file}]
@itemx --graph[=@var{file}]
Output a graphical representation of the @acronym{LALR}(1) grammar Output a graphical representation of the @acronym{LALR}(1) grammar
automaton computed by Bison, in @uref{http://www.graphviz.org/, Graphviz} automaton computed by Bison, in @uref{http://www.graphviz.org/, Graphviz}
@uref{http://www.graphviz.org/doc/info/lang.html, @acronym{DOT}} format. @uref{http://www.graphviz.org/doc/info/lang.html, @acronym{DOT}} format.
If the grammar file is @file{foo.y}, the output file will @code{@var{file}} is optional.
be @file{foo.dot}. If omitted and the grammar file is @file{foo.y}, the output file will be
@file{foo.dot}.
@item --graph=@var{graph-file} @item -x[@var{file}]
The behavior of @var{--graph} is the same as @samp{-g}. The only @itemx --xml[=@var{file}]
difference is that it has an optional argument which is the name of
the output graph file.
@item -x
@itemx --xml=@var{file}
Output an XML report of the @acronym{LALR}(1) automaton computed by Bison. Output an XML report of the @acronym{LALR}(1) automaton computed by Bison.
@code{=@var{file}} is optional. @code{@var{file}} is optional.
If omitted and the grammar file is @file{foo.y}, the output file will be If omitted and the grammar file is @file{foo.y}, the output file will be
@file{foo.xml}. @file{foo.xml}.
(The current XML schema is experimental and may evolve. (The current XML schema is experimental and may evolve.

View File

@@ -253,6 +253,9 @@ Generate LALR(1) and GLR parsers.\n\
fputs (_("\ fputs (_("\
Mandatory arguments to long options are mandatory for short options too.\n\ Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout);
fputs (_("\
The same is true for optional arguments.\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@@ -279,9 +282,12 @@ Parser:\n\
\n\ \n\
"), stdout); "), stdout);
/* Keep -d and --defines separate so that ../build-aux/cross-options.pl
* won't assume that -d also takes an argument. */
fputs (_("\ fputs (_("\
Output:\n\ Output:\n\
-d, --defines[=FILE] also produce a header file\n\ --defines[=FILE] also produce a header file\n\
-d likewise but cannot specify FILE (for POSIX Yacc)\n\
-r, --report=THINGS also produce details on the automaton\n\ -r, --report=THINGS also produce details on the automaton\n\
--report-file=FILE write report to FILE\n\ --report-file=FILE write report to FILE\n\
-v, --verbose same as `--report=state'\n\ -v, --verbose same as `--report=state'\n\
@@ -410,7 +416,7 @@ static char const short_options[] =
"S:" "S:"
"T::" "T::"
"V" "V"
"W" "W::"
"b:" "b:"
"d" "d"
"e" "e"
@@ -503,27 +509,17 @@ getargs (int argc, char *argv[])
/* Certain long options cause getopt_long to return 0. */ /* Certain long options cause getopt_long to return 0. */
break; break;
case 'b': case 'd':
spec_file_prefix = AS_FILE_NAME (optarg); /* Here, the -d and --defines options are differentiated. */
break; defines_flag = true;
case 'g':
/* Here, the -g and --graph=FILE options are differentiated. */
graph_flag = true;
if (optarg) if (optarg)
spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
break; break;
case 'x': case 'I':
/* Here, the -x and --xml=FILE options are differentiated. */ include = AS_FILE_NAME (optarg);
xml_flag = true;
if (optarg)
spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
break; break;
case 'h':
usage (EXIT_SUCCESS);
case 'L': case 'L':
language_argmatch (optarg, 0, NULL); language_argmatch (optarg, 0, NULL);
break; break;
@@ -532,17 +528,34 @@ getargs (int argc, char *argv[])
skeleton_arg (AS_FILE_NAME (optarg), 0, NULL); skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
break; break;
case 'I': case 'T':
include = AS_FILE_NAME (optarg); FLAGS_ARGMATCH (trace, optarg);
break; break;
case 'd': case 'V':
/* Here, the -d and --defines options are differentiated. */ version ();
defines_flag = true; exit (EXIT_SUCCESS);
case 'W':
if (optarg) if (optarg)
spec_defines_file = xstrdup (AS_FILE_NAME (optarg)); FLAGS_ARGMATCH (warnings, optarg);
else
warnings_flag |= warnings_all;
break; break;
case 'b':
spec_file_prefix = AS_FILE_NAME (optarg);
break;
case 'g':
graph_flag = true;
if (optarg)
spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
break;
case 'h':
usage (EXIT_SUCCESS);
case 'k': case 'k':
token_table_flag = true; token_table_flag = true;
break; break;
@@ -563,35 +576,22 @@ getargs (int argc, char *argv[])
FLAGS_ARGMATCH (report, optarg); FLAGS_ARGMATCH (report, optarg);
break; break;
case REPORT_FILE_OPTION:
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;
case 'T':
FLAGS_ARGMATCH (trace, optarg);
break;
case 't': case 't':
debug_flag = true; debug_flag = true;
break; break;
case 'V':
version ();
exit (EXIT_SUCCESS);
case 'v': case 'v':
report_flag |= report_states; report_flag |= report_states;
break; break;
case 'y': case 'x':
yacc_flag = true; xml_flag = true;
if (optarg)
spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
break; break;
case 'W': case 'y':
if (optarg) yacc_flag = true;
FLAGS_ARGMATCH (warnings, optarg);
else
warnings_flag |= warnings_all;
break; break;
case LOCATIONS_OPTION: case LOCATIONS_OPTION:
@@ -606,6 +606,10 @@ getargs (int argc, char *argv[])
printf ("%s\n", compute_pkgdatadir ()); printf ("%s\n", compute_pkgdatadir ());
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
case REPORT_FILE_OPTION:
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;
default: default:
usage (EXIT_FAILURE); usage (EXIT_FAILURE);
} }