-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 invocation.
* 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.
* 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.
This commit is contained in:
Joel E. Denny
2009-05-22 17:14:08 -04:00
parent 246c4efafe
commit 34d4193815
11 changed files with 277 additions and 163 deletions

View File

@@ -1,3 +1,26 @@
2009-05-22 Joel E. Denny <jdenny@ces.clemson.edu>
-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 invocation.
* 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.
* 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.
2009-05-22 Joel E. Denny <jdenny@ces.clemson.edu> 2009-05-22 Joel E. Denny <jdenny@ces.clemson.edu>
Update some comments to make sense for -D. Update some comments to make sense for -D.

17
NEWS
View File

@@ -35,17 +35,22 @@ Bison News
** %define can now be invoked via the command line. ** %define can now be invoked via the command line.
Each of these bison command-line options Each of these command-line options
-D NAME=VALUE -D NAME[=VALUE]
--define=NAME=VALUE --define=NAME[=VALUE]
-F NAME[=VALUE]
--force-define=NAME[=VALUE]
is equivalent to this grammar file declaration is equivalent to this grammar file declaration
%define NAME "VALUE" %define NAME ["VALUE"]
for any NAME and VALUE. Omitting `=VALUE' on the command line is except that the manner in which Bison processes multiple definitions
equivalent to omitting `"VALUE"' in the declaration. for the same NAME differs. Most importantly, -F and --force-define
quietly override %define, but -D and --define do not. For further
details, see the section "Bison Options" in the Bison manual.
** %define variables renamed. ** %define variables renamed.

View File

@@ -22,7 +22,11 @@ while (<STDIN>)
$short = '' if ! defined $short; $short = '' if ! defined $short;
$short = '-d' if $long eq '--defines' && ! $short; $short = '-d' if $long eq '--defines' && ! $short;
my $dir = '%' . substr($long, 2); my $dir = '%' . substr($long, 2);
$dir = '' if index ($scanner, "\"$dir\"") < 0; if (index ($scanner, "\"$dir\"") < 0)
{
if ($long eq '--force-define') { $dir = '%define'; }
else { $dir = ''; }
}
if ($arg) if ($arg)
{ {
# if $opt, $arg contains the closing ]. # if $opt, $arg contains the closing ].

View File

@@ -4837,7 +4837,8 @@ The possible choices for @var{variable}, as well as their meanings, depend on
the selected target language and/or the parser skeleton (@pxref{Decl the selected target language and/or the parser skeleton (@pxref{Decl
Summary,,%language}, @pxref{Decl Summary,,%skeleton}). Summary,,%language}, @pxref{Decl Summary,,%skeleton}).
Bison will warn if a @var{variable} is defined multiple times. Bison will warn if a @var{variable} is defined by @code{%define}
multiple times, but @ref{Bison Options,,-D @var{name}[=@var{value}]}.
Omitting @code{"@var{value}"} is always equivalent to specifying it as Omitting @code{"@var{value}"} is always equivalent to specifying it as
@code{""}. @code{""}.
@@ -7982,8 +7983,29 @@ already defined, so that the debugging facilities are compiled.
@item -D @var{name}[=@var{value}] @item -D @var{name}[=@var{value}]
@itemx --define=@var{name}[=@var{value}] @itemx --define=@var{name}[=@var{value}]
Same as running @samp{%define @var{name} "@var{value}"} (@pxref{Decl @item -F @var{name}[=@var{value}]
Summary, ,%define}). @itemx --force-define=@var{name}[=@var{value}]
Each of these is equivalent to @samp{%define @var{name} "@var{value}"}
(@pxref{Decl Summary, ,%define}) except that Bison processes multiple
definitions for the same @var{name} as follows:
@itemize
@item
Bison processes all command-line definitions in order and then processes
all @code{%define} definitions in order.
@item
Later definitions override earlier definitions except that Bison quietly
ignores all @code{%define} definitions if the last command-line
definition is specified by @code{-F} or @code{--force-define}.
@item
Bison never warns when a command-line definition overrides another
definition, but Bison always warns when a @code{%define} definition
overrides a command-line or @code{%define} definition.
@end itemize
You should avoid using @code{-F} and @code{--force-define} in your
makefiles unless you are confident that it is safe to quietly ignore any
conflicting @code{%define} that may be added to the grammar file.
@item -L @var{language} @item -L @var{language}
@itemx --language=@var{language} @itemx --language=@var{language}
@@ -8109,9 +8131,9 @@ More user feedback will help to stabilize it.)
@section Option Cross Key @section Option Cross Key
Here is a list of options, alphabetized by long option, to help you find Here is a list of options, alphabetized by long option, to help you find
the corresponding short option. the corresponding short option and directive.
@multitable {@option{--defines=@var{defines-file}}} {@option{-D @var{name}[=@var{value}]}} {@code{%nondeterministic-parser}} @multitable {@option{--force-define=@var{name}[=@var{value}]}} {@option{-F @var{name}[=@var{value}]}} {@code{%nondeterministic-parser}}
@headitem Long Option @tab Short Option @tab Bison Directive @headitem Long Option @tab Short Option @tab Bison Directive
@include cross-options.texi @include cross-options.texi
@end multitable @end multitable

View File

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

View File

@@ -401,12 +401,14 @@ do { \
void void
muscle_percent_define_insert (char const *variable, location variable_loc, muscle_percent_define_insert (char const *variable, location variable_loc,
char const *value) char const *value,
muscle_percent_define_how how)
{ {
char *variable_tr = NULL; char *variable_tr = NULL;
char const *name; char const *name;
char const *loc_name; char const *loc_name;
char const *syncline_name; char const *syncline_name;
char const *how_name;
/* Permit certain names with underscores for backward compatibility. */ /* Permit certain names with underscores for backward compatibility. */
if (0 == strcmp (variable, "api.push_pull") if (0 == strcmp (variable, "api.push_pull")
@@ -421,22 +423,33 @@ muscle_percent_define_insert (char const *variable, location variable_loc,
MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")"); MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")");
MUSCLE_USER_NAME_CONVERT (syncline_name, MUSCLE_USER_NAME_CONVERT (syncline_name,
"percent_define_syncline(", variable, ")"); "percent_define_syncline(", variable, ")");
MUSCLE_USER_NAME_CONVERT (how_name, "percent_define_how(", variable, ")");
if (muscle_find_const (name)) /* Command-line options are processed before the grammar file. */
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
&& muscle_find_const (name))
{ {
muscle_percent_define_how how_old =
atoi (muscle_find_const (how_name));
if (how_old == MUSCLE_PERCENT_DEFINE_F)
{
free (variable_tr);
return;
}
warn_at (variable_loc, _("%s `%s' redefined"), warn_at (variable_loc, _("%s `%s' redefined"),
"%define variable", variable); "%define variable", variable);
warn_at (muscle_percent_define_get_loc (variable), warn_at (muscle_percent_define_get_loc (variable),
_("previous definition")); _("previous definition"));
} }
MUSCLE_INSERT_STRING (name, value);
MUSCLE_INSERT_STRING (name, value);
muscle_insert (loc_name, ""); muscle_insert (loc_name, "");
muscle_location_grow (loc_name, variable_loc); muscle_location_grow (loc_name, variable_loc);
muscle_insert (syncline_name, ""); muscle_insert (syncline_name, "");
muscle_syncline_grow (syncline_name, variable_loc); muscle_syncline_grow (syncline_name, variable_loc);
muscle_user_name_list_grow ("percent_define_user_variables", variable, muscle_user_name_list_grow ("percent_define_user_variables", variable,
variable_loc); variable_loc);
MUSCLE_INSERT_INT (how_name, how);
free (variable_tr); free (variable_tr);
} }

View File

@@ -123,12 +123,25 @@ void muscle_boundary_grow (char const *key, boundary bound);
void muscle_user_name_list_grow (char const *key, char const *user_name, void muscle_user_name_list_grow (char const *key, char const *user_name,
location loc); location loc);
/* Define the muscle for the %define variable VARIABLE appearing at /* Indicates whether a variable's value was specified with -D/--define, with
VARIABLE_LOC with value VALUE. Warn if VARIABLE is already defined. -F/--force-define, or in the grammar file. */
Record this as a user occurrence of VARIABLE by invoking typedef enum {
MUSCLE_PERCENT_DEFINE_D = 0, MUSCLE_PERCENT_DEFINE_F,
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
} muscle_percent_define_how;
/* Define the muscles for %define variable VARIABLE with VALUE specified
at VARIABLE_LOC in the manner HOW unless it was specified in the
grammar file while the previous definition for VARIABLE was specified
with -F/--force-define. Warn if a previous definition is being
overridden and the new definition is specified in the grammar file.
(These rules support the documented behavior as long as command-line
definitions are processed before grammar file definitions.) Record
this as a user occurrence of VARIABLE by invoking
muscle_user_name_list_grow. */ muscle_user_name_list_grow. */
void muscle_percent_define_insert (char const *variable, location variable_loc, void muscle_percent_define_insert (char const *variable, location variable_loc,
char const *value); char const *value,
muscle_percent_define_how how);
/* Mimic b4_percent_define_get in ../data/bison.m4 exactly. That is, if the /* Mimic b4_percent_define_get in ../data/bison.m4 exactly. That is, if the
%define variable VARIABLE is defined, return its value. Otherwise, return %define variable VARIABLE is defined, return its value. Otherwise, return

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.4.1.57-1d0f-dirty. */ /* A Bison parser, made by GNU Bison 2.4.1.71-377d. */
/* Skeleton implementation for Bison's Yacc-like parsers in C /* Skeleton implementation for Bison's Yacc-like parsers in C
@@ -45,7 +45,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.4.1.57-1d0f-dirty" #define YYBISON_VERSION "2.4.1.71-377d"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@@ -663,17 +663,17 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 202, 202, 210, 212, 216, 217, 227, 228, 232, 0, 202, 202, 210, 212, 216, 217, 227, 228, 233,
233, 238, 239, 240, 241, 242, 243, 248, 257, 258, 234, 239, 240, 241, 242, 243, 244, 249, 258, 259,
259, 260, 261, 262, 263, 264, 265, 266, 267, 280, 260, 261, 262, 263, 264, 265, 266, 267, 268, 283,
281, 305, 306, 307, 308, 312, 313, 314, 318, 325, 284, 308, 309, 310, 311, 315, 316, 317, 321, 328,
332, 336, 340, 347, 362, 363, 367, 379, 379, 384, 335, 339, 343, 350, 365, 366, 370, 382, 382, 387,
384, 389, 400, 415, 416, 417, 421, 422, 427, 429, 387, 392, 403, 418, 419, 420, 424, 425, 430, 432,
434, 435, 440, 442, 447, 448, 452, 453, 454, 455, 437, 438, 443, 445, 450, 451, 455, 456, 457, 458,
460, 465, 470, 476, 482, 493, 494, 503, 504, 510, 463, 468, 473, 479, 485, 496, 497, 506, 507, 513,
511, 512, 519, 519, 523, 524, 525, 530, 531, 533, 514, 515, 522, 522, 526, 527, 528, 533, 534, 536,
535, 537, 539, 551, 552, 557, 558, 567, 587, 589, 538, 540, 542, 554, 555, 560, 561, 570, 590, 592,
598, 603, 604, 609, 616, 618 601, 606, 607, 612, 619, 621
}; };
#endif #endif
@@ -1909,21 +1909,22 @@ yyreduce:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 229 "parse-gram.y" #line 229 "parse-gram.y"
{ {
muscle_percent_define_insert ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars)); muscle_percent_define_insert ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars),
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
} }
break; break;
case 9: case 9:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 232 "parse-gram.y" #line 233 "parse-gram.y"
{ defines_flag = true; } { defines_flag = true; }
break; break;
case 10: case 10:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 234 "parse-gram.y" #line 235 "parse-gram.y"
{ {
defines_flag = true; defines_flag = true;
spec_defines_file = xstrdup ((yyvsp[(2) - (2)].chars)); spec_defines_file = xstrdup ((yyvsp[(2) - (2)].chars));
@@ -1933,42 +1934,42 @@ yyreduce:
case 11: case 11:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 238 "parse-gram.y" #line 239 "parse-gram.y"
{ error_verbose = true; } { error_verbose = true; }
break; break;
case 12: case 12:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 239 "parse-gram.y" #line 240 "parse-gram.y"
{ expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); }
break; break;
case 13: case 13:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 240 "parse-gram.y" #line 241 "parse-gram.y"
{ expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); }
break; break;
case 14: case 14:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 241 "parse-gram.y" #line 242 "parse-gram.y"
{ spec_file_prefix = (yyvsp[(2) - (2)].chars); } { spec_file_prefix = (yyvsp[(2) - (2)].chars); }
break; break;
case 15: case 15:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 242 "parse-gram.y" #line 243 "parse-gram.y"
{ spec_file_prefix = (yyvsp[(3) - (3)].chars); } { spec_file_prefix = (yyvsp[(3) - (3)].chars); }
break; break;
case 16: case 16:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 244 "parse-gram.y" #line 245 "parse-gram.y"
{ {
nondeterministic_parser = true; nondeterministic_parser = true;
glr_parser = true; glr_parser = true;
@@ -1978,7 +1979,7 @@ yyreduce:
case 17: case 17:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 249 "parse-gram.y" #line 250 "parse-gram.y"
{ {
code_props action; code_props action;
code_props_symbol_action_init (&action, (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); code_props_symbol_action_init (&action, (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)]));
@@ -1992,102 +1993,104 @@ yyreduce:
case 18: case 18:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 257 "parse-gram.y" #line 258 "parse-gram.y"
{ language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, (yylsp[(1) - (2)])); } { language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, (yylsp[(1) - (2)])); }
break; break;
case 19: case 19:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 258 "parse-gram.y" #line 259 "parse-gram.y"
{ add_param ("lex_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } { add_param ("lex_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break; break;
case 20: case 20:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 259 "parse-gram.y" #line 260 "parse-gram.y"
{ locations_flag = true; } { locations_flag = true; }
break; break;
case 21: case 21:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 260 "parse-gram.y" #line 261 "parse-gram.y"
{ spec_name_prefix = (yyvsp[(2) - (2)].chars); } { spec_name_prefix = (yyvsp[(2) - (2)].chars); }
break; break;
case 22: case 22:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 261 "parse-gram.y" #line 262 "parse-gram.y"
{ spec_name_prefix = (yyvsp[(3) - (3)].chars); } { spec_name_prefix = (yyvsp[(3) - (3)].chars); }
break; break;
case 23: case 23:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 262 "parse-gram.y" #line 263 "parse-gram.y"
{ no_lines_flag = true; } { no_lines_flag = true; }
break; break;
case 24: case 24:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 263 "parse-gram.y" #line 264 "parse-gram.y"
{ nondeterministic_parser = true; } { nondeterministic_parser = true; }
break; break;
case 25: case 25:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 264 "parse-gram.y" #line 265 "parse-gram.y"
{ spec_outfile = (yyvsp[(2) - (2)].chars); } { spec_outfile = (yyvsp[(2) - (2)].chars); }
break; break;
case 26: case 26:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 265 "parse-gram.y" #line 266 "parse-gram.y"
{ spec_outfile = (yyvsp[(3) - (3)].chars); } { spec_outfile = (yyvsp[(3) - (3)].chars); }
break; break;
case 27: case 27:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 266 "parse-gram.y" #line 267 "parse-gram.y"
{ add_param ("parse_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } { add_param ("parse_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break; break;
case 28: case 28:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 268 "parse-gram.y" #line 269 "parse-gram.y"
{ {
/* %pure-parser is deprecated in favor of `%define api.pure', so use /* %pure-parser is deprecated in favor of `%define api.pure', so use
`%define api.pure' in a backward-compatible manner here. First, don't `%define api.pure' in a backward-compatible manner here. First, don't
complain if %pure-parser is specified multiple times. */ complain if %pure-parser is specified multiple times. */
if (!muscle_find_const ("percent_define(api.pure)")) if (!muscle_find_const ("percent_define(api.pure)"))
muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), ""); muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), "",
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
/* In all cases, use api.pure now so that the backend doesn't complain if /* In all cases, use api.pure now so that the backend doesn't complain if
the skeleton ignores api.pure, but do warn now if there's a previous the skeleton ignores api.pure, but do warn now if there's a previous
conflicting definition from an actual %define. */ conflicting definition from an actual %define. */
if (!muscle_percent_define_flag_if ("api.pure")) if (!muscle_percent_define_flag_if ("api.pure"))
muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), ""); muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), "",
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
} }
break; break;
case 29: case 29:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 280 "parse-gram.y" #line 283 "parse-gram.y"
{ version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
break; break;
case 30: case 30:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 282 "parse-gram.y" #line 285 "parse-gram.y"
{ {
char const *skeleton_user = (yyvsp[(2) - (2)].chars); char const *skeleton_user = (yyvsp[(2) - (2)].chars);
if (strchr (skeleton_user, '/')) if (strchr (skeleton_user, '/'))
@@ -2116,28 +2119,28 @@ yyreduce:
case 31: case 31:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 305 "parse-gram.y" #line 308 "parse-gram.y"
{ token_table_flag = true; } { token_table_flag = true; }
break; break;
case 32: case 32:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 306 "parse-gram.y" #line 309 "parse-gram.y"
{ report_flag |= report_states; } { report_flag |= report_states; }
break; break;
case 33: case 33:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 307 "parse-gram.y" #line 310 "parse-gram.y"
{ yacc_flag = true; } { yacc_flag = true; }
break; break;
case 37: case 37:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 315 "parse-gram.y" #line 318 "parse-gram.y"
{ {
grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]));
} }
@@ -2146,7 +2149,7 @@ yyreduce:
case 38: case 38:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 319 "parse-gram.y" #line 322 "parse-gram.y"
{ {
symbol_list *list; symbol_list *list;
for (list = (yyvsp[(3) - (3)].list); list; list = list->next) for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -2158,7 +2161,7 @@ yyreduce:
case 39: case 39:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 326 "parse-gram.y" #line 329 "parse-gram.y"
{ {
symbol_list *list; symbol_list *list;
for (list = (yyvsp[(3) - (3)].list); list; list = list->next) for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -2170,7 +2173,7 @@ yyreduce:
case 40: case 40:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 333 "parse-gram.y" #line 336 "parse-gram.y"
{ {
default_prec = true; default_prec = true;
} }
@@ -2179,7 +2182,7 @@ yyreduce:
case 41: case 41:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 337 "parse-gram.y" #line 340 "parse-gram.y"
{ {
default_prec = false; default_prec = false;
} }
@@ -2188,7 +2191,7 @@ yyreduce:
case 42: case 42:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 341 "parse-gram.y" #line 344 "parse-gram.y"
{ {
/* Do not invoke muscle_percent_code_grow here since it invokes /* Do not invoke muscle_percent_code_grow here since it invokes
muscle_user_name_list_grow. */ muscle_user_name_list_grow. */
@@ -2200,7 +2203,7 @@ yyreduce:
case 43: case 43:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 348 "parse-gram.y" #line 351 "parse-gram.y"
{ {
muscle_percent_code_grow ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)])); muscle_percent_code_grow ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
code_scanner_last_string_free (); code_scanner_last_string_free ();
@@ -2210,21 +2213,21 @@ yyreduce:
case 44: case 44:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 362 "parse-gram.y" #line 365 "parse-gram.y"
{} {}
break; break;
case 45: case 45:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 363 "parse-gram.y" #line 366 "parse-gram.y"
{ muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } { muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break; break;
case 46: case 46:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 368 "parse-gram.y" #line 371 "parse-gram.y"
{ {
union_seen = true; union_seen = true;
muscle_code_grow ("stype", (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)])); muscle_code_grow ("stype", (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
@@ -2235,14 +2238,14 @@ yyreduce:
case 47: case 47:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 379 "parse-gram.y" #line 382 "parse-gram.y"
{ current_class = nterm_sym; } { current_class = nterm_sym; }
break; break;
case 48: case 48:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 380 "parse-gram.y" #line 383 "parse-gram.y"
{ {
current_class = unknown_sym; current_class = unknown_sym;
current_type = NULL; current_type = NULL;
@@ -2252,14 +2255,14 @@ yyreduce:
case 49: case 49:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 384 "parse-gram.y" #line 387 "parse-gram.y"
{ current_class = token_sym; } { current_class = token_sym; }
break; break;
case 50: case 50:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 385 "parse-gram.y" #line 388 "parse-gram.y"
{ {
current_class = unknown_sym; current_class = unknown_sym;
current_type = NULL; current_type = NULL;
@@ -2269,7 +2272,7 @@ yyreduce:
case 51: case 51:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 390 "parse-gram.y" #line 393 "parse-gram.y"
{ {
symbol_list *list; symbol_list *list;
tag_seen = true; tag_seen = true;
@@ -2282,7 +2285,7 @@ yyreduce:
case 52: case 52:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 401 "parse-gram.y" #line 404 "parse-gram.y"
{ {
symbol_list *list; symbol_list *list;
++current_prec; ++current_prec;
@@ -2299,126 +2302,126 @@ yyreduce:
case 53: case 53:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 415 "parse-gram.y" #line 418 "parse-gram.y"
{ (yyval.assoc) = left_assoc; } { (yyval.assoc) = left_assoc; }
break; break;
case 54: case 54:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 416 "parse-gram.y" #line 419 "parse-gram.y"
{ (yyval.assoc) = right_assoc; } { (yyval.assoc) = right_assoc; }
break; break;
case 55: case 55:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 417 "parse-gram.y" #line 420 "parse-gram.y"
{ (yyval.assoc) = non_assoc; } { (yyval.assoc) = non_assoc; }
break; break;
case 56: case 56:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 421 "parse-gram.y" #line 424 "parse-gram.y"
{ current_type = NULL; } { current_type = NULL; }
break; break;
case 57: case 57:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 422 "parse-gram.y" #line 425 "parse-gram.y"
{ current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; } { current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; }
break; break;
case 58: case 58:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 428 "parse-gram.y" #line 431 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break; break;
case 59: case 59:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 430 "parse-gram.y" #line 433 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); } { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
break; break;
case 60: case 60:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 434 "parse-gram.y" #line 437 "parse-gram.y"
{ (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
break; break;
case 61: case 61:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 435 "parse-gram.y" #line 438 "parse-gram.y"
{ (yyval.symbol) = (yyvsp[(1) - (2)].symbol); symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); } { (yyval.symbol) = (yyvsp[(1) - (2)].symbol); symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); }
break; break;
case 62: case 62:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 441 "parse-gram.y" #line 444 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break; break;
case 63: case 63:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 443 "parse-gram.y" #line 446 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); } { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
break; break;
case 64: case 64:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 447 "parse-gram.y" #line 450 "parse-gram.y"
{ (yyval.list) = (yyvsp[(1) - (1)].list); } { (yyval.list) = (yyvsp[(1) - (1)].list); }
break; break;
case 65: case 65:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 448 "parse-gram.y" #line 451 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); } { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); }
break; break;
case 66: case 66:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 452 "parse-gram.y" #line 455 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break; break;
case 67: case 67:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 453 "parse-gram.y" #line 456 "parse-gram.y"
{ (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } { (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break; break;
case 68: case 68:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 454 "parse-gram.y" #line 457 "parse-gram.y"
{ (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); } { (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); }
break; break;
case 69: case 69:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 455 "parse-gram.y" #line 458 "parse-gram.y"
{ (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); } { (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); }
break; break;
case 70: case 70:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 461 "parse-gram.y" #line 464 "parse-gram.y"
{ {
current_type = (yyvsp[(1) - (1)].uniqstr); current_type = (yyvsp[(1) - (1)].uniqstr);
tag_seen = true; tag_seen = true;
@@ -2428,7 +2431,7 @@ yyreduce:
case 71: case 71:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 466 "parse-gram.y" #line 469 "parse-gram.y"
{ {
symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true); symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)])); symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
@@ -2438,7 +2441,7 @@ yyreduce:
case 72: case 72:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 471 "parse-gram.y" #line 474 "parse-gram.y"
{ {
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
@@ -2449,7 +2452,7 @@ yyreduce:
case 73: case 73:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 477 "parse-gram.y" #line 480 "parse-gram.y"
{ {
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
@@ -2460,7 +2463,7 @@ yyreduce:
case 74: case 74:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 483 "parse-gram.y" #line 486 "parse-gram.y"
{ {
symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true); symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)])); symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
@@ -2472,7 +2475,7 @@ yyreduce:
case 81: case 81:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 513 "parse-gram.y" #line 516 "parse-gram.y"
{ {
yyerrok; yyerrok;
} }
@@ -2481,84 +2484,84 @@ yyreduce:
case 82: case 82:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 519 "parse-gram.y" #line 522 "parse-gram.y"
{ current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); } { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
break; break;
case 84: case 84:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 523 "parse-gram.y" #line 526 "parse-gram.y"
{ grammar_current_rule_end ((yylsp[(1) - (1)])); } { grammar_current_rule_end ((yylsp[(1) - (1)])); }
break; break;
case 85: case 85:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 524 "parse-gram.y" #line 527 "parse-gram.y"
{ grammar_current_rule_end ((yylsp[(3) - (3)])); } { grammar_current_rule_end ((yylsp[(3) - (3)])); }
break; break;
case 87: case 87:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 530 "parse-gram.y" #line 533 "parse-gram.y"
{ grammar_current_rule_begin (current_lhs, current_lhs_location); } { grammar_current_rule_begin (current_lhs, current_lhs_location); }
break; break;
case 88: case 88:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 532 "parse-gram.y" #line 535 "parse-gram.y"
{ grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
break; break;
case 89: case 89:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 534 "parse-gram.y" #line 537 "parse-gram.y"
{ grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } { grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break; break;
case 90: case 90:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 536 "parse-gram.y" #line 539 "parse-gram.y"
{ grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
break; break;
case 91: case 91:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 538 "parse-gram.y" #line 541 "parse-gram.y"
{ grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
break; break;
case 92: case 92:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 540 "parse-gram.y" #line 543 "parse-gram.y"
{ grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
break; break;
case 94: case 94:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 552 "parse-gram.y" #line 555 "parse-gram.y"
{ (yyval.uniqstr) = uniqstr_new ((yyvsp[(1) - (1)].chars)); } { (yyval.uniqstr) = uniqstr_new ((yyvsp[(1) - (1)].chars)); }
break; break;
case 95: case 95:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 557 "parse-gram.y" #line 560 "parse-gram.y"
{ (yyval.chars) = ""; } { (yyval.chars) = ""; }
break; break;
case 97: case 97:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 568 "parse-gram.y" #line 571 "parse-gram.y"
{ {
code_props plain_code; code_props plain_code;
(yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n'; (yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n';
@@ -2572,14 +2575,14 @@ yyreduce:
case 98: case 98:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 588 "parse-gram.y" #line 591 "parse-gram.y"
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break; break;
case 99: case 99:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 590 "parse-gram.y" #line 593 "parse-gram.y"
{ {
(yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)])); (yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)]));
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
@@ -2590,14 +2593,14 @@ yyreduce:
case 100: case 100:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 598 "parse-gram.y" #line 601 "parse-gram.y"
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break; break;
case 103: case 103:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 610 "parse-gram.y" #line 613 "parse-gram.y"
{ {
(yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)])); (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
@@ -2607,7 +2610,7 @@ yyreduce:
case 105: case 105:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 619 "parse-gram.y" #line 622 "parse-gram.y"
{ {
code_props plain_code; code_props plain_code;
code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)]));
@@ -2621,7 +2624,7 @@ yyreduce:
/* Line 1456 of yacc.c */ /* Line 1456 of yacc.c */
#line 2625 "parse-gram.c" #line 2628 "parse-gram.c"
default: break; default: break;
} }
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2840,7 +2843,7 @@ yyreturn:
/* Line 1676 of yacc.c */ /* Line 1676 of yacc.c */
#line 629 "parse-gram.y" #line 632 "parse-gram.y"

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.4.1.57-1d0f-dirty. */ /* A Bison parser, made by GNU Bison 2.4.1.71-377d. */
/* Skeleton interface for Bison's Yacc-like parsers in C /* Skeleton interface for Bison's Yacc-like parsers in C

View File

@@ -227,7 +227,8 @@ prologue_declaration:
| "%debug" { debug_flag = true; } | "%debug" { debug_flag = true; }
| "%define" variable content.opt | "%define" variable content.opt
{ {
muscle_percent_define_insert ($2, @2, $3); muscle_percent_define_insert ($2, @2, $3,
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
} }
| "%defines" { defines_flag = true; } | "%defines" { defines_flag = true; }
| "%defines" STRING | "%defines" STRING
@@ -270,12 +271,14 @@ prologue_declaration:
`%define api.pure' in a backward-compatible manner here. First, don't `%define api.pure' in a backward-compatible manner here. First, don't
complain if %pure-parser is specified multiple times. */ complain if %pure-parser is specified multiple times. */
if (!muscle_find_const ("percent_define(api.pure)")) if (!muscle_find_const ("percent_define(api.pure)"))
muscle_percent_define_insert ("api.pure", @1, ""); muscle_percent_define_insert ("api.pure", @1, "",
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
/* In all cases, use api.pure now so that the backend doesn't complain if /* In all cases, use api.pure now so that the backend doesn't complain if
the skeleton ignores api.pure, but do warn now if there's a previous the skeleton ignores api.pure, but do warn now if there's a previous
conflicting definition from an actual %define. */ conflicting definition from an actual %define. */
if (!muscle_percent_define_flag_if ("api.pure")) if (!muscle_percent_define_flag_if ("api.pure"))
muscle_percent_define_insert ("api.pure", @1, ""); muscle_percent_define_insert ("api.pure", @1, "",
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
} }
| "%require" STRING { version_check (&@2, $2); } | "%require" STRING { version_check (&@2, $2); }
| "%skeleton" STRING | "%skeleton" STRING

View File

@@ -918,27 +918,49 @@ input.y:5.9-16: warning: %define variable `special2' is not used
AT_CLEANUP AT_CLEANUP
## ------------------- ## ## ----------------------------------- ##
## %define, --define. ## ## %define, --define, --force-define. ##
## ------------------- ## ## ----------------------------------- ##
AT_SETUP([%define, --define]) AT_SETUP([%define, --define, --force-define])
AT_DATA([skel.c],
[[m4@&t@_divert_push(0)@
@output(b4_parser_file_name@)@
[var-dd: ]b4_percent_define_get([[var-dd]])[
var-ff: ]b4_percent_define_get([[var-ff]])[
var-dg: ]b4_percent_define_get([[var-dg]])[
var-dfg: ]b4_percent_define_get([[var-dfg]])[
var-fd: ]b4_percent_define_get([[var-fd]])
m4@&t@_divert_pop(0)
]])
AT_DATA([input.y], AT_DATA([input.y],
[[%define var "value1" [[%define var-dg "gram"
%define var-dfg "gram"
%% %%
start: ; start: ;
]]) ]])
AT_BISON_CHECK([[-DFOO -DFOO -Dvar=value input.y]], [0], [], AT_BISON_CHECK([[-Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \
[[<command line>:3: warning: %define variable `FOO' redefined -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \
<command line>:2: warning: previous definition -Dvar-dg=cmd-d \
input.y:1.9-11: warning: %define variable `var' redefined -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \
<command line>:4: warning: previous definition -Fvar-fd=cmd-f -Dvar-fd=cmd-d \
<command line>:2: warning: %define variable `FOO' is not used -Dunused-d -Funused-f \
<command line>:3: warning: %define variable `FOO' is not used --skeleton ./skel.c input.y]], [0], [],
<command line>:4: warning: %define variable `var' is not used [[input.y:1.9-14: warning: %define variable `var-dg' redefined
input.y:1.9-11: warning: %define variable `var' is not used <command line>:6: warning: previous definition
<command line>:11: warning: %define variable `unused-d' is not used
<command line>:12: warning: %define variable `unused-f' is not used
]])
AT_CHECK([[cat input.tab.c]], [[0]],
[[var-dd: cmd-d2
var-ff: cmd-f2
var-dg: gram
var-dfg: cmd-f
var-fd: cmd-d
]]) ]])
AT_CLEANUP AT_CLEANUP