* data/push.c (YYPUSH_MORE): Make it an enum instead.

(yypushparse): Use YYPUSH_MORE instead of the mystery constant.
Adjust white space and comments to match GNU style better.
This commit is contained in:
Paul Eggert
2006-09-21 17:45:21 +00:00
parent c63d3e90b3
commit 01e972b3f5
2 changed files with 66 additions and 63 deletions

View File

@@ -1,3 +1,9 @@
2006-09-21 Paul Eggert <eggert@cs.ucla.edu>
* data/push.c (YYPUSH_MORE): Make it an enum instead.
(yypushparse): Use YYPUSH_MORE instead of the mystery constant.
Adjust white space and comments to match GNU style better.
2006-09-20 Bob Rossi <bob@brasko.net> 2006-09-20 Bob Rossi <bob@brasko.net>
* data/push.c (yyresult_get): Remove function. * data/push.c (yyresult_get): Remove function.

View File

@@ -973,7 +973,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
]b4_push_if([ ]b4_push_if([
struct yypvars; struct yypvars;
#define YYPUSH_MORE 4 enum { YYPUSH_MORE = 4 };
]b4_c_function_decl([yychar_set], [void], [[struct yypvars *YYPVARS], [YYPVARS]], [[int yychar], [yychar]])[ ]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]])[ ]b4_c_function_decl([yylval_set], [void], [[struct yypvars *YYPVARS], [YYPVARS]], [[YYSTYPE yylval], [yylval]])[
#ifdef YYLTYPE_IS_TRIVIAL #ifdef YYLTYPE_IS_TRIVIAL
@@ -1060,13 +1060,11 @@ m4_define([b4_declare_yyparse_variables],
int yynew;]b4_locations_if([YYLTYPE yyloc;])[ int yynew;]b4_locations_if([YYLTYPE yyloc;])[
}; };
/* Init the parser data structure. Use malloc, should perhaps use a /* Initialize the parser data structure. */
system dependent equivalent function. */ void *
void*
yypvarsinit (void) yypvarsinit (void)
{ {
struct yypvars *pv; struct yypvars *pv = (struct yypvars *) malloc (sizeof *pv);
pv= (struct yypvars *) malloc(sizeof(struct yypvars));
pv->yystate = 0; pv->yystate = 0;
pv->yyresult = -1; pv->yyresult = -1;
pv->yyerrstatus = 0; pv->yyerrstatus = 0;
@@ -1098,9 +1096,8 @@ yypvarsinit (void)
pv->yynew = 1; pv->yynew = 1;
]b4_locations_if([ pv->yylsp = pv->yyls;])[ ]b4_locations_if([ pv->yylsp = pv->yyls;])[
/* Init parser variables */
return (void*) pv; return (void *) pv;
} }
void void
@@ -1239,39 +1236,39 @@ m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
]])dnl ]])dnl
[ ]b4_push_if([ [ ]b4_push_if([
/* Initialize the locals to the current context. */ /* Initialize the locals to the current context. */
yychar = pv->yychar; yychar = pv->yychar;
yylval = pv->yylval; yylval = pv->yylval;
yynerrs = pv->yynerrs; yynerrs = pv->yynerrs;
]b4_locations_if([ ]b4_locations_if([
yylloc = pv->yylloc;])[ yylloc = pv->yylloc;])[
yystate = pv->yystate; yystate = pv->yystate;
yyn = pv->yyn; yyn = pv->yyn;
yyresult = pv->yyresult; yyresult = pv->yyresult;
yyerrstatus = pv->yyerrstatus; yyerrstatus = pv->yyerrstatus;
yytoken = pv->yytoken; yytoken = pv->yytoken;
#if YYERROR_VERBOSE #if YYERROR_VERBOSE
yymsgbuf_ptr = pv->yymsgbuf_ptr; yymsgbuf_ptr = pv->yymsgbuf_ptr;
yymsg = pv->yymsg;; yymsg = pv->yymsg;;
yymsg_alloc = pv->yymsg_alloc; yymsg_alloc = pv->yymsg_alloc;
#endif #endif
yyssa_ptr = pv->yyssa_ptr; yyssa_ptr = pv->yyssa_ptr;
yyss = pv->yyss; yyss = pv->yyss;
yyssp = pv->yyssp; yyssp = pv->yyssp;
yyvs = pv->yyvs; yyvs = pv->yyvs;
yyvsp = pv->yyvsp; yyvsp = pv->yyvsp;
]b4_locations_if([[ /* The location stack. */ ]b4_locations_if([[ /* The location stack. */
yyls = pv->yyls; yyls = pv->yyls;
yylsp = pv->yylsp; yylsp = pv->yylsp;
yyerror_range_ptr = pv->yyerror_range_ptr;]])[ yyerror_range_ptr = pv->yyerror_range_ptr;]])[
yystacksize = pv->yystacksize; yystacksize = pv->yystacksize;
yylen = pv->yylen; yylen = pv->yylen;
yyval = pv->yyval; yyval = pv->yyval;
]b4_locations_if([yyloc = pv->yyloc;])[ ]b4_locations_if([yyloc = pv->yyloc;])[
if (pv->yynew == 0) if (pv->yynew == 0)
{ {
@@ -1382,46 +1379,46 @@ yybackup:
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
{ {
]b4_push_if([ ]b4_push_if([
YYDPRINTF ((stderr, "Return for a new token:\n")); YYDPRINTF ((stderr, "Return for a new token:\n"));
yyresult= 4; yyresult = YYPUSH_MORE;
/* Initialize the locals to the current context. */ /* Initialize the locals to the current context. */
pv->yychar = yychar; pv->yychar = yychar;
pv->yylval = yylval; pv->yylval = yylval;
pv->yynerrs = yynerrs; pv->yynerrs = yynerrs;
]b4_locations_if([ ]b4_locations_if([
pv->yylloc = yylloc;])[ pv->yylloc = yylloc;])[
pv->yystate = yystate; pv->yystate = yystate;
pv->yyn = yyn; pv->yyn = yyn;
pv->yyresult = yyresult; pv->yyresult = yyresult;
pv->yyerrstatus = yyerrstatus; pv->yyerrstatus = yyerrstatus;
pv->yytoken = yytoken; pv->yytoken = yytoken;
#if YYERROR_VERBOSE #if YYERROR_VERBOSE
pv->yymsgbuf_ptr = yymsgbuf_ptr; pv->yymsgbuf_ptr = yymsgbuf_ptr;
pv->yymsg = yymsg;; pv->yymsg = yymsg;;
pv->yymsg_alloc = yymsg_alloc; pv->yymsg_alloc = yymsg_alloc;
#endif #endif
pv->yyssa_ptr = yyssa_ptr; pv->yyssa_ptr = yyssa_ptr;
pv->yyss = yyss; pv->yyss = yyss;
pv->yyssp = yyssp; pv->yyssp = yyssp;
pv->yyvs = yyvs; pv->yyvs = yyvs;
pv->yyvsp = yyvsp; pv->yyvsp = yyvsp;
]b4_locations_if([[ /* The location stack. */ ]b4_locations_if([[ /* The location stack. */
pv->yyls = yyls; pv->yyls = yyls;
pv->yylsp = yylsp; pv->yylsp = yylsp;
pv->yyerror_range_ptr = yyerror_range_ptr;]])[ pv->yyerror_range_ptr = yyerror_range_ptr;]])[
pv->yystacksize = yystacksize; pv->yystacksize = yystacksize;
pv->yylen = yylen; pv->yylen = yylen;
pv->yyval = yyval; pv->yyval = yyval;
]b4_locations_if([pv->yyloc = yyloc;])[ ]b4_locations_if([pv->yyloc = yyloc;])[
return yyresult; return yyresult;
gottoken: gottoken:
YYDPRINTF((stderr, "Reading a token: "));],[ YYDPRINTF((stderr, "Reading a token: "));],[
YYDPRINTF ((stderr, "Reading a token: ")); YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;])[ yychar = YYLEX;])[
} }
if (yychar <= YYEOF) if (yychar <= YYEOF)
@@ -1781,7 +1778,7 @@ typedef struct YYLTYPE
#endif #endif
]b4_push_if([struct ]b4_prefix[pvars; ]b4_push_if([struct ]b4_prefix[pvars;
#define YYPUSH_MORE 4])[ enum { YYPUSH_MORE = 4 };])[
]b4_pure_if([], ]b4_pure_if([],
[extern YYLTYPE b4_prefix[]lloc;]) [extern YYLTYPE b4_prefix[]lloc;])
)dnl b4_locations_if )dnl b4_locations_if