X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b9278c7d174c1be5d7482343c5e433f428657ed0..573654ca9e8bc3ad9f5a00820417edcbca6e14dc:/data/yacc.c?ds=sidebyside diff --git a/data/yacc.c b/data/yacc.c index 7a2587ab..600e77df 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -1,11 +1,11 @@ -*- C -*- # Yacc compatible skeleton for Bison -# Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, +# Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, # Inc. m4_pushdef([b4_copyright_years], - [1984, 1989-1990, 2000-2012]) + [1984, 1989-1990, 2000-2015]) # 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 @@ -100,15 +100,6 @@ m4_define([b4_yyerror_args], m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])]) -# b4_lex_param -# ------------ -# Accumulate in b4_lex_param all the yylex arguments. -# b4_lex_param arrives quoted twice, but we want to keep only one level. -m4_define([b4_lex_param], -m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl -b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl -m4_ifdef([b4_lex_param], b4_lex_param))) - ## ------------ ## ## Data Types. ## @@ -152,7 +143,6 @@ m4_define([b4_rhs_value], [b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])]) - ## ----------- ## ## Locations. ## ## ----------- ## @@ -185,36 +175,19 @@ m4_define([b4_declare_scanner_communication_variables], [[ int yychar; ]b4_pure_if([[ -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else +/* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif]b4_locations_if([[ -static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[ -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);]b4_locations_if([[ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[ /* Location data for the lookahead symbol. */ -YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[; -]])b4_pure_if([], [[ - +static YYLTYPE yyloc_default]b4_yyloc_default[; +YYLTYPE yylloc = yyloc_default;]])], +[[/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval;]b4_locations_if([[ +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc]b4_yyloc_default[;]])[ /* Number of syntax errors so far. */ int yynerrs;]])]) @@ -232,9 +205,9 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[ int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values.]b4_locations_if([[ - `yyls': related to locations.]])[ + 'yyss': related to states. + 'yyvs': related to semantic values.]b4_locations_if([[ + 'yyls': related to locations.]])[ Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -355,11 +328,12 @@ m4_if(b4_api_prefix, [yy], [], #define yypstate ]b4_prefix[pstate]])[ #define yylex ]b4_prefix[lex #define yyerror ]b4_prefix[error -#define yylval ]b4_prefix[lval -#define yychar ]b4_prefix[char #define yydebug ]b4_prefix[debug -#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[ -#define yylloc ]b4_prefix[lloc]])])[ +#define yynerrs ]b4_prefix[nerrs +]]b4_pure_if([], [[ +#define yylval ]b4_prefix[lval +#define yychar ]b4_prefix[char]b4_locations_if([[ +#define yylloc ]b4_prefix[lloc]])]))[ /* Copy the first part of user declarations. */ ]b4_user_pre_prologue[ @@ -439,12 +413,7 @@ typedef short int yytype_int16; # endif #endif -/* Suppress unused-variable warnings by "using" E. */ -#ifdef __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif +]b4_attribute_define[ #if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[ @@ -476,7 +445,7 @@ b4_push_if([], [b4_lac_if([], [[ # endif]])])[ # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ + /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, @@ -613,7 +582,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] = #if ]b4_api_PREFIX[DEBUG ]b4_integral_parser_table_define([rline], [b4_rline], - [YYRLINE[YYN] -- Source line where rule number YYN was defined.])[ + [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[ #endif #if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[ @@ -684,14 +653,6 @@ while (0) ]b4_yylloc_default_define[ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) ]])[ -]b4_yy_location_print_define[ - -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM) -#else -# define YYLEX ]b4_function_call([yylex], [int], b4_lex_param)[ -#endif /* Enable debugging if requested. */ #if ]b4_api_PREFIX[DEBUG @@ -707,6 +668,8 @@ do { \ YYFPRINTF Args; \ } while (0) +]b4_yy_location_print_define[ + # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ @@ -1145,11 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, ]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes, YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1224,7 +1187,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1308,7 +1271,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([ b4_function_define([[yyparse]], [[int]], b4_parse_param)[ { - return yypull_parse (YY_NULL]m4_ifset([b4_parse_param], + return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param], [[, ]b4_args(b4_parse_param)])[); } @@ -1336,7 +1299,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[ } } do { - yychar = YYLEX; + yychar = ]b4_lex[; yystatus = yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[); } while (yystatus == YYPUSH_MORE); @@ -1350,10 +1313,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[ { yypstate *yyps;]b4_pure_if([], [[ if (yypstate_allocated) - return YY_NULL;]])[ + return YY_NULLPTR;]])[ yyps = (yypstate *) malloc (sizeof *yyps); if (!yyps) - return YY_NULL; + return YY_NULLPTR; yyps->yynew = 1;]b4_pure_if([], [[ yypstate_allocated = 1;]])[ return yyps; @@ -1597,7 +1560,7 @@ yyread_pushed_token:]])[ yylval = *yypushed_val;]b4_locations_if([[ if (yypushed_loc) yylloc = *yypushed_loc;]])])], [[ - yychar = YYLEX;]])[ + yychar = ]b4_lex[;]])[ } if (yychar <= YYEOF) @@ -1668,7 +1631,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1716,7 +1679,7 @@ yyreduce: *++yyvsp = yyval;]b4_locations_if([ *++yylsp = yyloc;])[ - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1820,7 +1783,7 @@ yyerrorlab: goto yyerrorlab; ]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen]; -]])[ /* Do not reclaim the symbols of the rule which action triggered +]])[ /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1915,7 +1878,7 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp);