mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 21:03:04 +00:00
Deprecate %pure-parser and add `%define api.pure'. Discussed starting
at <http://lists.gnu.org/archive/html/bison-patches/2007-09/msg00006.html>. * NEWS (2.3a+): Mention. * data/bison.m4 (b4_pure_if): Don't define it here. * data/c.m4 (b4_identification): Depend on individual skeletons to define b4_pure_flag, b4_push_flag, or b4_pull_flag if they use the values of the %define variables api.pure or api.push_pull. Define YYPURE, YYPUSH, and YYPULL accordingly. * data/glr.c: Define b4_pure_if based on `%define api.pure' unless glr.cc has already defined b4_pure_flag. * data/push.c: Define b4_pure_if based on `%define api.pure'. Remove YYPUSH and YYPULL since they're back in b4_identification again. * data/yacc.c Define b4_pure_if based on `%define api.pure'. * doc/bison.texinfo (Pure Decl): Update. (Push Decl): Update. (Decl Summary): Add api.pure to %define entry. In %pure-parser entry, say it's deprecated and reference %define. (Pure Calling): Update. (Error Reporting): Update. (C++ Scanner Interface): Update. (How Can I Reset the Parser): Update. (Table of Symbols): In %pure-parser entry, say it's deprecated and reference %define. * src/getargs.c (pure_parser): Remove global variable. * src/getargs.h (pure_parser): Remove extern. * src/output.c (prepare): Don't define pure_flag muscle. * src/parse-gram.y (prologue_declaration): Implement %pure-parser as a wrapper around `%define api.pure'. * tests/calc.at (Simple LALR Calculator): Update. (Simple GLR Calculator): Update. * tests/cxx-type.at (GLR: Resolve ambiguity, pure, no locations): Update. (GLR: Resolve ambiguity, pure, locations): Update. (GLR: Merge conflicting parses, pure, no locations): Update. (GLR: Merge conflicting parses, pure, locations): Update. * tests/glr-regression.at (Uninitialized location when reporting ambiguity): Update * tests/input.at (Unused %define api.pure): New test case. * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Update definition for AT_PURE_IF and AT_PURE_AND_LOC_IF. * tests/push.at (Push Parsing: Memory Leak for Early Deletion): Update.
This commit is contained in:
@@ -59,7 +59,6 @@ bool error_verbose = false;
|
||||
|
||||
bool nondeterministic_parser = false;
|
||||
bool glr_parser = false;
|
||||
bool pure_parser = false;
|
||||
|
||||
int report_flag = report_none;
|
||||
int trace_flag = trace_none;
|
||||
|
||||
@@ -51,11 +51,6 @@ extern bool error_verbose;
|
||||
|
||||
extern bool glr_parser;
|
||||
|
||||
/* PURE_PARSER is true if should generate a parser that is all pure
|
||||
and reentrant. */
|
||||
|
||||
extern bool pure_parser;
|
||||
|
||||
/* NONDETERMINISTIC_PARSER is true iff conflicts are accepted. This
|
||||
is used by the GLR parser, and might be used in BackTracking
|
||||
parsers too. */
|
||||
|
||||
@@ -571,7 +571,6 @@ 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 ("pure_flag", pure_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);
|
||||
|
||||
393
src/parse-gram.c
393
src/parse-gram.c
File diff suppressed because it is too large
Load Diff
@@ -160,7 +160,7 @@
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 1538 of yacc.c */
|
||||
/* Line 1542 of yacc.c */
|
||||
#line 94 "parse-gram.y"
|
||||
|
||||
symbol *symbol;
|
||||
@@ -174,7 +174,7 @@ typedef union YYSTYPE
|
||||
|
||||
|
||||
|
||||
/* Line 1538 of yacc.c */
|
||||
/* Line 1542 of yacc.c */
|
||||
#line 179 "parse-gram.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
|
||||
@@ -266,7 +266,19 @@ prologue_declaration:
|
||||
| "%output" STRING { spec_outfile = $2; }
|
||||
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
|
||||
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
|
||||
| "%pure-parser" { pure_parser = true; }
|
||||
| "%pure-parser"
|
||||
{
|
||||
/* %pure-parser is deprecated in favor of `%define api.pure', so use
|
||||
`%define api.pure' in a backward-compatible manner here. First, don't
|
||||
complain if %pure-parser is specified multiple times. */
|
||||
if (!muscle_find_const ("percent_define(api.pure)"))
|
||||
muscle_percent_define_insert ("api.pure", @1, "");
|
||||
/* 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
|
||||
conflicting definition from an actual %define. */
|
||||
if (!muscle_percent_define_flag_if ("api.pure"))
|
||||
muscle_percent_define_insert ("api.pure", @1, "");
|
||||
}
|
||||
| "%require" STRING { version_check (&@2, $2); }
|
||||
| "%skeleton" STRING
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user