diff --git a/src/frontend/parse-bison.c b/src/frontend/parse-bison.c index 00f7826fc..52f8fb272 100644 --- a/src/frontend/parse-bison.c +++ b/src/frontend/parse-bison.c @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -46,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -75,7 +73,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 1 "parse-bison.y" /* @@ -115,8 +113,8 @@ -/* Line 189 of yacc.c */ -#line 120 "parse-bison.c" +/* Line 268 of yacc.c */ +#line 118 "parse-bison.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -160,7 +158,7 @@ typedef union YYSTYPE { -/* Line 214 of yacc.c */ +/* Line 293 of yacc.c */ #line 53 "parse-bison.y" double num; @@ -169,8 +167,8 @@ typedef union YYSTYPE -/* Line 214 of yacc.c */ -#line 174 "parse-bison.c" +/* Line 293 of yacc.c */ +#line 172 "parse-bison.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -194,8 +192,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 199 "parse-bison.c" +/* Line 343 of yacc.c */ +#line 197 "parse-bison.c" #ifdef short # undef short @@ -245,7 +243,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -298,11 +296,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -325,24 +323,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -373,23 +371,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -409,10 +391,30 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 14 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 256 +#define YYLAST 248 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 30 @@ -442,7 +444,7 @@ static const yytype_uint8 yytranslate[] = 15, 14, 16, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 26, 2, 27, 24, 2, 2, 2, 2, 2, + 2, 26, 2, 27, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 17, 2, 2, 2, @@ -459,7 +461,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 25 + 5, 6, 7, 8, 9, 24 }; #if YYDEBUG @@ -480,7 +482,7 @@ static const yytype_int8 yyrhs[] = -1, 34, -1, 3, -1, 4, -1, 34, 18, 34, -1, 34, 20, 34, -1, 34, 19, 34, -1, 34, 21, 34, -1, 34, 23, 34, -1, 34, 22, 34, - -1, 34, 24, 34, -1, 28, 34, 29, -1, 19, + -1, 34, 25, 34, -1, 28, 34, 29, -1, 19, 34, -1, 17, 34, -1, 4, 28, 34, 29, -1, 34, 14, 34, -1, 34, 7, 34, -1, 34, 16, 34, -1, 34, 15, 34, -1, 34, 6, 34, -1, @@ -506,8 +508,8 @@ static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_NUM", "TOK_STR", "TOK_LE", "TOK_GE", "TOK_NE", "TOK_LRANGE", "TOK_RRANGE", "'?'", "':'", "'|'", "'&'", "'='", - "'<'", "'>'", "'~'", "','", "'-'", "'+'", "'*'", "'/'", "'%'", "'^'", - "NEG", "'['", "']'", "'('", "')'", "$accept", "expression", "exp_list", + "'<'", "'>'", "'~'", "','", "'-'", "'+'", "'*'", "'/'", "'%'", "NEG", + "'^'", "'['", "']'", "'('", "')'", "$accept", "expression", "exp_list", "one_exp", "exp", 0 }; #endif @@ -519,7 +521,7 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 63, 58, 124, 38, 61, 60, 62, 126, 44, 45, - 43, 42, 47, 37, 94, 265, 91, 93, 40, 41 + 43, 42, 47, 37, 265, 94, 91, 93, 40, 41 }; # endif @@ -541,8 +543,8 @@ static const yytype_uint8 yyr2[] = 5 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -566,11 +568,11 @@ static const yytype_int8 yydefgoto[] = static const yytype_int16 yypact[] = { 28, -26, -25, 28, 28, 28, 4, -26, 28, 169, - 28, 222, 26, 52, -26, -26, 28, 28, 28, 28, + 28, 222, 200, 52, -26, -26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 77, -26, 222, 222, 222, 125, - 147, 191, 213, 222, 222, 222, 222, 230, 230, 25, - 25, 25, 25, 102, -26, -26, 28, -26, 169 + 147, 191, 213, 222, 222, 222, 222, 29, 29, 200, + 200, 200, 200, 102, -26, -26, 28, -26, 169 }; /* YYPGOTO[NTERM-NUM]. */ @@ -581,67 +583,70 @@ static const yytype_int8 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 11, 12, 13, 10, 14, 0, 15, 34, 0, 0, 0, 0, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 1, 2, 19, 19, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 4, 0, 32, - 0, 33, 33, 58, 0, 0, 5, 16, 17, 18, + 53, 1, 2, 0, 0, 0, 0, 19, 0, 0, + 0, 0, 0, 0, 0, 3, 0, 4, 0, 0, + 29, 30, 31, 58, 32, 33, 5, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 0, - 26, 27, 28, 29, 30, 31, 32, 0, 33, 0, + 26, 27, 28, 29, 30, 31, 0, 32, 33, 0, 0, 35, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 30, - 31, 32, 0, 33, 0, 0, 54, 16, 17, 18, + 31, 0, 32, 33, 0, 0, 54, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 0, - 26, 27, 28, 29, 30, 31, 32, 0, 33, 57, + 26, 27, 28, 29, 30, 31, 0, 32, 33, 57, 16, 17, 18, 19, 55, 20, 0, 21, 22, 23, - 24, 25, 0, 26, 27, 28, 29, 30, 31, 32, - 0, 33, 16, 17, 18, 19, 0, 20, 56, 21, + 24, 25, 0, 26, 27, 28, 29, 30, 31, 0, + 32, 33, 16, 17, 18, 19, 0, 20, 56, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 30, - 31, 32, 0, 33, 16, 17, 18, 19, 0, 20, + 31, 0, 32, 33, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 0, 26, 27, 28, - 29, 30, 31, 32, 0, 33, 16, 17, 18, 19, - 0, 0, 0, 0, 22, 23, 24, 25, 0, 26, - 27, 28, 29, 30, 31, 32, 0, 33, 16, 17, - 18, 19, 0, 0, 0, 0, 0, 23, 24, 25, - 19, 26, 27, 28, 29, 30, 31, 32, 19, 33, - 26, 27, 28, 29, 30, 31, 32, 0, 33, 0, - 0, 29, 30, 31, 32, 0, 33 + 29, 30, 31, 0, 32, 33, 16, 17, 18, 19, + 0, 0, 0, 0, 22, 23, 24, 25, 19, 26, + 27, 28, 29, 30, 31, 0, 32, 33, 16, 17, + 18, 19, 0, 0, 0, 32, 33, 23, 24, 25, + 19, 26, 27, 28, 29, 30, 31, 0, 32, 33, + 26, 27, 28, 29, 30, 31, 0, 32, 33 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-26)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int8 yycheck[] = { 3, 4, 5, 28, 0, -1, 8, 10, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 3, 4, 8, 8, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 17, -1, 19, -1, 24, - -1, 26, 26, 56, -1, -1, 28, 5, 6, 7, + 33, 3, 4, -1, -1, -1, -1, 8, -1, -1, + -1, -1, -1, -1, -1, 17, -1, 19, -1, -1, + 21, 22, 23, 56, 25, 26, 28, 5, 6, 7, 8, -1, 10, -1, 12, 13, 14, 15, 16, -1, - 18, 19, 20, 21, 22, 23, 24, -1, 26, -1, + 18, 19, 20, 21, 22, 23, -1, 25, 26, -1, -1, 29, 5, 6, 7, 8, -1, 10, -1, 12, 13, 14, 15, 16, -1, 18, 19, 20, 21, 22, - 23, 24, -1, 26, -1, -1, 29, 5, 6, 7, + 23, -1, 25, 26, -1, -1, 29, 5, 6, 7, 8, -1, 10, -1, 12, 13, 14, 15, 16, -1, - 18, 19, 20, 21, 22, 23, 24, -1, 26, 27, + 18, 19, 20, 21, 22, 23, -1, 25, 26, 27, 5, 6, 7, 8, 9, 10, -1, 12, 13, 14, - 15, 16, -1, 18, 19, 20, 21, 22, 23, 24, - -1, 26, 5, 6, 7, 8, -1, 10, 11, 12, + 15, 16, -1, 18, 19, 20, 21, 22, 23, -1, + 25, 26, 5, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, -1, 18, 19, 20, 21, 22, - 23, 24, -1, 26, 5, 6, 7, 8, -1, 10, + 23, -1, 25, 26, 5, 6, 7, 8, -1, 10, -1, 12, 13, 14, 15, 16, -1, 18, 19, 20, - 21, 22, 23, 24, -1, 26, 5, 6, 7, 8, - -1, -1, -1, -1, 13, 14, 15, 16, -1, 18, - 19, 20, 21, 22, 23, 24, -1, 26, 5, 6, - 7, 8, -1, -1, -1, -1, -1, 14, 15, 16, - 8, 18, 19, 20, 21, 22, 23, 24, 8, 26, - 18, 19, 20, 21, 22, 23, 24, -1, 26, -1, - -1, 21, 22, 23, 24, -1, 26 + 21, 22, 23, -1, 25, 26, 5, 6, 7, 8, + -1, -1, -1, -1, 13, 14, 15, 16, 8, 18, + 19, 20, 21, 22, 23, -1, 25, 26, 5, 6, + 7, 8, -1, -1, -1, 25, 26, 14, 15, 16, + 8, 18, 19, 20, 21, 22, 23, -1, 25, 26, + 18, 19, 20, 21, 22, 23, -1, 25, 26 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -651,7 +656,7 @@ static const yytype_uint8 yystos[] = 0, 3, 4, 17, 19, 28, 31, 32, 33, 34, 28, 34, 34, 34, 0, 32, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 18, 19, 20, 21, - 22, 23, 24, 26, 34, 29, 34, 34, 34, 34, + 22, 23, 25, 26, 34, 29, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 29, 9, 11, 27, 34 }; @@ -668,9 +673,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -680,7 +694,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -727,7 +740,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -940,7 +953,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1043,115 +1055,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - int yyn = yypact[yystate]; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + 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. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1190,6 +1229,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, line, retval) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1206,12 +1246,9 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1276,7 +1313,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; @@ -1323,7 +1360,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1331,15 +1368,15 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1242 of yacc.c */ +/* Line 1590 of yacc.c */ #line 105 "parse-bison.y" { yylval.num = 0.0; yylloc.start = yylloc.stop = NULL; } -/* Line 1242 of yacc.c */ -#line 1343 "parse-bison.c" +/* Line 1590 of yacc.c */ +#line 1380 "parse-bison.c" yyvsp[0] = yylval; goto yysetstate; @@ -1438,7 +1475,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1469,8 +1506,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1526,214 +1563,225 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 117 "parse-bison.y" - { *retval = NULL; ;} + { *retval = NULL; } break; case 3: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 118 "parse-bison.y" - { *retval = (yyvsp[(1) - (1)].pnode); ;} + { *retval = (yyvsp[(1) - (1)].pnode); } break; case 5: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 123 "parse-bison.y" - { (yyvsp[(1) - (2)].pnode)->pn_next = (yyvsp[(2) - (2)].pnode); (yyvsp[(2) - (2)].pnode)->pn_use ++; (yyval.pnode) = (yyvsp[(1) - (2)].pnode); ;} + { (yyvsp[(1) - (2)].pnode)->pn_next = (yyvsp[(2) - (2)].pnode); (yyvsp[(2) - (2)].pnode)->pn_use ++; (yyval.pnode) = (yyvsp[(1) - (2)].pnode); } break; case 6: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 127 "parse-bison.y" { (yyvsp[(1) - (1)].pnode)->pn_name = copy_substring((yylsp[(1) - (1)]).start, (yylsp[(1) - (1)]).stop); (yyval.pnode) = (yyvsp[(1) - (1)].pnode); - ;} + } break; case 7: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 134 "parse-bison.y" - { (yyval.pnode) = mknnode((yyvsp[(1) - (1)].num)); ;} + { (yyval.pnode) = mknnode((yyvsp[(1) - (1)].num)); } break; case 8: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 135 "parse-bison.y" - { (yyval.pnode) = mksnode((yyvsp[(1) - (1)].str)); txfree((void*)(yyvsp[(1) - (1)].str)); ;} + { (yyval.pnode) = mksnode((yyvsp[(1) - (1)].str)); txfree((void*)(yyvsp[(1) - (1)].str)); } break; case 9: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 137 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_COMMA, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_COMMA, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 10: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 138 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_PLUS, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_PLUS, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 11: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 139 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_MINUS, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_MINUS, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 12: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 140 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_TIMES, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_TIMES, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 13: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 141 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_MOD, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_MOD, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 14: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 142 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_DIVIDE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_DIVIDE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 15: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 143 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_POWER, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_POWER, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 16: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 145 "parse-bison.y" - { (yyval.pnode) = (yyvsp[(2) - (3)].pnode); ;} + { (yyval.pnode) = (yyvsp[(2) - (3)].pnode); } break; case 17: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 147 "parse-bison.y" - { (yyval.pnode) = mkunode(PT_OP_UMINUS, (yyvsp[(2) - (2)].pnode)); ;} + { (yyval.pnode) = mkunode(PT_OP_UMINUS, (yyvsp[(2) - (2)].pnode)); } break; case 18: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 148 "parse-bison.y" - { (yyval.pnode) = mkunode(PT_OP_NOT, (yyvsp[(2) - (2)].pnode)); ;} + { (yyval.pnode) = mkunode(PT_OP_NOT, (yyvsp[(2) - (2)].pnode)); } break; case 19: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 150 "parse-bison.y" { (yyval.pnode) = mkfnode((yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].pnode)); txfree((void*)(yyvsp[(1) - (4)].str)); if(!(yyval.pnode)) YYABORT; - ;} + } break; case 20: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 156 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_EQ, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_EQ, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 21: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 157 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_NE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_NE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 22: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 158 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_GT, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_GT, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 23: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 159 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_LT, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_LT, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 24: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 160 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_GE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_GE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 25: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 161 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_LE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_LE, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 26: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 163 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_AND, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_AND, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 27: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 164 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_OR, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_OR, (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 28: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 166 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_INDX, (yyvsp[(1) - (4)].pnode), (yyvsp[(3) - (4)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_INDX, (yyvsp[(1) - (4)].pnode), (yyvsp[(3) - (4)].pnode)); } break; case 29: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 167 "parse-bison.y" - { (yyval.pnode) = mkbnode(PT_OP_RANGE, (yyvsp[(1) - (4)].pnode), (yyvsp[(3) - (4)].pnode)); ;} + { (yyval.pnode) = mkbnode(PT_OP_RANGE, (yyvsp[(1) - (4)].pnode), (yyvsp[(3) - (4)].pnode)); } break; case 30: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 168 "parse-bison.y" { (yyval.pnode) = mkbnode(PT_OP_TERNARY,(yyvsp[(1) - (5)].pnode), - mkbnode(PT_OP_COMMA,(yyvsp[(3) - (5)].pnode),(yyvsp[(5) - (5)].pnode))); ;} + mkbnode(PT_OP_COMMA,(yyvsp[(3) - (5)].pnode),(yyvsp[(5) - (5)].pnode))); } break; -/* Line 1455 of yacc.c */ -#line 1735 "parse-bison.c" +/* Line 1806 of yacc.c */ +#line 1772 "parse-bison.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + 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 ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -1762,6 +1810,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -1769,41 +1821,40 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (&yylloc, line, retval, YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (&yylloc, line, retval, yymsg); - } - else - { - yyerror (&yylloc, line, retval, YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (&yylloc, line, retval, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } - yyerror_range[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus == 3) { @@ -1840,7 +1891,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[0] = yylsp[1-yylen]; + yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -1859,7 +1910,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -1874,7 +1925,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[0] = *yylsp; + yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, line, retval); YYPOPSTACK (1); @@ -1884,10 +1935,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -1923,8 +1974,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc, line, retval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, line, retval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -1949,7 +2005,7 @@ yyreturn: -/* Line 1675 of yacc.c */ +/* Line 2067 of yacc.c */ #line 172 "parse-bison.y" diff --git a/src/frontend/parse-bison.h b/src/frontend/parse-bison.h index 280e9ee68..3d4b24b06 100644 --- a/src/frontend/parse-bison.h +++ b/src/frontend/parse-bison.h @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -56,7 +54,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 2068 of yacc.c */ #line 53 "parse-bison.y" double num; @@ -65,8 +63,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 70 "parse-bison.h" +/* Line 2068 of yacc.c */ +#line 68 "parse-bison.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/spicelib/parser/inpptree-parser.c b/src/spicelib/parser/inpptree-parser.c index 88468d961..37ad282bb 100644 --- a/src/spicelib/parser/inpptree-parser.c +++ b/src/spicelib/parser/inpptree-parser.c @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -46,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -75,7 +73,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 1 "inpptree-parser.y" /* @@ -116,8 +114,8 @@ -/* Line 189 of yacc.c */ -#line 121 "inpptree-parser.c" +/* Line 268 of yacc.c */ +#line 119 "inpptree-parser.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -165,7 +163,7 @@ typedef union YYSTYPE { -/* Line 214 of yacc.c */ +/* Line 293 of yacc.c */ #line 53 "inpptree-parser.y" double num; @@ -174,8 +172,8 @@ typedef union YYSTYPE -/* Line 214 of yacc.c */ -#line 179 "inpptree-parser.c" +/* Line 293 of yacc.c */ +#line 177 "inpptree-parser.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -199,8 +197,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 204 "inpptree-parser.c" +/* Line 343 of yacc.c */ +#line 202 "inpptree-parser.c" #ifdef short # undef short @@ -250,7 +248,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -303,11 +301,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -330,24 +328,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -378,23 +376,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -414,10 +396,30 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 13 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 136 +#define YYLAST 144 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 26 @@ -441,13 +443,13 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 22, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 21, 2, 2, 2, 2, 2, 2, 24, 25, 19, 18, 12, 17, 2, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 14, 2, 2, 2, 2, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 21, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 23, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -464,7 +466,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 15, 16, 23 + 5, 6, 7, 8, 9, 10, 11, 15, 16, 22 }; #if YYDEBUG @@ -482,13 +484,13 @@ static const yytype_int8 yyrhs[] = { 27, 0, -1, 28, -1, 3, -1, 4, -1, 28, 18, 28, -1, 28, 17, 28, -1, 28, 19, 28, - -1, 28, 20, 28, -1, 28, 21, 28, -1, 24, + -1, 28, 20, 28, -1, 28, 23, 28, -1, 24, 28, 25, -1, 17, 28, -1, 4, 24, 29, 25, -1, 5, -1, 28, 13, 28, 14, 28, -1, 28, 10, 28, -1, 28, 11, 28, -1, 28, 9, 28, -1, 28, 7, 28, -1, 28, 8, 28, -1, 28, 6, 28, -1, 28, 15, 28, -1, 28, 16, 28, - -1, 22, 28, -1, 28, -1, 29, 12, 28, -1 + -1, 21, 28, -1, 28, -1, 29, 12, 28, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -507,8 +509,8 @@ static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_NUM", "TOK_STR", "TOK_pnode", "TOK_LE", "TOK_LT", "TOK_GE", "TOK_GT", "TOK_EQ", "TOK_NE", "','", "'?'", - "':'", "TOK_OR", "TOK_AND", "'-'", "'+'", "'*'", "'/'", "'^'", "'!'", - "NEG", "'('", "')'", "$accept", "expression", "exp", "nonempty_arglist", 0 + "':'", "TOK_OR", "TOK_AND", "'-'", "'+'", "'*'", "'/'", "'!'", "NEG", + "'^'", "'('", "')'", "$accept", "expression", "exp", "nonempty_arglist", 0 }; #endif @@ -519,7 +521,7 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 44, 63, 58, 267, 268, 45, 43, 42, - 47, 94, 33, 269, 40, 41 + 47, 33, 269, 94, 40, 41 }; # endif @@ -539,8 +541,8 @@ static const yytype_uint8 yyr2[] = 3, 3, 3, 2, 1, 3 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -559,70 +561,77 @@ static const yytype_int8 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -22 +#define YYPACT_NINF -19 static const yytype_int8 yypact[] = { - 22, -22, -21, -22, 22, 22, 22, 4, 77, 22, - -22, -22, 41, -22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 77, 12, - -22, 11, 11, 11, 11, 115, 115, 61, 93, 109, - -13, -13, -12, -12, -22, 22, -22, 22, 77, 77 + 21, -19, -18, -19, 21, 21, 21, 8, 78, 21, + -14, -14, 40, -19, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 78, 15, + -19, 11, 11, 11, 11, 121, 121, 60, 96, 114, + -16, -16, -14, -14, -19, 21, -19, 21, 78, 78 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -22, -22, -4, -22 + -19, -19, -4, -19 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 10, 11, 12, 9, 13, 28, 25, 26, 27, 27, + 10, 11, 12, 25, 26, 28, 9, 27, 13, 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 1, 2, 3, 23, 24, - 25, 26, 27, 0, 0, 0, 0, 46, 0, 4, - 0, 48, 0, 49, 5, 0, 6, 14, 15, 16, - 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, - 25, 26, 27, 0, 0, 0, 30, 14, 15, 16, - 17, 18, 19, 0, 20, 47, 21, 22, 23, 24, - 25, 26, 27, 14, 15, 16, 17, 18, 19, 0, - 20, 0, 21, 22, 23, 24, 25, 26, 27, 14, - 15, 16, 17, 18, 19, 0, 0, 0, 0, 22, - 23, 24, 25, 26, 27, 14, 15, 16, 17, 18, - 19, 14, 15, 16, 17, 0, 23, 24, 25, 26, - 27, 0, 23, 24, 25, 26, 27 + 41, 42, 43, 44, 1, 2, 3, 45, 23, 24, + 25, 26, 0, 0, 27, 0, 0, 0, 4, 0, + 46, 48, 5, 49, 0, 6, 14, 15, 16, 17, + 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, + 26, 0, 0, 27, 0, 30, 14, 15, 16, 17, + 18, 19, 0, 20, 47, 21, 22, 23, 24, 25, + 26, 0, 0, 27, 14, 15, 16, 17, 18, 19, + 0, 20, 0, 21, 22, 23, 24, 25, 26, 0, + 0, 27, 14, 15, 16, 17, 18, 19, 0, 0, + 0, 0, 22, 23, 24, 25, 26, 0, 0, 27, + 14, 15, 16, 17, 18, 19, 0, 14, 15, 16, + 17, 23, 24, 25, 26, 0, 0, 27, 23, 24, + 25, 26, 0, 0, 27 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-19)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int8 yycheck[] = { - 4, 5, 6, 24, 0, 9, 19, 20, 21, 21, + 4, 5, 6, 19, 20, 9, 24, 23, 0, 23, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 12, 3, 4, 5, 17, 18, - 19, 20, 21, -1, -1, -1, -1, 25, -1, 17, - -1, 45, -1, 47, 22, -1, 24, 6, 7, 8, - 9, 10, 11, -1, 13, -1, 15, 16, 17, 18, - 19, 20, 21, -1, -1, -1, 25, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 6, 7, 8, 9, 10, 11, -1, - 13, -1, 15, 16, 17, 18, 19, 20, 21, 6, - 7, 8, 9, 10, 11, -1, -1, -1, -1, 16, - 17, 18, 19, 20, 21, 6, 7, 8, 9, 10, - 11, 6, 7, 8, 9, -1, 17, 18, 19, 20, - 21, -1, 17, 18, 19, 20, 21 + 24, 25, 26, 27, 3, 4, 5, 12, 17, 18, + 19, 20, -1, -1, 23, -1, -1, -1, 17, -1, + 25, 45, 21, 47, -1, 24, 6, 7, 8, 9, + 10, 11, -1, 13, -1, 15, 16, 17, 18, 19, + 20, -1, -1, 23, -1, 25, 6, 7, 8, 9, + 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, + 20, -1, -1, 23, 6, 7, 8, 9, 10, 11, + -1, 13, -1, 15, 16, 17, 18, 19, 20, -1, + -1, 23, 6, 7, 8, 9, 10, 11, -1, -1, + -1, -1, 16, 17, 18, 19, 20, -1, -1, 23, + 6, 7, 8, 9, 10, 11, -1, 6, 7, 8, + 9, 17, 18, 19, 20, -1, -1, 23, 17, 18, + 19, 20, -1, -1, 23 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 5, 17, 22, 24, 27, 28, 24, + 0, 3, 4, 5, 17, 21, 24, 27, 28, 24, 28, 28, 28, 0, 6, 7, 8, 9, 10, 11, - 13, 15, 16, 17, 18, 19, 20, 21, 28, 29, + 13, 15, 16, 17, 18, 19, 20, 23, 28, 29, 25, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 12, 25, 14, 28, 28 }; @@ -639,9 +648,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -651,7 +669,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -698,7 +715,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -915,7 +932,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1018,115 +1034,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - int yyn = yypact[yystate]; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + 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. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1167,6 +1210,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, line, retval, ckt) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1183,12 +1227,9 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1254,7 +1295,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; @@ -1301,7 +1342,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1309,15 +1350,15 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1242 of yacc.c */ +/* Line 1590 of yacc.c */ #line 80 "inpptree-parser.y" { yylval.num = 0.0; yylloc.start = yylloc.stop = NULL; } -/* Line 1242 of yacc.c */ -#line 1321 "inpptree-parser.c" +/* Line 1590 of yacc.c */ +#line 1362 "inpptree-parser.c" yyvsp[0] = yylval; goto yysetstate; @@ -1416,7 +1457,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1447,8 +1488,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1504,177 +1545,188 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 88 "inpptree-parser.y" { *retval = (yyvsp[(1) - (1)].pnode); *line = (yylsp[(1) - (1)]).stop; YYACCEPT; - ;} + } break; case 3: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 96 "inpptree-parser.y" - { (yyval.pnode) = mknnode((yyvsp[(1) - (1)].num)); ;} + { (yyval.pnode) = mknnode((yyvsp[(1) - (1)].num)); } break; case 4: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 97 "inpptree-parser.y" - { (yyval.pnode) = mksnode((yyvsp[(1) - (1)].str), ckt); txfree((void*)(yyvsp[(1) - (1)].str)); ;} + { (yyval.pnode) = mksnode((yyvsp[(1) - (1)].str), ckt); txfree((void*)(yyvsp[(1) - (1)].str)); } break; case 5: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 99 "inpptree-parser.y" - { (yyval.pnode) = mkbnode("+", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode("+", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 6: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 100 "inpptree-parser.y" - { (yyval.pnode) = mkbnode("-", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode("-", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 7: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 101 "inpptree-parser.y" - { (yyval.pnode) = mkbnode("*", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode("*", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 8: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 102 "inpptree-parser.y" - { (yyval.pnode) = mkbnode("/", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode("/", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 9: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 103 "inpptree-parser.y" - { (yyval.pnode) = mkbnode("^", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode("^", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; case 10: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 105 "inpptree-parser.y" - { (yyval.pnode) = (yyvsp[(2) - (3)].pnode); ;} + { (yyval.pnode) = (yyvsp[(2) - (3)].pnode); } break; case 11: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 107 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("-",(yyvsp[(2) - (2)].pnode)); ;} + { (yyval.pnode) = mkfnode("-",(yyvsp[(2) - (2)].pnode)); } break; case 12: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 109 "inpptree-parser.y" - { (yyval.pnode) = mkfnode((yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].pnode)); txfree((void*)(yyvsp[(1) - (4)].str)); ;} + { (yyval.pnode) = mkfnode((yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].pnode)); txfree((void*)(yyvsp[(1) - (4)].str)); } break; case 14: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 113 "inpptree-parser.y" { (yyval.pnode) = mkfnode("ternary_fcn", mkbnode(",", mkbnode(",", (yyvsp[(1) - (5)].pnode), (yyvsp[(3) - (5)].pnode)), - (yyvsp[(5) - (5)].pnode))); ;} + (yyvsp[(5) - (5)].pnode))); } break; case 15: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 118 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("eq0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); ;} + { (yyval.pnode) = mkfnode("eq0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); } break; case 16: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 119 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("ne0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); ;} + { (yyval.pnode) = mkfnode("ne0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); } break; case 17: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 120 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("gt0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); ;} + { (yyval.pnode) = mkfnode("gt0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); } break; case 18: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 121 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("lt0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); ;} + { (yyval.pnode) = mkfnode("lt0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); } break; case 19: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 122 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("ge0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); ;} + { (yyval.pnode) = mkfnode("ge0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); } break; case 20: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 123 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("le0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); ;} + { (yyval.pnode) = mkfnode("le0", mkbnode("-",(yyvsp[(1) - (3)].pnode),(yyvsp[(3) - (3)].pnode))); } break; case 21: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 125 "inpptree-parser.y" { (yyval.pnode) = mkfnode("ne0", mkbnode("+", mkfnode("ne0", (yyvsp[(1) - (3)].pnode)), - mkfnode("ne0", (yyvsp[(3) - (3)].pnode)))); ;} + mkfnode("ne0", (yyvsp[(3) - (3)].pnode)))); } break; case 22: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 129 "inpptree-parser.y" { (yyval.pnode) = mkfnode("eq0", mkbnode("+", mkfnode("eq0", (yyvsp[(1) - (3)].pnode)), - mkfnode("eq0", (yyvsp[(3) - (3)].pnode)))); ;} + mkfnode("eq0", (yyvsp[(3) - (3)].pnode)))); } break; case 23: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 133 "inpptree-parser.y" - { (yyval.pnode) = mkfnode("eq0", (yyvsp[(2) - (2)].pnode)); ;} + { (yyval.pnode) = mkfnode("eq0", (yyvsp[(2) - (2)].pnode)); } break; case 25: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 139 "inpptree-parser.y" - { (yyval.pnode) = mkbnode(",", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); ;} + { (yyval.pnode) = mkbnode(",", (yyvsp[(1) - (3)].pnode), (yyvsp[(3) - (3)].pnode)); } break; -/* Line 1455 of yacc.c */ -#line 1676 "inpptree-parser.c" +/* Line 1806 of yacc.c */ +#line 1717 "inpptree-parser.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + 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 ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -1703,6 +1755,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -1710,41 +1766,40 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (&yylloc, line, retval, ckt, YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (&yylloc, line, retval, ckt, yymsg); - } - else - { - yyerror (&yylloc, line, retval, ckt, YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (&yylloc, line, retval, ckt, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } - yyerror_range[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus == 3) { @@ -1781,7 +1836,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[0] = yylsp[1-yylen]; + yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -1800,7 +1855,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -1815,7 +1870,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[0] = *yylsp; + yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, line, retval, ckt); YYPOPSTACK (1); @@ -1825,10 +1880,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -1864,8 +1919,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc, line, retval, ckt); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, line, retval, ckt); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -1890,7 +1950,7 @@ yyreturn: -/* Line 1675 of yacc.c */ +/* Line 2067 of yacc.c */ #line 141 "inpptree-parser.y" diff --git a/src/spicelib/parser/inpptree-parser.h b/src/spicelib/parser/inpptree-parser.h index 346f7a454..2d53afe80 100644 --- a/src/spicelib/parser/inpptree-parser.h +++ b/src/spicelib/parser/inpptree-parser.h @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -60,7 +58,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 2068 of yacc.c */ #line 53 "inpptree-parser.y" double num; @@ -69,8 +67,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 74 "inpptree-parser.h" +/* Line 2068 of yacc.c */ +#line 72 "inpptree-parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */