X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/9be2a009c4b50ba8925d55e82d0cb944a230dd8c..786578e394700615f6a841614e1280bf6284ec8c:/data/glr.c diff --git a/data/glr.c b/data/glr.c index 9cabf622..6f1f7ee9 100644 --- a/data/glr.c +++ b/data/glr.c @@ -1,8 +1,8 @@ -*- C -*- # GLR skeleton for Bison -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software -# Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free +# Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -158,7 +158,7 @@ m4_changecom() m4_divert_push(0)dnl @output(b4_parser_file_name@)@ b4_copyright([Skeleton implementation for Bison GLR parsers in C], - [2002, 2003, 2004, 2005, 2006, 2007, 2008]) + [2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009]) [ /* C GLR parser skeleton written by Paul Hilfinger. */ @@ -224,7 +224,7 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], /* Enabling traces. */ #ifndef YYDEBUG -# define YYDEBUG ]b4_debug_flag[ +# define YYDEBUG ]b4_parse_trace_if([1], [0])[ #endif /* Enabling verbose error messages. */ @@ -232,7 +232,7 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else -# define YYERROR_VERBOSE ]b4_error_verbose_flag[ +# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[ #endif /* Enabling the token table. */ @@ -953,17 +953,15 @@ yylhsNonterm (yyRuleNum yyrule) return yyr1[yyrule]; } -#define yyis_pact_ninf(yystate) \ - ]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), [1], - [0], - [((yystate) == YYPACT_NINF)])[ +#define yypact_value_is_default(yystate) \ + ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[ /** True iff LR state STATE has only a default reduction (regardless * of token). */ static inline yybool yyisDefaultedState (yyStateNum yystate) { - return yyis_pact_ninf (yypact[yystate]); + return yypact_value_is_default (yypact[yystate]); } /** The default reduction for STATE, assuming it has one. */ @@ -973,10 +971,8 @@ yydefaultAction (yyStateNum yystate) return yydefact[yystate]; } -#define yyis_table_ninf(yytable_value) \ - ]m4_if(m4_eval(b4_table_ninf < b4_table_min), [1], - [YYID (0)], - [((yytable_value) == YYTABLE_NINF)])[ +#define yytable_value_is_error(yytable_value) \ + ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[ /** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN. * Result R means @@ -991,12 +987,13 @@ yygetLRActions (yyStateNum yystate, int yytoken, int* yyaction, const short int** yyconflicts) { int yyindex = yypact[yystate] + yytoken; - if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) + if (yypact_value_is_default (yypact[yystate]) + || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) { *yyaction = -yydefact[yystate]; *yyconflicts = yyconfl; } - else if (! yyis_table_ninf (yytable[yyindex])) + else if (! yytable_value_is_error (yytable[yyindex])) { *yyaction = yytable[yyindex]; *yyconflicts = yyconfl + yyconflp[yyindex]; @@ -1011,8 +1008,7 @@ yygetLRActions (yyStateNum yystate, int yytoken, static inline yyStateNum yyLRgotoState (yyStateNum yystate, yySymbol yylhs) { - int yyr; - yyr = yypgoto[yylhs - YYNTOKENS] + yystate; + int yyr = yypgoto[yylhs - YYNTOKENS] + yystate; if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) return yytable[yyr]; else @@ -1366,8 +1362,7 @@ do { \ `----------------------------------------------------------*/ /*ARGSUSED*/ static inline void -yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, - YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) +yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule]b4_user_formals[) { int yynrhs = yyrhsLength (yyrule); yybool yynormal __attribute__ ((__unused__)) = @@ -1375,8 +1370,6 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; int yylow = 1; int yyi; - YYUSE (yyvalp); - YYUSE (yylocp); ]b4_parse_param_use[]dnl [ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", (unsigned long int) yyk, yyrule - 1, @@ -1417,7 +1410,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, YYSTYPE yysval; YYLTYPE yyloc; - YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc]b4_user_args[)); + YY_REDUCE_PRINT ((yystackp, yyk, yyrule]b4_user_args[)); YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval, &yyloc]b4_user_args[)); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); @@ -2052,7 +2045,8 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ + YYCHECK. In other words, skip the first -YYN actions for this + state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ @@ -2067,7 +2061,8 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyarg[yycount++] = yytokenName (yytoken); for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { @@ -2178,7 +2173,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; - if (yyis_pact_ninf (yyj)) + if (yypact_value_is_default (yyj)) return; yyj += yytoken; if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) @@ -2186,7 +2181,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) return; } - else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj])) + else if (! yytable_value_is_error (yytable[yyj])) return; } @@ -2207,7 +2202,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) { yyGLRState *yys = yystackp->yytops.yystates[0]; yyj = yypact[yys->yylrState]; - if (! yyis_pact_ninf (yyj)) + if (! yypact_value_is_default (yyj)) { yyj += YYTERROR; if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR @@ -2583,7 +2578,7 @@ m4_if(b4_skeleton, ["glr.c"], [b4_defines_if( [@output(b4_spec_defines_file@)@ b4_copyright([Skeleton interface for Bison GLR parsers in C], - [2002, 2003, 2004, 2005, 2006, 2007, 2008]) + [2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009]) b4_shared_declarations