X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/426903aa75c4c92c6953f1304ee24c16c600210e..ff020c3061aeab8a20a4a6fd48c434e3e5aeb29b:/data/yacc.c diff --git a/data/yacc.c b/data/yacc.c index 2e46a1e2..7bcbd7ca 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -230,22 +230,27 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[ # Declaration of yyparse (and dependencies) when using the push parser # (including in pull mode). m4_define([b4_declare_yyparse_push_], -[[typedef struct ]b4_prefix[pstate ]b4_prefix[pstate; +[[#ifndef YYPUSH_MORE_DEFINED +# define YYPUSH_MORE_DEFINED enum { YYPUSH_MORE = 4 }; +#endif + +typedef struct ]b4_prefix[pstate ]b4_prefix[pstate; + ]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param) ])b4_c_function_decl([b4_prefix[push_parse]], [[int]], - [[b4_prefix[pstate *yyps]], [[yyps]]]b4_pure_if([, - [[[int yypushed_char]], [[yypushed_char]]], - [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([, - [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [, + [[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([, + [[[int pushed_char]], [[pushed_char]]], + [[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([, + [[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [, b4_parse_param])) b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]], - [[b4_prefix[pstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [, + [[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [, b4_parse_param]))]) b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]], [[[void]], []]) b4_c_function_decl([b4_prefix[pstate_delete]], [[void]], - [[b4_prefix[pstate *yyps]], [[yyps]]])dnl + [[b4_prefix[pstate *ps]], [[ps]]])dnl ]) # b4_declare_yyparse_ @@ -340,9 +345,11 @@ m4_if(b4_api_prefix, [yy], [], # define YYERROR_VERBOSE ]b4_error_verbose_flag[ #endif -/* In a future release of Bison, this section will be replaced +]m4_ifval(m4_quote(b4_spec_defines_file), +[[/* In a future release of Bison, this section will be replaced by #include "@basename(]b4_spec_defines_file[@)". */ -]b4_shared_declarations[ +]])dnl +b4_shared_declarations[ /* Copy the second part of user declarations. */ ]b4_user_post_prologue @@ -1508,7 +1515,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[ int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval;]b4_locations_if([[ @@ -1533,7 +1540,6 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[ goto yyread_pushed_token; }]])[ - yytoken = 0; yyss = yyssa; yyvs = yyvsa;]b4_locations_if([[ yyls = yylsa;]])[ @@ -1565,17 +1571,16 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[ yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; #endif]]) m4_ifdef([b4_initial_action],[ -m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl -m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl +b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], + [m4_define([b4_at_dollar_used])yylloc])dnl /* User initialization code. */ b4_user_initial_action -m4_popdef([b4_dollar_dollar])dnl -m4_popdef([b4_at_dollar])])dnl +b4_dollar_popdef[]dnl m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval; ]])dnl m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; -]])[ - goto yysetstate; +]])])dnl +[ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | @@ -2041,7 +2046,7 @@ yypushreturn:]])[ } -]b4_epilogue +]b4_epilogue[]dnl b4_defines_if( [@output(b4_spec_defines_file@)@ b4_copyright([Bison interface for Yacc-like parsers in C],