mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
* data/push.c (yychar_set, yylval_set, yylloc_set): Delete.
(yypushparse): Add yynchar, yynlval, yynlloc parameters. (b4_declare_parser_variables): Do not declare yynerrs for push mode. (struct yypvars): Remove b4_declare_parser_variables. (yypvarsinit): Remove init code for removed variables. (global scope): Do not declare b4_declare_parser_variables if push or pure mode. (yypushparse): Add b4_declare_parser_variables. Init new local variables, and remove init code for removed yypvars variables. (yyparse): Delete. * tests/calc.at (_AT_DATA_CALC_Y): Call yypushparse for push mode and yyparse for other modes. (AT_CHECK_CALC_LALR): Added '%skeleton "push.c"' for push tests. * tests/local.at (AT_PUSH_IF, AT_PURE_OR_PUSH_IF): Added. (AT_YYERROR_SEES_LOC_IF): push-parser makes this false. (AT_PURE_LEX_IF): True if pure or push parser.
This commit is contained in:
@@ -336,7 +336,17 @@ main (int argc, const char **argv)
|
||||
|
||||
]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
|
||||
[ yydebug = 1;])])[
|
||||
status = yyparse (]AT_PARAM_IF([&result, &count])[);
|
||||
]AT_PUSH_IF([
|
||||
{
|
||||
struct yypvars *ctx = yypvarsinit ();
|
||||
YYSTYPE my_lval;
|
||||
]AT_LOCATION_IF([YYLTYPE my_lloc;])[
|
||||
do {
|
||||
status = yypushparse (ctx, yylex (&my_lval]AT_LOCATION_IF([[, &my_lloc]])[), &my_lval]AT_LOCATION_IF([[, &my_lloc]])[);
|
||||
} while (status == YYPUSH_MORE);
|
||||
free (ctx);
|
||||
}],[
|
||||
status = yyparse (]AT_PARAM_IF([[&result, &count]])[);])[
|
||||
fclose (input);
|
||||
if (global_result != result)
|
||||
abort ();
|
||||
@@ -562,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])
|
||||
AT_CHECK_CALC_LALR([%push-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])
|
||||
@@ -571,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])
|
||||
AT_CHECK_CALC_LALR([%push-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}])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user