mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
45
ChangeLog
45
ChangeLog
@@ -1,3 +1,48 @@
|
|||||||
|
2007-09-25 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2007-09-24 Wojciech Polak <polak@gnu.org>
|
2007-09-24 Wojciech Polak <polak@gnu.org>
|
||||||
|
|
||||||
Add XSLT transformations.
|
Add XSLT transformations.
|
||||||
|
|||||||
@@ -214,13 +214,7 @@ b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
|||||||
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||||
b4_define_flag_if([locations]) # Whether locations are tracked.
|
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||||
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||||
b4_define_flag_if([pull]) # Whether pull parsing is requested.
|
|
||||||
b4_define_flag_if([pure]) # Whether the interface is pure.
|
b4_define_flag_if([pure]) # Whether the interface is pure.
|
||||||
b4_define_flag_if([push]) # Whether push parsing is requested.
|
|
||||||
b4_define_flag_if([use_push_for_pull]) # Whether push parsing should be used
|
|
||||||
# in place of pull parsing (where
|
|
||||||
# available) for the sake of the test
|
|
||||||
# suite.
|
|
||||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
|
||||||
@@ -403,6 +397,43 @@ m4_define([b4_percent_define_default],
|
|||||||
m4_define([b4_percent_define_loc(]$1[)],
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
[[[[[Bison:b4_percent_define_default]:0.0]], [[[Bison:b4_percent_define_default]:0.0]]]])])])
|
[[[[[Bison:b4_percent_define_default]:0.0]], [[[Bison:b4_percent_define_default]:0.0]]]])])])
|
||||||
|
|
||||||
|
# b4_percent_define_check_values(VALUES)
|
||||||
|
# --------------------------------------
|
||||||
|
# Mimic muscle_percent_define_check_values in ../src/muscle_tab.h exactly
|
||||||
|
# except that the VALUES structure is more appropriate for M4. That is, VALUES
|
||||||
|
# is a list of sublists of strings. 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.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]],
|
||||||
|
# [[[[bar]], [[bar-value1]]]])
|
||||||
|
m4_define([b4_percent_define_check_values],
|
||||||
|
[m4_foreach([b4_sublist], m4_quote($@),
|
||||||
|
[_b4_percent_define_check_values(b4_sublist)])])
|
||||||
|
|
||||||
|
m4_define([_b4_percent_define_check_values],
|
||||||
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
|
[m4_pushdef([b4_good_value], [0])dnl
|
||||||
|
m4_if($#, 1, [],
|
||||||
|
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
|
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
||||||
|
[m4_define([b4_good_value], [1])])])])dnl
|
||||||
|
m4_if(b4_good_value, [0],
|
||||||
|
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
||||||
|
b4_complain_at(b4_loc,
|
||||||
|
[[invalid value for %%define variable `%s': `%s']],
|
||||||
|
[$1],
|
||||||
|
m4_dquote(m4_indir([b4_percent_define(]$1[)])))dnl
|
||||||
|
m4_popdef([b4_loc])])dnl
|
||||||
|
m4_popdef([b4_good_value])],
|
||||||
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])])
|
||||||
|
|
||||||
# b4_percent_code_get([QUALIFIER])
|
# b4_percent_code_get([QUALIFIER])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# If any %code blocks for QUALIFIER are defined, emit them beginning with a
|
# If any %code blocks for QUALIFIER are defined, emit them beginning with a
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||||
|
|
||||||
b4_push_if([b4_complain([[C++ push parsers are not supported]])])
|
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_push_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[push.c]])])
|
|
||||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||||
|
|
||||||
|
|||||||
@@ -41,12 +41,6 @@ m4_define([b4_identification],
|
|||||||
/* Pure parsers. */
|
/* Pure parsers. */
|
||||||
[#]define YYPURE b4_pure_flag
|
[#]define YYPURE b4_pure_flag
|
||||||
|
|
||||||
/* Push parsers. */
|
|
||||||
[#]define YYPUSH b4_push_flag
|
|
||||||
|
|
||||||
/* Pull parsers. */
|
|
||||||
[#]define YYPULL b4_pull_flag
|
|
||||||
|
|
||||||
/* Using locations. */
|
/* Using locations. */
|
||||||
[#]define YYLSP_NEEDED b4_locations_flag
|
[#]define YYLSP_NEEDED b4_locations_flag
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -20,9 +20,6 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
b4_push_if([
|
|
||||||
b4_complain([[non-deterministic push parsers are not yet supported]])])
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
||||||
b4_push_if( [b4_complain([%%push-parser is not supported for Java])])
|
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|||||||
29
data/push.c
29
data/push.c
@@ -18,17 +18,22 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Check the value of %define push_pull.
|
||||||
|
b4_percent_define_default([[push_pull]], [[pull]])
|
||||||
|
b4_percent_define_check_values([[[[push_pull]], [[pull]], [[push]], [[both]]]])
|
||||||
|
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
|
||||||
|
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
|
||||||
|
m4_case(b4_percent_define_get([[push_pull]]),
|
||||||
|
[pull], [m4_define([b4_push_flag], [[0]])],
|
||||||
|
[push], [m4_define([b4_pull_flag], [[0]])])
|
||||||
|
|
||||||
# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
|
# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
|
||||||
# tests function as written, don't let BISON_USE_PUSH_FOR_PULL modify Bison's
|
# tests function as written, don't let BISON_USE_PUSH_FOR_PULL modify Bison's
|
||||||
# behavior at all when push parsing is already requested.
|
# behavior at all when push parsing is already requested.
|
||||||
|
b4_define_flag_if([use_push_for_pull])
|
||||||
b4_use_push_for_pull_if([
|
b4_use_push_for_pull_if([
|
||||||
b4_push_if([
|
b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
|
||||||
m4_define([b4_use_push_for_pull_flag], [[0]])
|
[m4_define([b4_push_flag], [[1]])])])
|
||||||
b4_define_flag_if([use_push_for_pull])
|
|
||||||
], [
|
|
||||||
m4_define([b4_push_flag], [[1]])
|
|
||||||
b4_define_flag_if([push])
|
|
||||||
])])
|
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
@@ -157,8 +162,14 @@ b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
|
|||||||
define necessary library symbols; they are noted "INFRINGES ON
|
define necessary library symbols; they are noted "INFRINGES ON
|
||||||
USER NAME SPACE" below. */
|
USER NAME SPACE" below. */
|
||||||
|
|
||||||
]b4_identification
|
]b4_identification[
|
||||||
b4_percent_code_get([[top]])[]dnl
|
/* Push parsers. */
|
||||||
|
#define YYPUSH ]b4_push_flag[
|
||||||
|
|
||||||
|
/* Pull parsers. */
|
||||||
|
#define YYPULL ]b4_pull_flag[
|
||||||
|
|
||||||
|
]b4_percent_code_get([[top]])[]dnl
|
||||||
m4_if(b4_prefix, [yy], [],
|
m4_if(b4_prefix, [yy], [],
|
||||||
[[/* Substitute the variable and function names. */
|
[[/* Substitute the variable and function names. */
|
||||||
]b4_pull_if([[#define yyparse ]b4_prefix[parse
|
]b4_pull_if([[#define yyparse ]b4_prefix[parse
|
||||||
|
|||||||
@@ -18,8 +18,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Handle BISON_USE_PUSH_FOR_PULL for the test suite.
|
# This hack will go away when we mv push.c yacc.c.
|
||||||
b4_use_push_for_pull_if([m4_include(b4_pkgdatadir/[push.c])], [
|
m4_ifndef([b4_percent_define(push_pull)],
|
||||||
|
[m4_if(b4_use_push_for_pull_flag, [0], [
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
@@ -1532,4 +1533,6 @@ b4_percent_code_get([[provides]])
|
|||||||
])dnl b4_defines_if
|
])dnl b4_defines_if
|
||||||
m4_divert_pop(0)
|
m4_divert_pop(0)
|
||||||
|
|
||||||
])dnl b4_use_push_for_pull_if
|
],
|
||||||
|
[m4_include(b4_pkgdatadir/[push.c])])],
|
||||||
|
[m4_include(b4_pkgdatadir/[push.c])])
|
||||||
|
|||||||
@@ -4528,7 +4528,7 @@ valid grammar.
|
|||||||
@subsection A Push Parser
|
@subsection A Push Parser
|
||||||
@cindex push parser
|
@cindex push parser
|
||||||
@cindex push parser
|
@cindex push parser
|
||||||
@findex %push-parser
|
@findex %define push_pull
|
||||||
|
|
||||||
A pull parser is called once and it takes control until all its input
|
A pull parser is called once and it takes control until all its input
|
||||||
is completely parsed. A push parser, on the other hand, is called
|
is completely parsed. A push parser, on the other hand, is called
|
||||||
@@ -4539,12 +4539,12 @@ main event loop in the client's application. This is typically
|
|||||||
a requirement of a GUI, when the main event loop needs to be triggered
|
a requirement of a GUI, when the main event loop needs to be triggered
|
||||||
within a certain time period.
|
within a certain time period.
|
||||||
|
|
||||||
Normally, Bison generates a pull parser. The Bison declaration
|
Normally, Bison generates a pull parser.
|
||||||
@code{%push-parser} says that you want the parser to be a push parser.
|
The following Bison declaration says that you want the parser to be a push
|
||||||
It looks like this:
|
parser (@pxref{Decl Summary,,%define push_pull}):
|
||||||
|
|
||||||
@example
|
@example
|
||||||
%push-parser
|
%define push_pull "push"
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
In almost all cases, you want to ensure that your push parser is also
|
In almost all cases, you want to ensure that your push parser is also
|
||||||
@@ -4555,7 +4555,7 @@ what you are doing, your declarations should look like this:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
%pure-parser
|
%pure-parser
|
||||||
%push-parser
|
%define push_pull "push"
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
There is a major notable functional difference between the pure push parser
|
There is a major notable functional difference between the pure push parser
|
||||||
@@ -4604,15 +4604,16 @@ for use by the next invocation of the @code{yypush_parse} function.
|
|||||||
|
|
||||||
Bison also supports both the push parser interface along with the pull parser
|
Bison also supports both the push parser interface along with the pull parser
|
||||||
interface in the same generated parser. In order to get this functionality,
|
interface in the same generated parser. In order to get this functionality,
|
||||||
you should replace the @code{%push-parser} declaration with the
|
you should replace the @code{%define push_pull "push"} declaration with the
|
||||||
@code{%push-pull-parser} declaration. Doing this will create all of the
|
@code{%define push_pull "both"} declaration. Doing this will create all of the
|
||||||
symbols mentioned earlier along with the two extra symbols, @code{yyparse}
|
symbols mentioned earlier along with the two extra symbols, @code{yyparse}
|
||||||
and @code{yypull_parse}. @code{yyparse} can be used exactly as it normally
|
and @code{yypull_parse}. @code{yyparse} can be used exactly as it normally
|
||||||
would be used. However, the user should note that it is implemented in the
|
would be used. However, the user should note that it is implemented in the
|
||||||
generated parser by calling @code{yypull_parse}. This makes the
|
generated parser by calling @code{yypull_parse}.
|
||||||
@code{yyparse} function that is generated with the @code{%push-pull-parser}
|
This makes the @code{yyparse} function that is generated with the
|
||||||
declaration slower than the normal @code{yyparse} function. If the user
|
@code{%define push_pull "both"} declaration slower than the normal
|
||||||
calls the @code{yypull_parse} function it will parse the rest of the input
|
@code{yyparse} function. If the user
|
||||||
|
calls the @code{yypull_parse} function it will parse the rest of the input
|
||||||
stream. It is possible to @code{yypush_parse} tokens to select a subgrammar
|
stream. It is possible to @code{yypush_parse} tokens to select a subgrammar
|
||||||
and then @code{yypull_parse} the rest of the input stream. If you would like
|
and then @code{yypull_parse} the rest of the input stream. If you would like
|
||||||
to switch back and forth between between parsing styles, you would have to
|
to switch back and forth between between parsing styles, you would have to
|
||||||
@@ -4627,8 +4628,8 @@ yypstate_delete (ps);
|
|||||||
@end example
|
@end example
|
||||||
|
|
||||||
Adding the @code{%pure-parser} declaration does exactly the same thing to the
|
Adding the @code{%pure-parser} declaration does exactly the same thing to the
|
||||||
generated parser with @code{%push-pull-parser} as it did for
|
generated parser with @code{%define push_pull "both"} as it did for
|
||||||
@code{%push-parser}.
|
@code{%define push_pull "push"}.
|
||||||
|
|
||||||
@node Decl Summary
|
@node Decl Summary
|
||||||
@subsection Bison Declaration Summary
|
@subsection Bison Declaration Summary
|
||||||
@@ -4834,6 +4835,14 @@ target language and/or parser skeleton.
|
|||||||
@end enumerate
|
@end enumerate
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn {Directive} %define push_pull "@var{value}"
|
||||||
|
Bison declaration to request a @code{"pull"} parser, a @code{"push"} parser, or
|
||||||
|
@code{"both"}.
|
||||||
|
The default @code{"@var{value}"} is @code{"pull"}.
|
||||||
|
This directive is currently only available for LALR(1) parsers in C.
|
||||||
|
@xref{Push Decl, ,A Push Parser}.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %defines
|
@deffn {Directive} %defines
|
||||||
Write a header file containing macro definitions for the token type
|
Write a header file containing macro definitions for the token type
|
||||||
names defined in the grammar as well as a few other declarations.
|
names defined in the grammar as well as a few other declarations.
|
||||||
@@ -4944,16 +4953,6 @@ Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
|
|||||||
(Reentrant) Parser}).
|
(Reentrant) Parser}).
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %push-parser
|
|
||||||
Bison declaration to request a push parser.
|
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn {Directive} %push-pull-parser
|
|
||||||
Bison declaration to request a push and a pull parser.
|
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn {Directive} %require "@var{version}"
|
@deffn {Directive} %require "@var{version}"
|
||||||
Require version @var{version} or higher of Bison. @xref{Require Decl, ,
|
Require version @var{version} or higher of Bison. @xref{Require Decl, ,
|
||||||
Require a Version of Bison}.
|
Require a Version of Bison}.
|
||||||
@@ -5163,8 +5162,8 @@ exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @}
|
|||||||
@findex yypush_parse
|
@findex yypush_parse
|
||||||
|
|
||||||
You call the function @code{yypush_parse} to parse a single token. This
|
You call the function @code{yypush_parse} to parse a single token. This
|
||||||
function is available if either the @code{%push-parser} or
|
function is available if either the @code{%define push_pull "push"} or
|
||||||
@code{%push-pull-parser} declaration is used.
|
@code{%define push_pull "both"} declaration is used.
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
@xref{Push Decl, ,A Push Parser}.
|
||||||
|
|
||||||
@deftypefun int yypush_parse (yypstate *yyps)
|
@deftypefun int yypush_parse (yypstate *yyps)
|
||||||
@@ -5178,7 +5177,7 @@ is required to finish parsing the grammar.
|
|||||||
@findex yypull_parse
|
@findex yypull_parse
|
||||||
|
|
||||||
You call the function @code{yypull_parse} to parse the rest of the input
|
You call the function @code{yypull_parse} to parse the rest of the input
|
||||||
stream. This function is available if the @code{%push-pull-parser}
|
stream. This function is available if the @code{%define push_pull "both"}
|
||||||
declaration is used.
|
declaration is used.
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
@xref{Push Decl, ,A Push Parser}.
|
||||||
|
|
||||||
@@ -5191,8 +5190,8 @@ The value returned by @code{yypull_parse} is the same as for @code{yyparse}.
|
|||||||
@findex yypstate_new
|
@findex yypstate_new
|
||||||
|
|
||||||
You call the function @code{yypstate_new} to create a new parser instance.
|
You call the function @code{yypstate_new} to create a new parser instance.
|
||||||
This function is available if either the @code{%push-parser} or
|
This function is available if either the @code{%define push_pull "push"} or
|
||||||
@code{%push-pull-parser} declaration is used.
|
@code{%define push_pull "both"} declaration is used.
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
@xref{Push Decl, ,A Push Parser}.
|
||||||
|
|
||||||
@deftypefun yypstate *yypstate_new (void)
|
@deftypefun yypstate *yypstate_new (void)
|
||||||
@@ -5205,8 +5204,8 @@ or NULL if no memory was available.
|
|||||||
@findex yypstate_delete
|
@findex yypstate_delete
|
||||||
|
|
||||||
You call the function @code{yypstate_delete} to delete a parser instance.
|
You call the function @code{yypstate_delete} to delete a parser instance.
|
||||||
This function is available if either the @code{%push-parser} or
|
function is available if either the @code{%define push_pull "push"} or
|
||||||
@code{%push-pull-parser} declaration is used.
|
@code{%define push_pull "both"} declaration is used.
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
@xref{Push Decl, ,A Push Parser}.
|
||||||
|
|
||||||
@deftypefun void yypstate_delete (yypstate *yyps)
|
@deftypefun void yypstate_delete (yypstate *yyps)
|
||||||
@@ -9330,6 +9329,12 @@ Define a variable to adjust Bison's behavior.
|
|||||||
@xref{Decl Summary,,%define}.
|
@xref{Decl Summary,,%define}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn {Directive} %define push_pull "@var{value}"
|
||||||
|
Bison declaration to request a @code{"pull"} parser, a @code{"push"} parser, or
|
||||||
|
@code{"both"}.
|
||||||
|
@xref{Decl Summary,,%define push_pull}.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %defines
|
@deffn {Directive} %defines
|
||||||
Bison declaration to create a header file meant for the scanner.
|
Bison declaration to create a header file meant for the scanner.
|
||||||
@xref{Decl Summary}.
|
@xref{Decl Summary}.
|
||||||
@@ -9452,16 +9457,6 @@ Bison declaration to request a pure (reentrant) parser.
|
|||||||
@xref{Pure Decl, ,A Pure (Reentrant) Parser}.
|
@xref{Pure Decl, ,A Pure (Reentrant) Parser}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %push-parser
|
|
||||||
Bison declaration to request a push parser.
|
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn {Directive} %push-pull-parser
|
|
||||||
Bison declaration to request a push and a pull parser.
|
|
||||||
@xref{Push Decl, ,A Push Parser}.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn {Directive} %require "@var{version}"
|
@deffn {Directive} %require "@var{version}"
|
||||||
Require version @var{version} or higher of Bison. @xref{Require Decl, ,
|
Require version @var{version} or higher of Bison. @xref{Require Decl, ,
|
||||||
Require a Version of Bison}.
|
Require a Version of Bison}.
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ bool error_verbose = false;
|
|||||||
|
|
||||||
bool nondeterministic_parser = false;
|
bool nondeterministic_parser = false;
|
||||||
bool glr_parser = false;
|
bool glr_parser = false;
|
||||||
bool pull_parser = true;
|
|
||||||
bool pure_parser = false;
|
bool pure_parser = false;
|
||||||
bool push_parser = false;
|
|
||||||
|
|
||||||
int report_flag = report_none;
|
int report_flag = report_none;
|
||||||
int trace_flag = trace_none;
|
int trace_flag = trace_none;
|
||||||
|
|||||||
@@ -51,19 +51,11 @@ extern bool error_verbose;
|
|||||||
|
|
||||||
extern bool glr_parser;
|
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
|
/* PURE_PARSER is true if should generate a parser that is all pure
|
||||||
and reentrant. */
|
and reentrant. */
|
||||||
|
|
||||||
extern bool pure_parser;
|
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
|
/* NONDETERMINISTIC_PARSER is true iff conflicts are accepted. This
|
||||||
is used by the GLR parser, and might be used in BackTracking
|
is used by the GLR parser, and might be used in BackTracking
|
||||||
parsers too. */
|
parsers too. */
|
||||||
|
|||||||
@@ -156,15 +156,17 @@ bool muscle_percent_define_flag_if (char const *variable);
|
|||||||
suspect that the value has yet influenced the output. */
|
suspect that the value has yet influenced the output. */
|
||||||
void muscle_percent_define_default (char const *variable, char const *value);
|
void muscle_percent_define_default (char const *variable, char const *value);
|
||||||
|
|
||||||
/* VALUES points to a sequence of strings that is partitioned into
|
/* Mimic b4_percent_define_check_values in ../data/bison.m4 exactly except that
|
||||||
subsequences by NULL's, one terminating each subsequence. The last
|
the VALUES structure is more appropriate for C. That is, VALUES points to a
|
||||||
subsequence is followed by a second NULL. For each subsequence, the first
|
list of strings that is partitioned into sublists by NULL's, one terminating
|
||||||
string is the name of a %define variable, and all remaining strings in that
|
each sublist. The last sublist is followed by a second NULL. For each
|
||||||
subsequence are the valid values for that variable. Complain if such a
|
sublist, the first string is the name of a %define variable, and all
|
||||||
variable is undefined (a Bison error since the default value should have
|
remaining strings in that sublist are the valid values for that variable.
|
||||||
been set already) or defined to any other value (possibly a user error).
|
Complain if such a variable is undefined (a Bison error since the default
|
||||||
Don't record this as a Bison usage of the variable as there's no reason to
|
value should have been set already) or defined to any other value (possibly
|
||||||
suspect that the value has yet influenced the output. */
|
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);
|
void muscle_percent_define_check_values (char const * const *values);
|
||||||
|
|
||||||
/* Grow the muscle for the %code qualifier QUALIFIER appearing at QUALIFIER_LOC
|
/* Grow the muscle for the %code qualifier QUALIFIER appearing at QUALIFIER_LOC
|
||||||
|
|||||||
@@ -571,9 +571,7 @@ prepare (void)
|
|||||||
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
||||||
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
|
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
|
||||||
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
|
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
|
||||||
MUSCLE_INSERT_BOOL ("pull_flag", pull_parser);
|
|
||||||
MUSCLE_INSERT_BOOL ("pure_flag", pure_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 ("synclines_flag", !no_lines_flag);
|
||||||
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
||||||
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
|
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
|
||||||
|
|||||||
1085
src/parse-gram.c
1085
src/parse-gram.c
File diff suppressed because it is too large
Load Diff
@@ -74,28 +74,26 @@
|
|||||||
PERCENT_OUTPUT = 289,
|
PERCENT_OUTPUT = 289,
|
||||||
PERCENT_PARSE_PARAM = 290,
|
PERCENT_PARSE_PARAM = 290,
|
||||||
PERCENT_PURE_PARSER = 291,
|
PERCENT_PURE_PARSER = 291,
|
||||||
PERCENT_PUSH_PARSER = 292,
|
PERCENT_REQUIRE = 292,
|
||||||
PERCENT_PUSH_PULL_PARSER = 293,
|
PERCENT_SKELETON = 293,
|
||||||
PERCENT_REQUIRE = 294,
|
PERCENT_START = 294,
|
||||||
PERCENT_SKELETON = 295,
|
PERCENT_TOKEN_TABLE = 295,
|
||||||
PERCENT_START = 296,
|
PERCENT_VERBOSE = 296,
|
||||||
PERCENT_TOKEN_TABLE = 297,
|
PERCENT_YACC = 297,
|
||||||
PERCENT_VERBOSE = 298,
|
BRACED_CODE = 298,
|
||||||
PERCENT_YACC = 299,
|
CHAR = 299,
|
||||||
BRACED_CODE = 300,
|
EPILOGUE = 300,
|
||||||
CHAR = 301,
|
EQUAL = 301,
|
||||||
EPILOGUE = 302,
|
ID = 302,
|
||||||
EQUAL = 303,
|
ID_COLON = 303,
|
||||||
ID = 304,
|
PERCENT_PERCENT = 304,
|
||||||
ID_COLON = 305,
|
PIPE = 305,
|
||||||
PERCENT_PERCENT = 306,
|
PROLOGUE = 306,
|
||||||
PIPE = 307,
|
SEMICOLON = 307,
|
||||||
PROLOGUE = 308,
|
TYPE = 308,
|
||||||
SEMICOLON = 309,
|
TYPE_TAG_ANY = 309,
|
||||||
TYPE = 310,
|
TYPE_TAG_NONE = 310,
|
||||||
TYPE_TAG_ANY = 311,
|
PERCENT_UNION = 311
|
||||||
TYPE_TAG_NONE = 312,
|
|
||||||
PERCENT_UNION = 313
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
@@ -134,28 +132,26 @@
|
|||||||
#define PERCENT_OUTPUT 289
|
#define PERCENT_OUTPUT 289
|
||||||
#define PERCENT_PARSE_PARAM 290
|
#define PERCENT_PARSE_PARAM 290
|
||||||
#define PERCENT_PURE_PARSER 291
|
#define PERCENT_PURE_PARSER 291
|
||||||
#define PERCENT_PUSH_PARSER 292
|
#define PERCENT_REQUIRE 292
|
||||||
#define PERCENT_PUSH_PULL_PARSER 293
|
#define PERCENT_SKELETON 293
|
||||||
#define PERCENT_REQUIRE 294
|
#define PERCENT_START 294
|
||||||
#define PERCENT_SKELETON 295
|
#define PERCENT_TOKEN_TABLE 295
|
||||||
#define PERCENT_START 296
|
#define PERCENT_VERBOSE 296
|
||||||
#define PERCENT_TOKEN_TABLE 297
|
#define PERCENT_YACC 297
|
||||||
#define PERCENT_VERBOSE 298
|
#define BRACED_CODE 298
|
||||||
#define PERCENT_YACC 299
|
#define CHAR 299
|
||||||
#define BRACED_CODE 300
|
#define EPILOGUE 300
|
||||||
#define CHAR 301
|
#define EQUAL 301
|
||||||
#define EPILOGUE 302
|
#define ID 302
|
||||||
#define EQUAL 303
|
#define ID_COLON 303
|
||||||
#define ID 304
|
#define PERCENT_PERCENT 304
|
||||||
#define ID_COLON 305
|
#define PIPE 305
|
||||||
#define PERCENT_PERCENT 306
|
#define PROLOGUE 306
|
||||||
#define PIPE 307
|
#define SEMICOLON 307
|
||||||
#define PROLOGUE 308
|
#define TYPE 308
|
||||||
#define SEMICOLON 309
|
#define TYPE_TAG_ANY 309
|
||||||
#define TYPE 310
|
#define TYPE_TAG_NONE 310
|
||||||
#define TYPE_TAG_ANY 311
|
#define PERCENT_UNION 311
|
||||||
#define TYPE_TAG_NONE 312
|
|
||||||
#define PERCENT_UNION 313
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -164,7 +160,7 @@
|
|||||||
typedef union YYSTYPE
|
typedef union YYSTYPE
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Line 1535 of yacc.c */
|
/* Line 1538 of yacc.c */
|
||||||
#line 94 "parse-gram.y"
|
#line 94 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
@@ -178,8 +174,8 @@ typedef union YYSTYPE
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Line 1535 of yacc.c */
|
/* Line 1538 of yacc.c */
|
||||||
#line 183 "parse-gram.h"
|
#line 179 "parse-gram.h"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
|
|||||||
@@ -150,9 +150,6 @@ static int current_prec = 0;
|
|||||||
PERCENT_OUTPUT "%output"
|
PERCENT_OUTPUT "%output"
|
||||||
PERCENT_PARSE_PARAM "%parse-param"
|
PERCENT_PARSE_PARAM "%parse-param"
|
||||||
PERCENT_PURE_PARSER "%pure-parser"
|
PERCENT_PURE_PARSER "%pure-parser"
|
||||||
PERCENT_PUSH_PARSER "%push-parser"
|
|
||||||
PERCENT_PUSH_PULL_PARSER
|
|
||||||
"%push-pull-parser"
|
|
||||||
PERCENT_REQUIRE "%require"
|
PERCENT_REQUIRE "%require"
|
||||||
PERCENT_SKELETON "%skeleton"
|
PERCENT_SKELETON "%skeleton"
|
||||||
PERCENT_START "%start"
|
PERCENT_START "%start"
|
||||||
@@ -270,8 +267,6 @@ prologue_declaration:
|
|||||||
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
|
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
|
||||||
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
|
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
|
||||||
| "%pure-parser" { pure_parser = true; }
|
| "%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); }
|
| "%require" STRING { version_check (&@2, $2); }
|
||||||
| "%skeleton" STRING
|
| "%skeleton" STRING
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,8 +185,6 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
"%prec" return PERCENT_PREC;
|
"%prec" return PERCENT_PREC;
|
||||||
"%printer" return PERCENT_PRINTER;
|
"%printer" return PERCENT_PRINTER;
|
||||||
"%pure"[-_]"parser" return PERCENT_PURE_PARSER;
|
"%pure"[-_]"parser" return PERCENT_PURE_PARSER;
|
||||||
"%push-parser" return PERCENT_PUSH_PARSER;
|
|
||||||
"%push-pull-parser" return PERCENT_PUSH_PULL_PARSER;
|
|
||||||
"%require" return PERCENT_REQUIRE;
|
"%require" return PERCENT_REQUIRE;
|
||||||
"%right" return PERCENT_RIGHT;
|
"%right" return PERCENT_RIGHT;
|
||||||
"%skeleton" return PERCENT_SKELETON;
|
"%skeleton" return PERCENT_SKELETON;
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ AT_CHECK_CALC_LALR([%yacc])
|
|||||||
AT_CHECK_CALC_LALR([%error-verbose])
|
AT_CHECK_CALC_LALR([%error-verbose])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%pure-parser %locations])
|
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])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
|
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([%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([%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}])
|
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}])
|
||||||
|
|
||||||
|
|||||||
@@ -822,10 +822,10 @@ input.y:5.9-16: warning: %define variable `special2' is not used
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
## --------------------------- ##
|
## --------------------------- ##
|
||||||
## Boolean %define variables. ##
|
## %define Boolean variables. ##
|
||||||
## --------------------------- ##
|
## --------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Boolean %define variables])
|
AT_SETUP([[%define Boolean variables]])
|
||||||
|
|
||||||
AT_DATA([Input.y],
|
AT_DATA([Input.y],
|
||||||
[[%language "Java"
|
[[%language "Java"
|
||||||
@@ -840,3 +840,21 @@ AT_CHECK([[bison Input.y]], [1], [],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
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
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
void yyerror (char const *msg);
|
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
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
## ----------------------------------------- ##
|
## ----------------------------------------- ##
|
||||||
## Push Parsing: Multiple impure instances. ##
|
## Push Parsing: Multiple impure instances. ##
|
||||||
## ----------------------------------------- ##
|
## ----------------------------------------- ##
|
||||||
@@ -93,7 +92,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
int yylex (void);
|
int yylex (void);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%push-pull-parser
|
%define push_pull "both"
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -150,3 +149,22 @@ cannot allocate multiple impure push-parser instances
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
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
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
|
|||||||
# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
|
# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
|
||||||
# push parsers.
|
# push parsers.
|
||||||
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
|
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
|
||||||
[[%push-pull-parser
|
[[%define push_pull "both"
|
||||||
]])
|
]])
|
||||||
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
|
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
|
||||||
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
|
[[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"]])
|
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
|
||||||
|
|
||||||
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
|
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
|
||||||
[[%push-pull-parser
|
[[%define push_pull "both"
|
||||||
]])
|
]])
|
||||||
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
|
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
|
||||||
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
|
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
|
||||||
|
|||||||
Reference in New Issue
Block a user