Replace %push-parser' and %push-pull-parser' with

`%define push_pull "push"' and `%define push_pull "both"'.
`%define push_pull "pull"' is the default.
* doc/bison.texinfo (Push Decl, Push Parser Function,
Pull Parser Function, Parser Create Function, Parser Delete Function):
Update declarations.
(Decl Summary, Table of Symbols): Replace %push-parser and
%push-pull-parser entries with a %define push_pull entry.
* data/bison.m4 (b4_percent_define_check_values): New macro.
(b4_pull_if, b4_push_if, b4_use_push_for_pull_if): Move these
definitions...
* data/c.m4 (b4_identification): ... and the YYPUSH and YYPULL cpp
definitions...
* data/push.c: ... to here and compute them from the value of the
%define variable push_pull.
* data/c-skel.m4: Instead of choosing the push.c skeleton for push
parsing requests here...
* data/yacc.c: ... hack this to switch to push.c any time
b4_use_push_pull_flag or the %define variable push_pull is set.  This
will go away when we mv push.c yacc.c.
* data/c++-skel.m4, data/glr.c, data/java-skel.m4: Don't report that
push parsing is not supported since unused %define variables are
reported anyway.
* src/getargs.c, src/getargs.h (pull_parser, push_parser): Remove.
* src/muscle_tab.h (muscle_percent_define_check_values): Update
comments for consistency with b4_percent_define_check_values.
* src/output.c (prepare): Don't insert b4_pull_flag and b4_push_flag
muscles.
* src/parse-gram.y (PERCENT_PUSH_PARSER, PERCENT_PUSH_PULL_PARSER):
Remove.
(prologue_declaration): Remove %push-parser and %push-pull-parser
rules.
* src/scan-gram.l (%push-parser, %push-pull-parser): Remove rules.
* tests/calc.at: Update declarations.
* tests/input.at (%define enum variables): New test case.
* tests/push.at (Push Parsing: Memory Leak for Early Deletion): Update
declaration.
(Push Parsing: Multiple impure instances): Update declaration.
(Push Parsing: Unsupported Skeletons): New test case.
* tests/torture.at (Exploding the Stack Size with Alloca): Update
declaration.
(Exploding the Stack Size with Malloc): Update declaration.
This commit is contained in:
Joel E. Denny
2007-09-25 05:47:27 +00:00
parent 3f999f78be
commit d782395d52
22 changed files with 771 additions and 713 deletions

View File

@@ -58,9 +58,7 @@ bool error_verbose = false;
bool nondeterministic_parser = false;
bool glr_parser = false;
bool pull_parser = true;
bool pure_parser = false;
bool push_parser = false;
int report_flag = report_none;
int trace_flag = trace_none;

View File

@@ -51,19 +51,11 @@ extern bool error_verbose;
extern bool glr_parser;
/* PULL_PARSER is true if should generate a pull parser. */
extern bool pull_parser;
/* PURE_PARSER is true if should generate a parser that is all pure
and reentrant. */
extern bool pure_parser;
/* PUSH_PARSER is true if should generate a push parser. */
extern bool push_parser;
/* NONDETERMINISTIC_PARSER is true iff conflicts are accepted. This
is used by the GLR parser, and might be used in BackTracking
parsers too. */

View File

@@ -156,15 +156,17 @@ bool muscle_percent_define_flag_if (char const *variable);
suspect that the value has yet influenced the output. */
void muscle_percent_define_default (char const *variable, char const *value);
/* VALUES points to a sequence of strings that is partitioned into
subsequences by NULL's, one terminating each subsequence. The last
subsequence is followed by a second NULL. For each subsequence, the first
string is the name of a %define variable, and all remaining strings in that
subsequence are the valid values for that variable. Complain if such a
variable is undefined (a Bison error since the default value should have
been set already) or defined to any other value (possibly a user error).
Don't record this as a Bison usage of the variable as there's no reason to
suspect that the value has yet influenced the output. */
/* Mimic b4_percent_define_check_values in ../data/bison.m4 exactly except that
the VALUES structure is more appropriate for C. That is, VALUES points to a
list of strings that is partitioned into sublists by NULL's, one terminating
each sublist. The last sublist is followed by a second NULL. For each
sublist, the first string is the name of a %define variable, and all
remaining strings in that sublist are the valid values for that variable.
Complain if such a variable is undefined (a Bison error since the default
value should have been set already) or defined to any other value (possibly
a user error). Don't record this as a Bison usage of the variable as
there's no reason to suspect that the value has yet influenced the
output. */
void muscle_percent_define_check_values (char const * const *values);
/* Grow the muscle for the %code qualifier QUALIFIER appearing at QUALIFIER_LOC

View File

@@ -571,9 +571,7 @@ prepare (void)
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
MUSCLE_INSERT_BOOL ("pull_flag", pull_parser);
MUSCLE_INSERT_BOOL ("pure_flag", pure_parser);
MUSCLE_INSERT_BOOL ("push_flag", push_parser);
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);

File diff suppressed because it is too large Load Diff

View File

@@ -74,28 +74,26 @@
PERCENT_OUTPUT = 289,
PERCENT_PARSE_PARAM = 290,
PERCENT_PURE_PARSER = 291,
PERCENT_PUSH_PARSER = 292,
PERCENT_PUSH_PULL_PARSER = 293,
PERCENT_REQUIRE = 294,
PERCENT_SKELETON = 295,
PERCENT_START = 296,
PERCENT_TOKEN_TABLE = 297,
PERCENT_VERBOSE = 298,
PERCENT_YACC = 299,
BRACED_CODE = 300,
CHAR = 301,
EPILOGUE = 302,
EQUAL = 303,
ID = 304,
ID_COLON = 305,
PERCENT_PERCENT = 306,
PIPE = 307,
PROLOGUE = 308,
SEMICOLON = 309,
TYPE = 310,
TYPE_TAG_ANY = 311,
TYPE_TAG_NONE = 312,
PERCENT_UNION = 313
PERCENT_REQUIRE = 292,
PERCENT_SKELETON = 293,
PERCENT_START = 294,
PERCENT_TOKEN_TABLE = 295,
PERCENT_VERBOSE = 296,
PERCENT_YACC = 297,
BRACED_CODE = 298,
CHAR = 299,
EPILOGUE = 300,
EQUAL = 301,
ID = 302,
ID_COLON = 303,
PERCENT_PERCENT = 304,
PIPE = 305,
PROLOGUE = 306,
SEMICOLON = 307,
TYPE = 308,
TYPE_TAG_ANY = 309,
TYPE_TAG_NONE = 310,
PERCENT_UNION = 311
};
#endif
/* Tokens. */
@@ -134,28 +132,26 @@
#define PERCENT_OUTPUT 289
#define PERCENT_PARSE_PARAM 290
#define PERCENT_PURE_PARSER 291
#define PERCENT_PUSH_PARSER 292
#define PERCENT_PUSH_PULL_PARSER 293
#define PERCENT_REQUIRE 294
#define PERCENT_SKELETON 295
#define PERCENT_START 296
#define PERCENT_TOKEN_TABLE 297
#define PERCENT_VERBOSE 298
#define PERCENT_YACC 299
#define BRACED_CODE 300
#define CHAR 301
#define EPILOGUE 302
#define EQUAL 303
#define ID 304
#define ID_COLON 305
#define PERCENT_PERCENT 306
#define PIPE 307
#define PROLOGUE 308
#define SEMICOLON 309
#define TYPE 310
#define TYPE_TAG_ANY 311
#define TYPE_TAG_NONE 312
#define PERCENT_UNION 313
#define PERCENT_REQUIRE 292
#define PERCENT_SKELETON 293
#define PERCENT_START 294
#define PERCENT_TOKEN_TABLE 295
#define PERCENT_VERBOSE 296
#define PERCENT_YACC 297
#define BRACED_CODE 298
#define CHAR 299
#define EPILOGUE 300
#define EQUAL 301
#define ID 302
#define ID_COLON 303
#define PERCENT_PERCENT 304
#define PIPE 305
#define PROLOGUE 306
#define SEMICOLON 307
#define TYPE 308
#define TYPE_TAG_ANY 309
#define TYPE_TAG_NONE 310
#define PERCENT_UNION 311
@@ -164,7 +160,7 @@
typedef union YYSTYPE
{
/* Line 1535 of yacc.c */
/* Line 1538 of yacc.c */
#line 94 "parse-gram.y"
symbol *symbol;
@@ -178,8 +174,8 @@ typedef union YYSTYPE
/* Line 1535 of yacc.c */
#line 183 "parse-gram.h"
/* Line 1538 of yacc.c */
#line 179 "parse-gram.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

View File

@@ -150,9 +150,6 @@ static int current_prec = 0;
PERCENT_OUTPUT "%output"
PERCENT_PARSE_PARAM "%parse-param"
PERCENT_PURE_PARSER "%pure-parser"
PERCENT_PUSH_PARSER "%push-parser"
PERCENT_PUSH_PULL_PARSER
"%push-pull-parser"
PERCENT_REQUIRE "%require"
PERCENT_SKELETON "%skeleton"
PERCENT_START "%start"
@@ -270,8 +267,6 @@ prologue_declaration:
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
| "%pure-parser" { pure_parser = true; }
| "%push-parser" { push_parser = true; pull_parser = false; }
| "%push-pull-parser" { push_parser = true; pull_parser = true; }
| "%require" STRING { version_check (&@2, $2); }
| "%skeleton" STRING
{

View File

@@ -185,8 +185,6 @@ splice (\\[ \f\t\v]*\n)*
"%prec" return PERCENT_PREC;
"%printer" return PERCENT_PRINTER;
"%pure"[-_]"parser" return PERCENT_PURE_PARSER;
"%push-parser" return PERCENT_PUSH_PARSER;
"%push-pull-parser" return PERCENT_PUSH_PULL_PARSER;
"%require" return PERCENT_REQUIRE;
"%right" return PERCENT_RIGHT;
"%skeleton" return PERCENT_SKELETON;