X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/d6dc4d36d1db744b060029254eaabaaa525a1c19..6f0a6f274c8650520003b6408684a3f0bcdece5c:/data/glr.c?ds=sidebyside diff --git a/data/glr.c b/data/glr.c index 1e82e589..106b95a7 100644 --- a/data/glr.c +++ b/data/glr.c @@ -55,16 +55,6 @@ m4_define([b4_user_formals], [m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])]) -# b4_lex_param -# ------------ -# Accumule in b4_lex_param all the yylex arguments. -# Yes, this is quite ugly... -m4_define([b4_lex_param], -m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl -b4_locations_if([, [[YYLTYPE *], [&yylloc]]])])dnl -m4_ifdef([b4_lex_param], [, ]b4_lex_param))) - - # b4_yyerror_args # --------------- # Optional effective arguments passed to yyerror: user args plus yylloc, and @@ -286,7 +276,7 @@ b4_percent_code_get[]dnl # include # define YYJMP_BUF jmp_buf # define YYSETJMP(Env) setjmp (Env) -// Pacify clang. +/* Pacify clang. */ # define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0)) #endif @@ -391,7 +381,7 @@ static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] = /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by 0, pointed into by YYCONFLP. */ ]dnl Do not use b4_int_type_for here, since there are places where -dnl pointers onto yyconfl are taken, which type is "short int *". +dnl pointers onto yyconfl are taken, whose type is "short int *". dnl We probably ought to introduce a type for confl. [static const short int yyconfl[] = { @@ -407,9 +397,6 @@ dnl We probably ought to introduce a type for confl. ]])[ ]b4_yy_location_print_define[ -/* YYLEX -- calling `yylex' with the right arguments. */ -#define YYLEX ]b4_function_call([yylex], [int], b4_lex_param)[ - ]b4_pure_if( [ #undef yynerrs @@ -471,6 +458,12 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; multiple parsers can coexist. */ int yydebug; +struct yyGLRStack; +static void yypstack (struct yyGLRStack* yystackp, size_t yyk) + __attribute__ ((__unused__)); +static void yypdumpstack (struct yyGLRStack* yystackp) + __attribute__ ((__unused__)); + #else /* !]b4_api_PREFIX[DEBUG */ # define YYDPRINTF(Args) @@ -1919,7 +1912,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = ]b4_lex[; } if (yychar <= YYEOF) @@ -1997,10 +1990,10 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) #if ! YYERROR_VERBOSE yyerror (]b4_lyyerror_args[YY_("syntax error")); #else + { yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken)); size_t yysize = yysize0; - size_t yysize1; yybool yysize_overflow = yyfalse; char* yymsg = YY_NULL; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; @@ -2060,9 +2053,11 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) break; } yyarg[yycount++] = yytokenName (yyx); - yysize1 = yysize + yytnamerr (YY_NULL, yytokenName (yyx)); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; + { + size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx)); + yysize_overflow |= yysz < yysize; + yysize = yysz; + } } } } @@ -2082,9 +2077,11 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) #undef YYCASE_ } - yysize1 = yysize + strlen (yyformat); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; + { + size_t yysz = yysize + strlen (yyformat); + yysize_overflow |= yysz < yysize; + yysize = yysz; + } if (!yysize_overflow) yymsg = (char *) YYMALLOC (yysize); @@ -2114,6 +2111,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyerror (]b4_lyyerror_args[YY_("syntax error")); yyMemoryExhausted (yystackp); } + } #endif /* YYERROR_VERBOSE */ yynerrs += 1; } @@ -2149,7 +2147,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yytoken, &yylval]b4_locuser_args([&yylloc])[); } YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = ]b4_lex[; if (yychar <= YYEOF) { yychar = yytoken = YYEOF; @@ -2303,7 +2301,7 @@ b4_dollar_popdef])[]dnl if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = ]b4_lex[; } if (yychar <= YYEOF) @@ -2477,10 +2475,6 @@ b4_dollar_popdef])[]dnl /* DEBUGGING ONLY */ #if ]b4_api_PREFIX[DEBUG -static void yypstack (yyGLRStack* yystackp, size_t yyk) - __attribute__ ((__unused__)); -static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__)); - static void yy_yypstack (yyGLRState* yys) {