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

@@ -560,7 +560,7 @@ AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%error-verbose])
AT_CHECK_CALC_LALR([%pure-parser %locations])
AT_CHECK_CALC_LALR([%push-pull-parser %pure-parser %locations])
AT_CHECK_CALC_LALR([%define push_pull "both" %pure-parser %locations])
AT_CHECK_CALC_LALR([%error-verbose %locations])
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
@@ -569,7 +569,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-pull-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define push_pull "both" %pure-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}])

View File

@@ -822,10 +822,10 @@ input.y:5.9-16: warning: %define variable `special2' is not used
AT_CLEANUP
## --------------------------- ##
## Boolean %define variables. ##
## %define Boolean variables. ##
## --------------------------- ##
AT_SETUP([Boolean %define variables])
AT_SETUP([[%define Boolean variables]])
AT_DATA([Input.y],
[[%language "Java"
@@ -840,3 +840,21 @@ AT_CHECK([[bison Input.y]], [1], [],
]])
AT_CLEANUP
## ------------------------ ##
## %define enum variables. ##
## ------------------------ ##
AT_SETUP([[%define enum variables]])
AT_DATA([[input.y]],
[[%define push_pull "neither"
%%
start: ;
]])
AT_CHECK([[bison input.y]], [1], [],
[[input.y:1.9-17: invalid value for %define variable `push_pull': `neither'
]])
AT_CLEANUP

View File

@@ -33,7 +33,7 @@ AT_DATA_GRAMMAR([[input.y]],
void yyerror (char const *msg);
%}
%pure-parser %push-parser
%pure-parser %define push_pull "push"
%%
@@ -77,7 +77,6 @@ AT_PARSER_CHECK([[./input]])
AT_CLEANUP
## ----------------------------------------- ##
## Push Parsing: Multiple impure instances. ##
## ----------------------------------------- ##
@@ -93,7 +92,7 @@ AT_DATA_GRAMMAR([[input.y]],
int yylex (void);
%}
%push-pull-parser
%define push_pull "both"
%%
@@ -150,3 +149,22 @@ cannot allocate multiple impure push-parser instances
]])
AT_CLEANUP
## ------------------------------------- ##
## Push Parsing: Unsupported Skeletons. ##
## ------------------------------------- ##
AT_SETUP([[Push Parsing: Unsupported Skeletons]])
AT_DATA([[input.y]],
[[%glr-parser
%define push_pull "push"
%%
start: ;
]])
AT_CHECK([[bison input.y]], [0], [],
[[input.y:2.9-17: warning: %define variable `push_pull' is not used
]])
AT_CLEANUP

View File

@@ -496,7 +496,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
# push parsers.
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
[[%push-pull-parser
[[%define push_pull "both"
]])
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
@@ -534,7 +534,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
[[%push-pull-parser
[[%define push_pull "both"
]])
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])