-F/--force-define and relative %define/-D/--define priorities.

* NEWS (2.5): Add documentation to -D/--define entry.
* build-aux/cross-options.pl: Hard-code association of
--force-define with %define.
* doc/bison.texinfo (Decl Summary): In %define entry,
cross-reference command-line options.
(Bison Options): Add documentation to -D/--define entry.
(Option Cross Key): Widen column for --force-define row.
* src/getargs.c (usage): Document -F/--force-define.  Realign
options in output.
(short_options, long_options, getargs): Parse -F/--force-define,
and update muscle_percent_define_insert invocations.
* src/muscle-tab.h (muscle_percent_define_how): New enum type.
(muscle_percent_define_insert): Add argument with that type.
* src/muscle-tab.c (muscle_percent_define_insert): Implement
-F/--force-define behavior and priorities.
(muscle_percent_define_ensure): Update
muscle_percent_define_insert invocation.
* src/parse-gram.y (prologue_declaration): Update
muscle_percent_define_insert invocations.
* tests/input.at (`%define, --define'): Rename to...
(`%define, --define, --force-define'): ... this and extend.
(cherry picked from commit 34d4193815)

Conflicts:

	src/getargs.c
	src/parse-gram.c
	src/parse-gram.h
	src/parse-gram.y
This commit is contained in:
Joel E. Denny
2009-05-22 17:14:08 -04:00
parent f8e7258f7f
commit de5ab9400a
11 changed files with 356 additions and 241 deletions

View File

@@ -277,27 +277,28 @@ The same is true for optional arguments.\n\
fputs (_("\
\n\
Operation modes:\n\
-h, --help display this help and exit\n\
-V, --version output version information and exit\n\
--print-localedir output directory containing locale-dependent data\n\
--print-datadir output directory containing skeletons and XSLT\n\
-y, --yacc emulate POSIX Yacc\n\
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
-h, --help display this help and exit\n\
-V, --version output version information and exit\n\
--print-localedir output directory of locale-dependent data\n\
--print-datadir output directory of skeletons and XSLT\n\
-y, --yacc emulate POSIX Yacc\n\
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
\n\
"), stdout);
fputs (_("\
Parser:\n\
-L, --language=LANGUAGE specify the output programming language\n\
(this is an experimental feature)\n\
-S, --skeleton=FILE specify the skeleton to use\n\
-t, --debug instrument the parser for tracing\n\
same as `-Dparse.trace'\n\
--locations enable location support\n\
-D, --define=NAME[=VALUE] same as `%define NAME \"VALUE\"'\n\
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
-l, --no-lines don't generate `#line' directives\n\
-k, --token-table include a table of token names\n\
-L, --language=LANGUAGE specify the output programming language\n\
(this is an experimental feature)\n\
-S, --skeleton=FILE specify the skeleton to use\n\
-t, --debug instrument the parser for tracing\n\
same as `-Dparse.trace'\n\
--locations enable location support\n\
-D, --define=NAME[=VALUE] similar to `%define NAME \"VALUE\"'\n\
-F, --force-define=NAME[=VALUE] override `%define NAME \"VALUE\"'\n\
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
-l, --no-lines don't generate `#line' directives\n\
-k, --token-table include a table of token names\n\
\n\
"), stdout);
@@ -305,16 +306,16 @@ Parser:\n\
* won't assume that -d also takes an argument. */
fputs (_("\
Output:\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\
--report-file=FILE write report to FILE\n\
-v, --verbose same as `--report=state'\n\
-b, --file-prefix=PREFIX specify a PREFIX for output files\n\
-o, --output=FILE leave output to FILE\n\
-g, --graph[=FILE] also output a graph of the automaton\n\
-x, --xml[=FILE] also output an XML report of the automaton\n\
(the XML schema is experimental)\n\
--defines[=FILE] also produce a header file\n\
-d likewise but cannot specify FILE (for POSIX)\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\
-b, --file-prefix=PREFIX specify a PREFIX for output files\n\
-o, --output=FILE leave output to FILE\n\
-g, --graph[=FILE] also output a graph of the automaton\n\
-x, --xml[=FILE] also output an XML report of the automaton\n\
(the XML schema is experimental)\n\
\n\
"), stdout);
@@ -421,6 +422,7 @@ language_argmatch (char const *arg, int prio, location loc)
Should be computed from long_options. */
static char const short_options[] =
"D:"
"F:"
"L:"
"S:"
"T::"
@@ -488,6 +490,7 @@ static struct option const long_options[] =
/* Parser. */
{ "debug", no_argument, 0, 't' },
{ "define", required_argument, 0, 'D' },
{ "force-define", required_argument, 0, 'F' },
{ "locations", no_argument, 0, LOCATIONS_OPTION },
{ "no-lines", no_argument, 0, 'l' },
{ "raw", no_argument, 0, 0 },
@@ -536,13 +539,16 @@ getargs (int argc, char *argv[])
break;
case 'D': /* -DNAME[=VALUE]. */
case 'F': /* -FNAME[=VALUE]. */
{
char* name = optarg;
char* value = strchr (optarg, '=');
if (value)
*value++ = 0;
muscle_percent_define_insert (name, command_line_location (),
value ? value : "");
value ? value : "",
c == 'D' ? MUSCLE_PERCENT_DEFINE_D
: MUSCLE_PERCENT_DEFINE_F);
}
break;
@@ -617,7 +623,8 @@ getargs (int argc, char *argv[])
case 't':
muscle_percent_define_insert ("parse.trace",
command_line_location (), "");
command_line_location (), "",
MUSCLE_PERCENT_DEFINE_D);
break;
case 'v':