Index: data/push.c =================================================================== RCS file: /sources/bison/bison/data/push.c,v retrieving revision 1.3 diff -u -r1.3 push.c --- data/push.c 21 Sep 2006 17:45:21 -0000 1.3 +++ data/push.c 26 Sep 2006 13:06:09 -0000 @@ -161,11 +161,7 @@ #define yychar b4_prefix[]char #define yydebug b4_prefix[]debug #define yynerrs b4_prefix[]nerrs -b4_locations_if([#define yylloc b4_prefix[]lloc]) -b4_push_if([ -#define yychar_set b4_prefix[]char_set -#define yylval_set b4_prefix[]lval_set -#define yylloc_set b4_prefix[]lloc_set])])[ +b4_locations_if([#define yylloc b4_prefix[]lloc])])[ /* Copy the first part of user declarations. */ ]b4_pre_prologue[ @@ -974,14 +970,12 @@ ]b4_push_if([ struct yypvars; enum { YYPUSH_MORE = 4 }; -]b4_c_function_decl([yychar_set], [void], [[struct yypvars *YYPVARS], [YYPVARS]], [[int yychar], [yychar]])[ -]b4_c_function_decl([yylval_set], [void], [[struct yypvars *YYPVARS], [YYPVARS]], [[YYSTYPE yylval], [yylval]])[ -#ifdef YYLTYPE_IS_TRIVIAL -]b4_c_function_decl([yylloc_set], [void], [[struct yypvars *YYPVARS], [YYPVARS]], [[YYLTYPE yylloc], [yylloc]])[ -#endif ]b4_c_function_decl([yypvarsinit], [void *], [[void], []])[ ]b4_c_function_decl([yypushparse], [int], - [[struct yypvars *YYPVARS], [YYPVARS]])[ + [[struct yypvars *YYPVARS], [YYPVARS]], + [[int YYCHAR], [YYCHAR]], + [[YYSTYPE *YYLVAL], [YYLVAL]] + b4_locations_if([,[[YYLTYPE *YYLLOC], [YYLLOC]]]))[ ])[ ]m4_divert_push([KILL])# ======================== M4 code. @@ -1087,41 +1081,20 @@ pv->yyssp = pv->yyss; pv->yyvsp = pv->yyvs; +]b4_locations_if([ #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ pv->yylloc.first_line = pv->yylloc.last_line = ]b4_location_initial_line[; pv->yylloc.first_column = pv->yylloc.last_column = ]b4_location_initial_column[; #endif +])[ pv->yynew = 1; ]b4_locations_if([ pv->yylsp = pv->yyls;])[ return (void *) pv; -} - -void -yychar_set (struct yypvars *YYPVARS, int yychar) -{ - if (YYPVARS) - YYPVARS->yychar = yychar; -} - -void -yylval_set (struct yypvars *YYPVARS, YYSTYPE yylval) -{ - if (YYPVARS) - YYPVARS->yylval = yylval; -} - -#ifdef YYLTYPE_IS_TRIVIAL -void -yylloc_set (struct yypvars *YYPVARS, YYLTYPE yylloc) -{ - if (YYPVARS) - YYPVARS->yylloc = yylloc; -} -#endif]) +}]) m4_divert_pop([KILL])dnl# ====================== End of M4 code. b4_pure_if([], @@ -1134,7 +1107,10 @@ `-------------------------*/ b4_push_if([ -b4_c_function_def([yypushparse], [int], [[struct yypvars *YYPVARS], [YYPVARS]])],[ +b4_c_function_def([yypushparse], [int], [[struct yypvars *YYPVARS], [YYPVARS]], + [[int YYCHAR], [YYCHAR]], + [[YYSTYPE *YYLVAL], [YYLVAL]] + b4_locations_if([,[[YYLTYPE *YYLLOC], [YYLLOC]]]))],[ #ifdef YYPARSE_PARAM b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]]) #else /* ! YYPARSE_PARAM */ @@ -1202,7 +1178,13 @@ YYDPRINTF ((stderr, "Starting parse\n")); - ]b4_push_if([pv = YYPVARS;])[ + ]b4_push_if([pv = YYPVARS; + pv->yychar = YYCHAR; + if (YYLVAL) + pv->yylval = *YYLVAL; + ]b4_locations_if([ + if (YYLLOC) + pv->yylloc = *YYLLOC;]))[ yystate = 0; yyerrstatus = 0; @@ -1722,13 +1704,11 @@ {[ struct yypvars *ctx = yypvarsinit (); int status; + int ch; do { - yychar_set (ctx, yylex ()); - yylval_set (ctx, yylval); -#ifdef YYLTYPE_IS_TRIVIAL - yylloc_set (ctx, yylloc); -#endif - status = yypushparse (ctx); + ch = yylex (); +]b4_locations_if([status = yypushparse (ctx, ch, &yylval, &yylloc);], + [status = yypushparse (ctx, ch, &yylval);])[ } while (status == YYPUSH_MORE); free (ctx); return status;