template/bison/yacc.c in lrama-0.5.1 vs template/bison/yacc.c in lrama-0.5.2

- old
+ new

@@ -112,11 +112,11 @@ <%-# b4_declare_yydebug & b4_YYDEBUG_define -%> /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif -#if YYDEBUG +#if YYDEBUG && !defined(yydebug) extern int yydebug; #endif <%-# b4_percent_code_get([[requires]]). %code is not supported -%> <%-# b4_token_enums_defines -%> @@ -729,11 +729,11 @@ # if defined YY_LOCATION_PRINT /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ -# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) +# define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) YY_LOCATION_PRINT(File, *(Loc)<%= output.user_args %>) # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ @@ -765,30 +765,30 @@ # define YYLOCATION_PRINT yy_location_print_ /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ -# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) +# define YY_LOCATION_PRINT(File, Loc<%= output.user_args %>) YYLOCATION_PRINT(File, &(Loc)<%= output.user_args %>) # else -# define YYLOCATION_PRINT(File, Loc) ((void) 0) +# define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) ((void) 0) /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YY_LOCATION_PRINT YYLOCATION_PRINT # endif # endif /* !defined YYLOCATION_PRINT */ -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Kind, Value, Location, p); \ + Kind, Value, Location<%= output.user_args %>); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -826,37 +826,37 @@ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp<%= output.user_formals %>) { YYFPRINTF (yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - YYLOCATION_PRINT (yyo, yylocationp); + YYLOCATION_PRINT (yyo, yylocationp<%= output.user_args %>); YYFPRINTF (yyo, ": "); - yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, p); + yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp<%= output.user_args %>); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop<%= output.user_formals %>) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ +# define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>) \ do { \ if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ + yy_stack_print ((Bottom), (Top)<%= output.user_args %>); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | @@ -876,29 +876,31 @@ { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), &yyvsp[(yyi + 1) - (yynrhs)], - &(yylsp[(yyi + 1) - (yynrhs)]), p); + &(yylsp[(yyi + 1) - (yynrhs)])<%= output.user_args %>); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ +# define YY_REDUCE_PRINT(Rule<%= output.user_args %>) \ do { \ if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, yylsp, Rule, p); \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule<%= output.user_args %>); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ +#ifndef yydebug int yydebug; +#endif #else /* !YYDEBUG */ # define YYDPRINTF(Args) ((void) 0) -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>) +# define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>) +# define YY_REDUCE_PRINT(Rule<%= output.user_args %>) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH @@ -1108,11 +1110,11 @@ not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the required number of bytes is too large to store. */ static int yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - const yypcontext_t *yyctx) + const yypcontext_t *yyctx<%= output.user_formals %>) { enum { YYARGS_MAX = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", @@ -1198,11 +1200,11 @@ yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp<%= output.user_formals %>) { <%= output.parse_param_use("yyvaluep", "yylocationp") %> if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp<%= output.user_args %>); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1225,15 +1227,15 @@ /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ -YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YY_INITIAL_VALUE (static const YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Location data for the lookahead symbol. */ -static YYLTYPE yyloc_default +static const YYLTYPE yyloc_default # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL = { 1, 1, 1, 1 } # endif ; YYLTYPE yylloc = yyloc_default; @@ -1320,11 +1322,11 @@ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END - YY_STACK_PRINT (yyss, yyssp); + YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE YYNOMEM; #else @@ -1438,11 +1440,11 @@ goto yyerrlab1; } else { yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; @@ -1461,11 +1463,11 @@ status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc<%= output.user_args %>); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; @@ -1503,11 +1505,11 @@ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); yyerror_range[1] = yyloc; - YY_REDUCE_PRINT (yyn); + YY_REDUCE_PRINT (yyn<%= output.user_args %>); switch (yyn) { <%= output.user_actions -%> default: break; @@ -1521,11 +1523,11 @@ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc<%= output.user_args %>); YYPOPSTACK (yylen); yylen = 0; *++yyvsp = yyval; @@ -1559,11 +1561,11 @@ { yypcontext_t yyctx = {yyssp, yytoken, &yylloc}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; - yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); + yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>); if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == -1) { if (yymsg != yymsgbuf) @@ -1571,11 +1573,11 @@ yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (yymsg) { yysyntax_error_status - = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); + = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>); yymsgp = yymsg; } else { yymsg = yymsgbuf; @@ -1626,11 +1628,11 @@ /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); + YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. @@ -1661,11 +1663,11 @@ yyerror_range[1] = *yylsp; yydestruct ("Error: popping", YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp<%= output.user_args %>); YYPOPSTACK (1); yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); + YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END @@ -1673,11 +1675,11 @@ yyerror_range[2] = yylloc; ++yylsp; YYLLOC_DEFAULT (*yylsp, yyerror_range, 2); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp<%= output.user_args %>); yystate = yyn; goto yynewstate; @@ -1719,10 +1721,10 @@ yytoken, &yylval, &yylloc<%= output.user_args %>); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); + YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>); while (yyssp != yyss) { yydestruct ("Cleanup: popping", YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp<%= output.user_args %>); YYPOPSTACK (1);