* 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

@@ -1,3 +1,18 @@
2006-09-15 Bob Rossi <bob@brasko.net>
* 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.
2006-09-13 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Version 2.3a.

View File

@@ -1,4 +1,4 @@
## Copyright (C) 2002, 2005 Free Software Foundation, Inc.
## Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
## 02110-1301 USA
dist_pkgdata_DATA = README \
c.m4 yacc.c glr.c \
c.m4 yacc.c glr.c push.c \
c++.m4 location.cc lalr1.cc glr.cc
m4sugardir = $(pkgdatadir)/m4sugar

View File

@@ -76,6 +76,9 @@ m4_define([b4_identification],
/* Pure parsers. */
[#]define YYPURE b4_pure_flag
/* Push parsers. */
[#]define YYPUSH b4_push_flag
/* Using locations. */
[#]define YYLSP_NEEDED b4_locations_flag
])
@@ -225,6 +228,15 @@ b4_define_flag_if([pure]) # Whether the interface is pure.
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
# b4_push_if(IF-TRUE, IF-FALSE)
# -----------------------------
# Expand IF-TRUE, if %push-parser, IF-FALSE otherwise.
m4_define([b4_push_if],
[m4_if(b4_push_flag, [1],
[$1],
[$2])])
## ------------------------- ##
## Assigning token numbers. ##

1799
data/push.c Normal file

File diff suppressed because it is too large Load Diff

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;

View File

@@ -412,11 +412,13 @@ sed '/^Starting/d
/^Stack/d
/^Reading/d
/^Reducing/d
/^Return/d
/^Shifting/d
/^state/d
/^Cleanup:/d
/^Error:/d
/^Next/d
/^Now/d
/^Discarding/d
/ \$[[0-9$]]* = /d
/^yydestructor:/d' stderr >at-stderr
@@ -559,6 +561,7 @@ AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%error-verbose])
AT_CHECK_CALC_LALR([%pure-parser %locations])
AT_CHECK_CALC_LALR([%push-parser %locations])
AT_CHECK_CALC_LALR([%error-verbose %locations])
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc])
@@ -567,6 +570,7 @@ AT_CHECK_CALC_LALR([%debug])
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%push-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])