X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/63cb01d656aadba43f5ad2feb935bf32546002f2..c70fdfcd207a394121c7dac271bbd04ce2a91c98:/data/glr.c diff --git a/data/glr.c b/data/glr.c index 00b36bae..f9835ada 100644 --- a/data/glr.c +++ b/data/glr.c @@ -556,13 +556,14 @@ int yydebug; properly redirected to new data. */ #define YYHEADROOM 2 -#if (! defined (YYSTACKEXPANDABLE) \ - && (! defined (__cplusplus) \ - || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ - && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) -#define YYSTACKEXPANDABLE 1 -#else -#define YYSTACKEXPANDABLE 0 +#ifndef YYSTACKEXPANDABLE +# if (! defined (__cplusplus) \ + || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ + && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)) +# define YYSTACKEXPANDABLE 1 +# else +# define YYSTACKEXPANDABLE 0 +# endif #endif #if YYERROR_VERBOSE @@ -678,37 +679,11 @@ struct yyGLRStack { static void yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[); static void -yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yyformat, ...) +yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yymsg) { yystack->yyerrflag = 1; - if (yyformat != NULL) - { - char yysmallbuf[1024]; - char const *yymsg = yysmallbuf; - char *yybigbuf = NULL; - int yymsglen; - va_list yyap; - - va_start (yyap, yyformat); - yymsglen = vsnprintf (yysmallbuf, sizeof yysmallbuf, yyformat, yyap); - va_end (yyap); - - if (yymsglen < 0) - yymsg = "message is too long to be printed"; - else if (sizeof yysmallbuf <= yymsglen && yymsglen < YYSIZEMAX) - { - size_t yybigsize = yymsglen; - yybigsize++; - yymsg = yybigbuf = YYMALLOC (yybigsize); - - va_start (yyap, yyformat); - vsnprintf (yybigbuf, yybigsize, yyformat, yyap); - va_end (yyap); - } - - yyerror (]b4_yyerror_args[yymsg); - YYFREE (yybigbuf); - } + if (yymsg != NULL) + yyerror (]b4_yyerror_args[yymsg); longjmp (yystack->yyexception_buffer, 1); } @@ -807,7 +782,8 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, else *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; YYLLOC_DEFAULT (*yylocp, yyvsp - yyrhslen, yyrhslen); -] +]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = *yylocp; +]]) switch (yyn) { b4_actions @@ -837,6 +813,7 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) switch (yyn) { b4_mergers + default: break; } } [ @@ -1973,7 +1950,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack, ]b4_c_ansi_function_def([yyparse], [int], b4_parse_param)[ { - yySymbol yytoken = YYEMPTY; + yySymbol yytoken; yyGLRStack yystack; size_t yyposn; ]b4_pure_if( @@ -1989,6 +1966,8 @@ yyrecoverSyntaxError (yyGLRStack* yystack, YYDPRINTF ((stderr, "Starting parse\n")); + yytoken = YYEMPTY; + if (setjmp (yystack.yyexception_buffer) != 0) goto yyDone; @@ -2004,8 +1983,8 @@ yyrecoverSyntaxError (yyGLRStack* yystack, #endif ]) m4_ifdef([b4_initial_action], [ -m4_pushdef([b4_at_dollar], [yylval])dnl -m4_pushdef([b4_dollar_dollar], [yylloc])dnl +m4_pushdef([b4_at_dollar], [yylloc])dnl +m4_pushdef([b4_dollar_dollar], [yylval])dnl /* User initialization code. */ b4_initial_action m4_popdef([b4_dollar_dollar])dnl