* data/Makefile.am (dist_pkgdata_DATA): Add push.c.

* data/c.m4 (YYPUSH): New.
(b4_push_if): New macro.  Use it instead of #ifdef YYPUSH.
* src/getargs.c (push_parser): New var.
* src/getargs.h (push_parser): New declaration.
* src/output.c (prepare): Add macro insertion of `push_flag'.
* src/parse-gram.y (PERCENT_PUSH_PARSER): New token.
(prologue_declaration): Parse %push-parser.
* src/scan-gram.l: Scan new PERCENT_PUSH_PARSER token.
* tests/calc.at (_AT_CHECK_CALC_ERROR): Add "Return" and "Now" to
list of removed lines from the traces observed.
(AT_CHECK_CALC_LALR): Added push parser tests.
This commit is contained in:
Paul Eggert
2006-09-15 15:56:26 +00:00
parent 21fe08cadc
commit 31c10e38db
10 changed files with 1842 additions and 2 deletions

View File

@@ -59,6 +59,7 @@ bool error_verbose = false;
bool nondeterministic_parser = false;
bool glr_parser = false;
bool pure_parser = false;
bool push_parser = false;
int report_flag = report_none;
int trace_flag = trace_none;

View File

@@ -53,6 +53,11 @@ extern bool glr_parser;
extern bool pure_parser;
/* PUSH_PARSER is true if should generate a parser that is capable of being
called asynchronously. Is must be pure and reentrant. */
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

@@ -585,6 +585,7 @@ prepare (void)
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
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 ("yacc_flag", yacc_flag);

View File

@@ -156,6 +156,7 @@ static int current_prec = 0;
PERCENT_OUTPUT "%output"
PERCENT_PARSE_PARAM "%parse-param"
PERCENT_PURE_PARSER "%pure-parser"
PERCENT_PUSH_PARSER "%push-parser"
PERCENT_REQUIRE "%require"
PERCENT_SKELETON "%skeleton"
PERCENT_START "%start"
@@ -248,6 +249,7 @@ prologue_declaration:
| "%output" "=" STRING { spec_outfile = $3; }
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
| "%pure-parser" { pure_parser = true; }
| "%push-parser" { push_parser = true; }
| "%require" STRING { version_check (&@2, $2); }
| "%skeleton" STRING { skeleton = $2; }
| "%start-header" braceless { muscle_code_grow ("start_header", $2, @2); }

View File

@@ -188,6 +188,7 @@ 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;
"%require" return PERCENT_REQUIRE;
"%right" return PERCENT_RIGHT;
"%skeleton" return PERCENT_SKELETON;