mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
Enable push parsers to operate in impure mode. Thus, %push-parser no
longer implies %pure-parser. The point of this change is to move towards being able to test the push parser code by running the entire test suite as if %push-parser had been declared. * data/push.c (yypush_parse): For impure mode, remove the yypushed_char, yypushed_val, and yypushed_loc arguments. Instead, declare these as local variables initialized to the global yychar, yylval, and yylloc. For the first yypush_parse invocation only, restore the initial values of these global variables when it's time to read a token since they have been overwritten. * src/parse-gram.y (prologue_declaration): Don't set pure_parser for %push-parser. * tests/calc.at (Simple LALR(1) Calculator): Always declare %pure-parser along with %push-parser since this test case was designed for pure push parsers. * tests/local.at (AT_PURE_OR_PUSH_IF): Remove unused. (AT_YACC_OR_PUSH_IF): New. (AT_YYERROR_SEES_LOC_IF): Fix enough that the test suite passes, but add a note that it's still wrong for some cases (as it has been for a while). (AT_PURE_LEX_IF): Use AT_PURE_IF instead of AT_PURE_OR_PUSH_IF since %push-parser no longer implies %pure-parser.
This commit is contained in:
@@ -572,7 +572,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 %skeleton "push.c"])
|
||||
AT_CHECK_CALC_LALR([%push-parser %pure-parser %locations %skeleton "push.c"])
|
||||
AT_CHECK_CALC_LALR([%error-verbose %locations])
|
||||
|
||||
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||
@@ -581,7 +581,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 %skeleton "push.c"])
|
||||
AT_CHECK_CALC_LALR([%push-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %skeleton "push.c"])
|
||||
|
||||
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}])
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ m4_pushdef([AT_PURE_IF],
|
||||
[m4_bmatch([$3], [%pure-parser], [$1], [$2])])
|
||||
m4_pushdef([AT_PUSH_IF],
|
||||
[m4_bmatch([$3], [%push-parser], [$1], [$2])])
|
||||
m4_pushdef([AT_PURE_OR_PUSH_IF],
|
||||
[m4_bmatch([$3], [%pure-parser\|%push-parser], [$1], [$2])])
|
||||
m4_pushdef([AT_YACC_OR_PUSH_IF],
|
||||
[AT_YACC_IF([$1], [AT_PUSH_IF([$1], [$2])])])
|
||||
m4_pushdef([AT_PURE_AND_LOC_IF],
|
||||
[m4_bmatch([$3], [%locations.*%pure-parser\|%pure-parser.*%locations],
|
||||
[$1], [$2])])
|
||||
@@ -76,17 +76,17 @@ m4_pushdef([AT_YYERROR_ARG_LOC_IF],
|
||||
[AT_GLR_OR_PARAM_IF([AT_PURE_AND_LOC_IF([$1], [$2])],
|
||||
[$2])])
|
||||
# yyerror always sees the locations (when activated), except if
|
||||
# push or (yacc & pure & !param).
|
||||
# (yacc & pure & !param). FIXME: This is wrong. See the manual.
|
||||
m4_pushdef([AT_YYERROR_SEES_LOC_IF],
|
||||
[AT_PUSH_IF([$2],[AT_LOCATION_IF([AT_YACC_IF([AT_PURE_IF([AT_PARAM_IF([$1], [$2])],
|
||||
[$1])],
|
||||
[$1])],
|
||||
[$2])])])
|
||||
[AT_LOCATION_IF([AT_YACC_OR_PUSH_IF([AT_PURE_IF([AT_PARAM_IF([$1], [$2])],
|
||||
[$1])],
|
||||
[$1])],
|
||||
[$2])])
|
||||
|
||||
# The interface is pure: either because %pure-parser, or because we
|
||||
# are using the C++ parsers.
|
||||
m4_pushdef([AT_PURE_LEX_IF],
|
||||
[AT_PURE_OR_PUSH_IF([$1],
|
||||
[AT_PURE_IF([$1],
|
||||
[AT_SKEL_CC_IF([$1], [$2])])])
|
||||
|
||||
AT_PURE_LEX_IF(
|
||||
|
||||
Reference in New Issue
Block a user