X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/3e75a2c92b12766add442d00a86d5ec1c67ce560..72cd9a913f6d282c5e24990505c2c820bda2bf1b:/data/glr.c?ds=sidebyside diff --git a/data/glr.c b/data/glr.c index 37f40aee..509ee123 100644 --- a/data/glr.c +++ b/data/glr.c @@ -215,23 +215,19 @@ b4_token_enums(b4_tokens) [[typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1]])])[ #endif - +]b4_locations_if([[ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { -]b4_locations_if([ int first_line; int first_column; int last_line; int last_column; -],[ - char yydummy; -])[ } YYLTYPE; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif - +]])[ ]b4_percent_code_get([[provides]])[]dnl ]) @@ -511,9 +507,8 @@ m4_if(b4_prefix[], [yy], [], #define b4_prefix[]char yychar #define b4_prefix[]lval yylval #define b4_prefix[]lloc yylloc])], -[YYSTYPE yylval; - -YYLTYPE yylloc; +[YYSTYPE yylval;]b4_locations_if([[ +YYLTYPE yylloc;]])[ int yynerrs; int yychar;])[ @@ -716,9 +711,9 @@ struct yyGLRState { yySemanticOption* yyfirstVal; /** Semantic value for this state. */ YYSTYPE yysval; - } yysemantics; + } yysemantics;]b4_locations_if([[ /** Source location for this state. */ - YYLTYPE yyloc; + YYLTYPE yyloc;]])[ }; struct yyGLRStateSet { @@ -740,8 +735,8 @@ struct yySemanticOption { yyGLRState* yystate; /** The lookahead for this reduction. */ int yyrawchar; - YYSTYPE yyval; - YYLTYPE yyloc; + YYSTYPE yyval;]b4_locations_if([[ + YYLTYPE yyloc;]])[ /** Next sibling in chain of options. To facilitate merging, * options are chained in decreasing order by address. */ yySemanticOption* yynext; @@ -762,8 +757,8 @@ struct yyGLRStack { [ int yyerrcnt; int yyrawchar; - YYSTYPE yyval; - YYLTYPE yyloc; + YYSTYPE yyval;]b4_locations_if([[ + YYLTYPE yyloc;]])[ ])[ YYJMP_BUF yyexception_buffer; yyGLRStackItem* yyitems; @@ -829,8 +824,8 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) else /* The effect of using yysval or yyloc (in an immediate rule) is * undefined. */ - yyvsp[i].yystate.yysemantics.yyfirstVal = NULL; - yyvsp[i].yystate.yyloc = s->yyloc; + yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[ + yyvsp[i].yystate.yyloc = s->yyloc;]])[ s = yyvsp[i].yystate.yypred = s->yypred; } } @@ -1434,7 +1429,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, YYLTYPE yyloc;])[ yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[); - if (yyflag == yyerr && yystackp->yysplitPoint != NULL) + if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL) { YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", (unsigned long int) yyk, yyrule - 1));