diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2019-12-16 21:55:41 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2019-12-16 21:55:41 +0200 |
commit | ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0 (patch) | |
tree | a74244272222f3e9fd2c8414fe2a79c2fcbb76dd | |
parent | 6d1580bfd328fbbb04f4b5627032602dd8dfe98c (diff) | |
download | egawk-ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0.tar.gz egawk-ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0.tar.bz2 egawk-ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0.zip |
Update to Bison 3.5.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | awkgram.c | 1066 | ||||
-rw-r--r-- | command.c | 575 |
4 files changed, 914 insertions, 734 deletions
@@ -1,3 +1,8 @@ +2019-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y, command.y: Upgrade to Bison 3.5. + * NEWS: Updated. + 2019-11-21 Arnold D. Robbins <arnold@skeeve.com> * config.rpath: Update from GNULIB. @@ -12,7 +12,7 @@ Changes from 5.0.1 to 5.1.0 2. A number of memory leak issues have been fixed. -3. Infrastructure upgrades: Bison 3.4.2, Texinfo 6.7. +3. Infrastructure upgrades: Bison 3.5, Texinfo 6.7. 4. The indexing in the manual has been thoroughly revised, in particular making use of the facilities in Texinfo 6.7. That version (or newer) @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.4.2. */ +/* A Bison parser, made by GNU Bison 3.5. */ /* Bison implementation for Yacc-like parsers in C @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.4.2" +#define YYBISON_VERSION "3.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -233,6 +233,15 @@ extern double fmod(double x, double y); #line 235 "awkgram.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast<Type> (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus @@ -397,28 +406,75 @@ int yyparse (void); # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + <limits.h> and (if available) <stdint.h> are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include <limits.h> /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -426,7 +482,7 @@ typedef short yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -434,7 +490,19 @@ typedef short yytype_int16; # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int16 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -448,22 +516,20 @@ typedef short yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif #endif /* Suppress unused-variable warnings by "using" E. */ @@ -475,11 +541,11 @@ typedef short yytype_int16; #if defined __GNUC__ && ! defined __ICC && 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\"")\ +# 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 \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -492,6 +558,18 @@ typedef short yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + #define YY_ASSERT(E) ((void) (0 && (E))) @@ -570,17 +648,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -593,11 +671,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -609,12 +687,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -640,14 +718,15 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 310 + /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ -static const yytype_uint8 yytranslate[] = +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -685,7 +764,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { 0, 232, 232, 233, 238, 248, 252, 264, 272, 286, 297, 307, 317, 330, 340, 342, 347, 357, 359, 364, @@ -750,7 +829,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -763,15 +842,15 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -283 +#define YYPACT_NINF (-283) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-283))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -119 +#define YYTABLE_NINF (-119) -#define yytable_value_is_error(Yytable_value) \ - (!!((Yytable_value) == (-119))) +#define yytable_value_is_error(Yyn) \ + ((Yyn) == YYTABLE_NINF) /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ @@ -1204,7 +1283,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 1, 2, 1, 1, 2, 1, 1, @@ -1338,7 +1417,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1361,12 +1440,12 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) @@ -1418,13 +1497,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -1460,12 +1539,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1496,10 +1575,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1512,19 +1591,19 @@ yytnamerr (char *yyres, const char *yystr) *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) +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int 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_NULLPTR; - /* Arguments of yyformat. */ + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -1552,6 +1631,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1576,7 +1657,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else @@ -1603,7 +1685,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else @@ -1633,8 +1717,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; @@ -1677,7 +1761,7 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1689,16 +1773,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYSIZE_T yystacksize; + YYPTRDIFF_T yystacksize; int yyn; int yyresult; @@ -1712,7 +1796,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1744,12 +1828,14 @@ yynewstate: /*--------------------------------------------------------------------. -| yynewstate -- set current state (the top of the stack) to yystate. | +| yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - *yyssp = (yytype_int16) yystate; + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE @@ -1757,23 +1843,23 @@ yysetstate: #else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); + YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; @@ -1787,9 +1873,10 @@ yysetstate: yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); @@ -1803,8 +1890,10 @@ yysetstate: yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; @@ -1870,14 +1959,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1914,22 +2002,22 @@ yyreduce: { case 2: #line 232 "awkgram.y" - { yyval = NULL; } -#line 1919 "awkgram.c" + { yyval = NULL; } +#line 2007 "awkgram.c" break; case 3: #line 234 "awkgram.y" - { + { rule = 0; yyerrok; } -#line 1928 "awkgram.c" +#line 2016 "awkgram.c" break; case 4: #line 239 "awkgram.y" - { + { if (yyvsp[0] != NULL) { if (yyvsp[-1] == NULL) outer_comment = yyvsp[0]; @@ -1938,20 +2026,20 @@ yyreduce: } yyval = yyvsp[-1]; } -#line 1942 "awkgram.c" +#line 2030 "awkgram.c" break; case 5: #line 249 "awkgram.y" - { + { next_sourcefile(); } -#line 1950 "awkgram.c" +#line 2038 "awkgram.c" break; case 6: #line 253 "awkgram.y" - { + { rule = 0; /* * If errors, give up, don't produce an infinite @@ -1959,24 +2047,24 @@ yyreduce: */ /* yyerrok; */ } -#line 1963 "awkgram.c" +#line 2051 "awkgram.c" break; case 7: #line 265 "awkgram.y" - { + { (void) append_rule(yyvsp[-1], yyvsp[0]); if (pending_comment != NULL) { interblock_comment = pending_comment; pending_comment = NULL; } } -#line 1975 "awkgram.c" +#line 2063 "awkgram.c" break; case 8: #line 273 "awkgram.y" - { + { if (rule != Rule) { msg(_("%s blocks must have an action part"), ruletab[rule]); errcount++; @@ -1989,12 +2077,12 @@ yyreduce: (void) append_rule(yyvsp[-1], NULL); } } -#line 1993 "awkgram.c" +#line 2081 "awkgram.c" break; case 9: #line 287 "awkgram.y" - { + { in_function = false; (void) mk_function(yyvsp[-1], yyvsp[0]); want_param_names = DONT_CHECK; @@ -2004,12 +2092,12 @@ yyreduce: } yyerrok; } -#line 2008 "awkgram.c" +#line 2096 "awkgram.c" break; case 10: #line 298 "awkgram.y" - { + { want_source = false; at_seen = false; if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { @@ -2018,12 +2106,12 @@ yyreduce: } yyerrok; } -#line 2022 "awkgram.c" +#line 2110 "awkgram.c" break; case 11: #line 308 "awkgram.y" - { + { want_source = false; at_seen = false; if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { @@ -2032,12 +2120,12 @@ yyreduce: } yyerrok; } -#line 2036 "awkgram.c" +#line 2124 "awkgram.c" break; case 12: #line 318 "awkgram.y" - { + { want_source = false; at_seen = false; @@ -2046,12 +2134,12 @@ yyreduce: yyerrok; } -#line 2050 "awkgram.c" +#line 2138 "awkgram.c" break; case 13: #line 331 "awkgram.y" - { + { void *srcfile = NULL; if (! include_source(yyvsp[0], & srcfile)) @@ -2060,24 +2148,24 @@ yyreduce: bcfree(yyvsp[0]); yyval = (INSTRUCTION *) srcfile; } -#line 2064 "awkgram.c" +#line 2152 "awkgram.c" break; case 14: #line 341 "awkgram.y" - { yyval = NULL; } -#line 2070 "awkgram.c" + { yyval = NULL; } +#line 2158 "awkgram.c" break; case 15: #line 343 "awkgram.y" - { yyval = NULL; } -#line 2076 "awkgram.c" + { yyval = NULL; } +#line 2164 "awkgram.c" break; case 16: #line 348 "awkgram.y" - { + { void *srcfile; if (! load_library(yyvsp[0], & srcfile)) @@ -2086,59 +2174,59 @@ yyreduce: bcfree(yyvsp[0]); yyval = (INSTRUCTION *) srcfile; } -#line 2090 "awkgram.c" +#line 2178 "awkgram.c" break; case 17: #line 358 "awkgram.y" - { yyval = NULL; } -#line 2096 "awkgram.c" + { yyval = NULL; } +#line 2184 "awkgram.c" break; case 18: #line 360 "awkgram.y" - { yyval = NULL; } -#line 2102 "awkgram.c" + { yyval = NULL; } +#line 2190 "awkgram.c" break; case 19: #line 365 "awkgram.y" - { yyval = yyvsp[0]; } -#line 2108 "awkgram.c" + { yyval = yyvsp[0]; } +#line 2196 "awkgram.c" break; case 20: #line 367 "awkgram.y" - { yyval = NULL; } -#line 2114 "awkgram.c" + { yyval = NULL; } +#line 2202 "awkgram.c" break; case 21: #line 369 "awkgram.y" - { yyval = NULL; } -#line 2120 "awkgram.c" + { yyval = NULL; } +#line 2208 "awkgram.c" break; case 22: #line 374 "awkgram.y" - { + { rule = Rule; yyval = NULL; } -#line 2129 "awkgram.c" +#line 2217 "awkgram.c" break; case 23: #line 379 "awkgram.y" - { + { rule = Rule; } -#line 2137 "awkgram.c" +#line 2225 "awkgram.c" break; case 24: #line 384 "awkgram.y" - { + { INSTRUCTION *tp; add_lint(yyvsp[-2], LINT_assign_in_cond); @@ -2167,12 +2255,12 @@ yyreduce: yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp); rule = Rule; } -#line 2171 "awkgram.c" +#line 2259 "awkgram.c" break; case 25: #line 414 "awkgram.y" - { + { static int begin_seen = 0; if (do_lint_old && ++begin_seen == 2) @@ -2183,12 +2271,12 @@ yyreduce: yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2187 "awkgram.c" +#line 2275 "awkgram.c" break; case 26: #line 426 "awkgram.y" - { + { static int end_seen = 0; if (do_lint_old && ++end_seen == 2) @@ -2199,32 +2287,32 @@ yyreduce: yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2203 "awkgram.c" +#line 2291 "awkgram.c" break; case 27: #line 438 "awkgram.y" - { + { yyvsp[0]->in_rule = rule = BEGINFILE; yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2213 "awkgram.c" +#line 2301 "awkgram.c" break; case 28: #line 444 "awkgram.y" - { + { yyvsp[0]->in_rule = rule = ENDFILE; yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2223 "awkgram.c" +#line 2311 "awkgram.c" break; case 29: #line 453 "awkgram.y" - { + { INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yyvsp[-2]); if (yyvsp[-2] != NULL && yyvsp[0] != NULL) { @@ -2238,12 +2326,12 @@ yyreduce: yyval = ip; } -#line 2242 "awkgram.c" +#line 2330 "awkgram.c" break; case 31: #line 472 "awkgram.y" - { + { const char *name = yyvsp[0]->lextok; char *qname = qualify_name(name, strlen(name)); @@ -2253,37 +2341,37 @@ yyreduce: } yyval = yyvsp[0]; } -#line 2257 "awkgram.c" +#line 2345 "awkgram.c" break; case 32: #line 483 "awkgram.y" - { + { yyerror(_("`%s' is a built-in function, it cannot be redefined"), tokstart); YYABORT; } -#line 2267 "awkgram.c" +#line 2355 "awkgram.c" break; case 33: #line 489 "awkgram.y" - { + { yyval = yyvsp[0]; at_seen = false; } -#line 2276 "awkgram.c" +#line 2364 "awkgram.c" break; case 36: #line 501 "awkgram.y" - { want_param_names = FUNC_HEADER; } -#line 2282 "awkgram.c" + { want_param_names = FUNC_HEADER; } +#line 2370 "awkgram.c" break; case 37: #line 502 "awkgram.y" - { + { INSTRUCTION *func_comment = NULL; // Merge any comments found in the parameter list with those // following the function header, associate the whole shebang @@ -2308,18 +2396,18 @@ yyreduce: yyval = yyvsp[-6]; want_param_names = FUNC_BODY; } -#line 2312 "awkgram.c" +#line 2400 "awkgram.c" break; case 38: #line 535 "awkgram.y" - { want_regexp = true; } -#line 2318 "awkgram.c" + { want_regexp = true; } +#line 2406 "awkgram.c" break; case 39: #line 537 "awkgram.y" - { + { NODE *n, *exp; char *re; size_t len; @@ -2347,12 +2435,12 @@ yyreduce: yyval->opcode = Op_match_rec; yyval->memory = n; } -#line 2351 "awkgram.c" +#line 2439 "awkgram.c" break; case 40: #line 569 "awkgram.y" - { + { char *re; size_t len; @@ -2364,24 +2452,24 @@ yyreduce: yyval->opcode = Op_push_re; yyval->memory = make_typed_regex(re, len); } -#line 2368 "awkgram.c" +#line 2456 "awkgram.c" break; case 41: #line 584 "awkgram.y" - { bcfree(yyvsp[0]); } -#line 2374 "awkgram.c" + { bcfree(yyvsp[0]); } +#line 2462 "awkgram.c" break; case 43: #line 590 "awkgram.y" - { yyval = NULL; } -#line 2380 "awkgram.c" + { yyval = NULL; } +#line 2468 "awkgram.c" break; case 44: #line 592 "awkgram.y" - { + { if (yyvsp[0] == NULL) { yyval = yyvsp[-1]; } else { @@ -2400,30 +2488,30 @@ yyreduce: yyerrok; } -#line 2404 "awkgram.c" +#line 2492 "awkgram.c" break; case 45: #line 612 "awkgram.y" - { yyval = NULL; } -#line 2410 "awkgram.c" + { yyval = NULL; } +#line 2498 "awkgram.c" break; case 46: #line 616 "awkgram.y" - { yyval = yyvsp[0]; } -#line 2416 "awkgram.c" + { yyval = yyvsp[0]; } +#line 2504 "awkgram.c" break; case 47: #line 617 "awkgram.y" - { yyval = yyvsp[0]; } -#line 2422 "awkgram.c" + { yyval = yyvsp[0]; } +#line 2510 "awkgram.c" break; case 48: #line 622 "awkgram.y" - { + { if (yyvsp[0] != NULL) { INSTRUCTION *ip; @@ -2433,32 +2521,32 @@ yyreduce: } else yyval = NULL; } -#line 2437 "awkgram.c" +#line 2525 "awkgram.c" break; case 49: #line 633 "awkgram.y" - { + { trailing_comment = yyvsp[0]; // NULL or comment yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]); } -#line 2446 "awkgram.c" +#line 2534 "awkgram.c" break; case 50: #line 638 "awkgram.y" - { + { if (do_pretty_print) yyval = list_prepend(yyvsp[0], instruction(Op_exec_count)); else yyval = yyvsp[0]; } -#line 2457 "awkgram.c" +#line 2545 "awkgram.c" break; case 51: #line 645 "awkgram.y" - { + { INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt; INSTRUCTION *ip, *nextc, *tbreak; const char **case_values = NULL; @@ -2565,12 +2653,12 @@ yyreduce: break_allowed--; fix_break_continue(ip, tbreak, NULL); } -#line 2569 "awkgram.c" +#line 2657 "awkgram.c" break; case 52: #line 753 "awkgram.y" - { + { /* * ----------------- * tc: @@ -2620,12 +2708,12 @@ yyreduce: continue_allowed--; fix_break_continue(ip, tbreak, tcont); } -#line 2624 "awkgram.c" +#line 2712 "awkgram.c" break; case 53: #line 804 "awkgram.y" - { + { /* * ----------------- * z: @@ -2674,12 +2762,12 @@ yyreduce: /* else $1 and $4 are NULLs */ } -#line 2678 "awkgram.c" +#line 2766 "awkgram.c" break; case 54: #line 854 "awkgram.y" - { + { INSTRUCTION *ip; char *var_name = yyvsp[-5]->lextok; @@ -2804,12 +2892,12 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2808 "awkgram.c" +#line 2896 "awkgram.c" break; case 55: #line 980 "awkgram.y" - { + { if (yyvsp[-7] != NULL) { merge_comments(yyvsp[-7], NULL); yyvsp[-11]->comment = yyvsp[-7]; @@ -2829,12 +2917,12 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2833 "awkgram.c" +#line 2921 "awkgram.c" break; case 56: #line 1001 "awkgram.y" - { + { if (yyvsp[-6] != NULL) { merge_comments(yyvsp[-6], NULL); yyvsp[-10]->comment = yyvsp[-6]; @@ -2854,23 +2942,23 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2858 "awkgram.c" +#line 2946 "awkgram.c" break; case 57: #line 1022 "awkgram.y" - { + { if (do_pretty_print) yyval = list_prepend(yyvsp[0], instruction(Op_exec_count)); else yyval = yyvsp[0]; } -#line 2869 "awkgram.c" +#line 2957 "awkgram.c" break; case 58: #line 1032 "awkgram.y" - { + { if (! break_allowed) error_ln(yyvsp[-1]->source_line, _("`break' is not allowed outside a loop or switch")); @@ -2879,12 +2967,12 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2883 "awkgram.c" +#line 2971 "awkgram.c" break; case 59: #line 1042 "awkgram.y" - { + { if (! continue_allowed) error_ln(yyvsp[-1]->source_line, _("`continue' is not allowed outside a loop")); @@ -2893,12 +2981,12 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2897 "awkgram.c" +#line 2985 "awkgram.c" break; case 60: #line 1052 "awkgram.y" - { + { /* if inside function (rule = 0), resolve context at run-time */ if (rule && rule != Rule) error_ln(yyvsp[-1]->source_line, @@ -2908,12 +2996,12 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2912 "awkgram.c" +#line 3000 "awkgram.c" break; case 61: #line 1063 "awkgram.y" - { + { /* if inside function (rule = 0), resolve context at run-time */ if (rule == BEGIN || rule == END || rule == ENDFILE) error_ln(yyvsp[-1]->source_line, @@ -2925,12 +3013,12 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2929 "awkgram.c" +#line 3017 "awkgram.c" break; case 62: #line 1076 "awkgram.y" - { + { /* Initialize the two possible jump targets, the actual target * is resolved at run-time. */ @@ -2946,21 +3034,21 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2950 "awkgram.c" +#line 3038 "awkgram.c" break; case 63: #line 1093 "awkgram.y" - { + { if (! in_function) yyerror(_("`return' used outside function context")); } -#line 2959 "awkgram.c" +#line 3047 "awkgram.c" break; case 64: #line 1096 "awkgram.y" - { + { if (called_from_eval) yyvsp[-3]->opcode = Op_K_return_from_eval; @@ -2973,29 +3061,29 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2977 "awkgram.c" +#line 3065 "awkgram.c" break; case 65: #line 1110 "awkgram.y" - { + { if (yyvsp[0] != NULL) yyval = list_append(yyvsp[-1], yyvsp[0]); else yyval = yyvsp[-1]; } -#line 2988 "awkgram.c" +#line 3076 "awkgram.c" break; case 66: #line 1127 "awkgram.y" - { in_print = true; in_parens = 0; } -#line 2994 "awkgram.c" + { in_print = true; in_parens = 0; } +#line 3082 "awkgram.c" break; case 67: #line 1128 "awkgram.y" - { + { /* * Optimization: plain `print' has no expression list, so $3 is null. * If $3 is NULL or is a bytecode list for $0 use Op_K_print_rec, @@ -3095,18 +3183,18 @@ regular_print: } } } -#line 3099 "awkgram.c" +#line 3187 "awkgram.c" break; case 68: #line 1229 "awkgram.y" - { sub_counter = 0; } -#line 3105 "awkgram.c" + { sub_counter = 0; } +#line 3193 "awkgram.c" break; case 69: #line 1230 "awkgram.y" - { + { char *arr = yyvsp[-2]->lextok; yyvsp[-2]->opcode = Op_push_array; @@ -3138,12 +3226,12 @@ regular_print: yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyvsp[-3]); } } -#line 3142 "awkgram.c" +#line 3230 "awkgram.c" break; case 70: #line 1267 "awkgram.y" - { + { static bool warned = false; char *arr = yyvsp[-1]->lextok; @@ -3168,55 +3256,55 @@ regular_print: fatal(_("`delete' is not allowed with FUNCTAB")); } } -#line 3172 "awkgram.c" +#line 3260 "awkgram.c" break; case 71: #line 1293 "awkgram.y" - { + { yyval = optimize_assignment(yyvsp[0]); } -#line 3180 "awkgram.c" +#line 3268 "awkgram.c" break; case 72: #line 1300 "awkgram.y" - { yyval = NULL; } -#line 3186 "awkgram.c" + { yyval = NULL; } +#line 3274 "awkgram.c" break; case 73: #line 1302 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3192 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3280 "awkgram.c" break; case 74: #line 1307 "awkgram.y" - { yyval = NULL; } -#line 3198 "awkgram.c" + { yyval = NULL; } +#line 3286 "awkgram.c" break; case 75: #line 1309 "awkgram.y" - { + { if (yyvsp[-1] == NULL) yyval = list_create(yyvsp[0]); else yyval = list_prepend(yyvsp[-1], yyvsp[0]); } -#line 3209 "awkgram.c" +#line 3297 "awkgram.c" break; case 76: #line 1316 "awkgram.y" - { yyval = NULL; } -#line 3215 "awkgram.c" + { yyval = NULL; } +#line 3303 "awkgram.c" break; case 77: #line 1321 "awkgram.y" - { + { INSTRUCTION *casestmt = yyvsp[0]; if (yyvsp[0] == NULL) casestmt = list_create(instruction(Op_no_op)); @@ -3228,12 +3316,12 @@ regular_print: bcfree(yyvsp[-2]); yyval = yyvsp[-4]; } -#line 3232 "awkgram.c" +#line 3320 "awkgram.c" break; case 78: #line 1334 "awkgram.y" - { + { INSTRUCTION *casestmt = yyvsp[0]; if (yyvsp[0] == NULL) casestmt = list_create(instruction(Op_no_op)); @@ -3244,105 +3332,105 @@ regular_print: yyvsp[-3]->comment = yyvsp[-1]; yyval = yyvsp[-3]; } -#line 3248 "awkgram.c" +#line 3336 "awkgram.c" break; case 79: #line 1349 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3254 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3342 "awkgram.c" break; case 80: #line 1351 "awkgram.y" - { + { NODE *n = yyvsp[0]->memory; (void) force_number(n); negate_num(n); bcfree(yyvsp[-1]); yyval = yyvsp[0]; } -#line 3266 "awkgram.c" +#line 3354 "awkgram.c" break; case 81: #line 1359 "awkgram.y" - { + { NODE *n = yyvsp[0]->lasti->memory; bcfree(yyvsp[-1]); add_sign_to_num(n, '+'); yyval = yyvsp[0]; } -#line 3277 "awkgram.c" +#line 3365 "awkgram.c" break; case 82: #line 1366 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3283 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3371 "awkgram.c" break; case 83: #line 1368 "awkgram.y" - { + { if (yyvsp[0]->memory->type == Node_regex) yyvsp[0]->opcode = Op_push_re; else yyvsp[0]->opcode = Op_push; yyval = yyvsp[0]; } -#line 3295 "awkgram.c" +#line 3383 "awkgram.c" break; case 84: #line 1376 "awkgram.y" - { + { assert((yyvsp[0]->memory->flags & REGEX) == REGEX); yyvsp[0]->opcode = Op_push_re; yyval = yyvsp[0]; } -#line 3305 "awkgram.c" +#line 3393 "awkgram.c" break; case 85: #line 1385 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3311 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3399 "awkgram.c" break; case 86: #line 1387 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3317 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3405 "awkgram.c" break; case 88: #line 1397 "awkgram.y" - { + { yyval = yyvsp[-1]; } -#line 3325 "awkgram.c" +#line 3413 "awkgram.c" break; case 89: #line 1404 "awkgram.y" - { + { in_print = false; in_parens = 0; yyval = NULL; } -#line 3335 "awkgram.c" +#line 3423 "awkgram.c" break; case 90: #line 1409 "awkgram.y" - { in_print = false; in_parens = 0; } -#line 3341 "awkgram.c" + { in_print = false; in_parens = 0; } +#line 3429 "awkgram.c" break; case 91: #line 1410 "awkgram.y" - { + { if (yyvsp[-2]->redir_type == redirect_twoway && yyvsp[0]->lasti->opcode == Op_K_getline_redir && yyvsp[0]->lasti->redir_type == redirect_twoway) @@ -3351,42 +3439,42 @@ regular_print: lintwarn(_("concatenation as I/O `>' redirection target is ambiguous")); yyval = list_prepend(yyvsp[0], yyvsp[-2]); } -#line 3355 "awkgram.c" +#line 3443 "awkgram.c" break; case 92: #line 1423 "awkgram.y" - { + { if (yyvsp[-1] != NULL) yyvsp[-5]->comment = yyvsp[-1]; yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL, NULL); } -#line 3365 "awkgram.c" +#line 3453 "awkgram.c" break; case 93: #line 1430 "awkgram.y" - { + { if (yyvsp[-4] != NULL) yyvsp[-8]->comment = yyvsp[-4]; if (yyvsp[-1] != NULL) yyvsp[-2]->comment = yyvsp[-1]; yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]); } -#line 3377 "awkgram.c" +#line 3465 "awkgram.c" break; case 94: #line 1441 "awkgram.y" - { + { yyval = yyvsp[0]; } -#line 3385 "awkgram.c" +#line 3473 "awkgram.c" break; case 95: #line 1445 "awkgram.y" - { + { if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) { assert(yyvsp[0]->memory->comment_type == BLOCK_COMMENT); @@ -3403,60 +3491,60 @@ regular_print: } else yyval = NULL; } -#line 3407 "awkgram.c" +#line 3495 "awkgram.c" break; case 96: #line 1466 "awkgram.y" - { yyval = NULL; } -#line 3413 "awkgram.c" + { yyval = NULL; } +#line 3501 "awkgram.c" break; case 97: #line 1468 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3419 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3507 "awkgram.c" break; case 98: #line 1473 "awkgram.y" - { yyval = NULL; } -#line 3425 "awkgram.c" + { yyval = NULL; } +#line 3513 "awkgram.c" break; case 99: #line 1475 "awkgram.y" - { + { bcfree(yyvsp[-1]); yyval = yyvsp[0]; } -#line 3434 "awkgram.c" +#line 3522 "awkgram.c" break; case 100: #line 1483 "awkgram.y" - { yyval = NULL; } -#line 3440 "awkgram.c" + { yyval = NULL; } +#line 3528 "awkgram.c" break; case 101: #line 1485 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3446 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3534 "awkgram.c" break; case 102: #line 1490 "awkgram.y" - { + { yyvsp[0]->param_count = 0; yyval = list_create(yyvsp[0]); } -#line 3455 "awkgram.c" +#line 3543 "awkgram.c" break; case 103: #line 1495 "awkgram.y" - { + { if (yyvsp[-2] != NULL && yyvsp[0] != NULL) { yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count + 1; yyval = list_append(yyvsp[-2], yyvsp[0]); @@ -3472,219 +3560,219 @@ regular_print: } else yyval = NULL; } -#line 3476 "awkgram.c" +#line 3564 "awkgram.c" break; case 104: #line 1512 "awkgram.y" - { yyval = NULL; } -#line 3482 "awkgram.c" + { yyval = NULL; } +#line 3570 "awkgram.c" break; case 105: #line 1514 "awkgram.y" - { yyval = yyvsp[-1]; } -#line 3488 "awkgram.c" + { yyval = yyvsp[-1]; } +#line 3576 "awkgram.c" break; case 106: #line 1516 "awkgram.y" - { yyval = yyvsp[-2]; } -#line 3494 "awkgram.c" + { yyval = yyvsp[-2]; } +#line 3582 "awkgram.c" break; case 107: #line 1522 "awkgram.y" - { yyval = NULL; } -#line 3500 "awkgram.c" + { yyval = NULL; } +#line 3588 "awkgram.c" break; case 108: #line 1524 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3506 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3594 "awkgram.c" break; case 109: #line 1529 "awkgram.y" - { yyval = NULL; } -#line 3512 "awkgram.c" + { yyval = NULL; } +#line 3600 "awkgram.c" break; case 110: #line 1531 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3518 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3606 "awkgram.c" break; case 111: #line 1536 "awkgram.y" - { yyval = mk_expression_list(NULL, yyvsp[0]); } -#line 3524 "awkgram.c" + { yyval = mk_expression_list(NULL, yyvsp[0]); } +#line 3612 "awkgram.c" break; case 112: #line 1538 "awkgram.y" - { + { if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyerrok; } -#line 3535 "awkgram.c" +#line 3623 "awkgram.c" break; case 113: #line 1545 "awkgram.y" - { yyval = NULL; } -#line 3541 "awkgram.c" + { yyval = NULL; } +#line 3629 "awkgram.c" break; case 114: #line 1547 "awkgram.y" - { + { /* * Returning the expression list instead of NULL lets * snode get a list of arguments that it can count. */ yyval = yyvsp[-1]; } -#line 3553 "awkgram.c" +#line 3641 "awkgram.c" break; case 115: #line 1555 "awkgram.y" - { + { /* Ditto */ yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); } -#line 3562 "awkgram.c" +#line 3650 "awkgram.c" break; case 116: #line 1560 "awkgram.y" - { + { /* Ditto */ if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = yyvsp[-2]; } -#line 3573 "awkgram.c" +#line 3661 "awkgram.c" break; case 117: #line 1570 "awkgram.y" - { yyval = NULL; } -#line 3579 "awkgram.c" + { yyval = NULL; } +#line 3667 "awkgram.c" break; case 118: #line 1572 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3585 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3673 "awkgram.c" break; case 119: #line 1577 "awkgram.y" - { yyval = mk_expression_list(NULL, yyvsp[0]); } -#line 3591 "awkgram.c" + { yyval = mk_expression_list(NULL, yyvsp[0]); } +#line 3679 "awkgram.c" break; case 120: #line 1579 "awkgram.y" - { + { if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyerrok; } -#line 3602 "awkgram.c" +#line 3690 "awkgram.c" break; case 121: #line 1586 "awkgram.y" - { yyval = NULL; } -#line 3608 "awkgram.c" + { yyval = NULL; } +#line 3696 "awkgram.c" break; case 122: #line 1588 "awkgram.y" - { + { /* * Returning the expression list instead of NULL lets * snode get a list of arguments that it can count. */ yyval = yyvsp[-1]; } -#line 3620 "awkgram.c" +#line 3708 "awkgram.c" break; case 123: #line 1596 "awkgram.y" - { + { /* Ditto */ yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); } -#line 3629 "awkgram.c" +#line 3717 "awkgram.c" break; case 124: #line 1601 "awkgram.y" - { + { /* Ditto */ if (yyvsp[-1] != NULL) yyvsp[-2]->comment = yyvsp[-1]; yyval = yyvsp[-2]; } -#line 3640 "awkgram.c" +#line 3728 "awkgram.c" break; case 125: #line 1610 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3646 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3734 "awkgram.c" break; case 126: #line 1611 "awkgram.y" - { yyval = list_create(yyvsp[0]); } -#line 3652 "awkgram.c" + { yyval = list_create(yyvsp[0]); } +#line 3740 "awkgram.c" break; case 127: #line 1617 "awkgram.y" - { + { if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec) lintwarn_ln(yyvsp[-1]->source_line, _("regular expression on right of assignment")); yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3663 "awkgram.c" +#line 3751 "awkgram.c" break; case 128: #line 1624 "awkgram.y" - { + { yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1]); } -#line 3671 "awkgram.c" +#line 3759 "awkgram.c" break; case 129: #line 1628 "awkgram.y" - { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3677 "awkgram.c" + { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3765 "awkgram.c" break; case 130: #line 1630 "awkgram.y" - { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3683 "awkgram.c" + { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3771 "awkgram.c" break; case 131: #line 1632 "awkgram.y" - { + { if (yyvsp[-2]->lasti->opcode == Op_match_rec) warning_ln(yyvsp[-1]->source_line, _("regular expression on left of `~' or `!~' operator")); @@ -3696,12 +3784,12 @@ regular_print: bcfree(yyvsp[0]); yyval = list_append(yyvsp[-2], yyvsp[-1]); } -#line 3700 "awkgram.c" +#line 3788 "awkgram.c" break; case 132: #line 1645 "awkgram.y" - { + { if (yyvsp[-2]->lasti->opcode == Op_match_rec) warning_ln(yyvsp[-1]->source_line, _("regular expression on left of `~' or `!~' operator")); @@ -3717,12 +3805,12 @@ regular_print: yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } } -#line 3721 "awkgram.c" +#line 3809 "awkgram.c" break; case 133: #line 1662 "awkgram.y" - { + { if (do_lint_old) lintwarn_ln(yyvsp[-1]->source_line, _("old awk does not support the keyword `in' except after `for'")); @@ -3731,92 +3819,92 @@ regular_print: yyvsp[-1]->expr_count = 1; yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } -#line 3735 "awkgram.c" +#line 3823 "awkgram.c" break; case 134: #line 1672 "awkgram.y" - { + { if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec) lintwarn_ln(yyvsp[-1]->source_line, _("regular expression on right of comparison")); yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } -#line 3746 "awkgram.c" +#line 3834 "awkgram.c" break; case 135: #line 1679 "awkgram.y" - { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]); } -#line 3752 "awkgram.c" + { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]); } +#line 3840 "awkgram.c" break; case 136: #line 1681 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3758 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3846 "awkgram.c" break; case 137: #line 1686 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3764 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3852 "awkgram.c" break; case 138: #line 1688 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3770 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3858 "awkgram.c" break; case 139: #line 1690 "awkgram.y" - { + { yyvsp[0]->opcode = Op_assign_quotient; yyval = yyvsp[0]; } -#line 3779 "awkgram.c" +#line 3867 "awkgram.c" break; case 140: #line 1698 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3785 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3873 "awkgram.c" break; case 141: #line 1700 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3791 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3879 "awkgram.c" break; case 142: #line 1705 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3797 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3885 "awkgram.c" break; case 143: #line 1707 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3803 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3891 "awkgram.c" break; case 144: #line 1712 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3809 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3897 "awkgram.c" break; case 145: #line 1714 "awkgram.y" - { yyval = yyvsp[0]; } -#line 3815 "awkgram.c" + { yyval = yyvsp[0]; } +#line 3903 "awkgram.c" break; case 146: #line 1716 "awkgram.y" - { + { int count = 2; bool is_simple_var = false; @@ -3869,48 +3957,48 @@ regular_print: max_args = count; } } -#line 3873 "awkgram.c" +#line 3961 "awkgram.c" break; case 148: #line 1775 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3879 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3967 "awkgram.c" break; case 149: #line 1777 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3885 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3973 "awkgram.c" break; case 150: #line 1779 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3891 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3979 "awkgram.c" break; case 151: #line 1781 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3897 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3985 "awkgram.c" break; case 152: #line 1783 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3903 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3991 "awkgram.c" break; case 153: #line 1785 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3909 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 3997 "awkgram.c" break; case 154: #line 1787 "awkgram.y" - { + { /* * In BEGINFILE/ENDFILE, allow `getline [var] < file' */ @@ -3923,30 +4011,30 @@ regular_print: _("non-redirected `getline' undefined inside END action")); yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input); } -#line 3927 "awkgram.c" +#line 4015 "awkgram.c" break; case 155: #line 1801 "awkgram.y" - { + { yyvsp[0]->opcode = Op_postincrement; yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 3936 "awkgram.c" +#line 4024 "awkgram.c" break; case 156: #line 1806 "awkgram.y" - { + { yyvsp[0]->opcode = Op_postdecrement; yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 3945 "awkgram.c" +#line 4033 "awkgram.c" break; case 157: #line 1811 "awkgram.y" - { + { if (do_lint_old) { /* first one is warning so that second one comes out if warnings are fatal */ warning_ln(yyvsp[-1]->source_line, @@ -3966,65 +4054,65 @@ regular_print: yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]); } } -#line 3970 "awkgram.c" +#line 4058 "awkgram.c" break; case 158: #line 1837 "awkgram.y" - { + { yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->redir_type); bcfree(yyvsp[-2]); } -#line 3979 "awkgram.c" +#line 4067 "awkgram.c" break; case 159: #line 1843 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3985 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 4073 "awkgram.c" break; case 160: #line 1845 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3991 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 4079 "awkgram.c" break; case 161: #line 1847 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3997 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 4085 "awkgram.c" break; case 162: #line 1849 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4003 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 4091 "awkgram.c" break; case 163: #line 1851 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4009 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 4097 "awkgram.c" break; case 164: #line 1853 "awkgram.y" - { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4015 "awkgram.c" + { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } +#line 4103 "awkgram.c" break; case 165: #line 1858 "awkgram.y" - { + { yyval = list_create(yyvsp[0]); } -#line 4023 "awkgram.c" +#line 4111 "awkgram.c" break; case 166: #line 1862 "awkgram.y" - { + { if (yyvsp[0]->opcode == Op_match_rec) { yyvsp[0]->opcode = Op_nomatch; yyvsp[-1]->opcode = Op_push_i; @@ -4055,44 +4143,44 @@ regular_print: } } } -#line 4059 "awkgram.c" +#line 4147 "awkgram.c" break; case 167: #line 1894 "awkgram.y" - { + { // Always include. Allows us to lint warn on // print "foo" > "bar" 1 // but not warn on // print "foo" > ("bar" 1) yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline)); } -#line 4071 "awkgram.c" +#line 4159 "awkgram.c" break; case 168: #line 1902 "awkgram.y" - { + { yyval = snode(yyvsp[-1], yyvsp[-3]); if (yyval == NULL) YYABORT; } -#line 4081 "awkgram.c" +#line 4169 "awkgram.c" break; case 169: #line 1908 "awkgram.y" - { + { yyval = snode(yyvsp[-1], yyvsp[-3]); if (yyval == NULL) YYABORT; } -#line 4091 "awkgram.c" +#line 4179 "awkgram.c" break; case 170: #line 1914 "awkgram.y" - { + { static bool warned = false; if (do_lint && ! warned) { @@ -4104,46 +4192,46 @@ regular_print: if (yyval == NULL) YYABORT; } -#line 4108 "awkgram.c" +#line 4196 "awkgram.c" break; case 173: #line 1929 "awkgram.y" - { + { yyvsp[-1]->opcode = Op_preincrement; yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); } -#line 4117 "awkgram.c" +#line 4205 "awkgram.c" break; case 174: #line 1934 "awkgram.y" - { + { yyvsp[-1]->opcode = Op_predecrement; yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); } -#line 4126 "awkgram.c" +#line 4214 "awkgram.c" break; case 175: #line 1939 "awkgram.y" - { + { yyval = list_create(yyvsp[0]); } -#line 4134 "awkgram.c" +#line 4222 "awkgram.c" break; case 176: #line 1943 "awkgram.y" - { + { yyval = list_create(yyvsp[0]); } -#line 4142 "awkgram.c" +#line 4230 "awkgram.c" break; case 177: #line 1947 "awkgram.y" - { + { if (yyvsp[0]->lasti->opcode == Op_push_i && (yyvsp[0]->lasti->memory->flags & STRING) == 0 ) { @@ -4157,12 +4245,12 @@ regular_print: yyval = list_append(yyvsp[0], yyvsp[-1]); } } -#line 4161 "awkgram.c" +#line 4249 "awkgram.c" break; case 178: #line 1962 "awkgram.y" - { + { if (yyvsp[0]->lasti->opcode == Op_push_i && (yyvsp[0]->lasti->memory->flags & STRING) == 0 && (yyvsp[0]->lasti->memory->flags & NUMCONSTSTR) != 0) { @@ -4179,21 +4267,21 @@ regular_print: yyval = list_append(yyvsp[0], yyvsp[-1]); } } -#line 4183 "awkgram.c" +#line 4271 "awkgram.c" break; case 179: #line 1983 "awkgram.y" - { + { func_use(yyvsp[0]->lasti->func_name, FUNC_USE); yyval = yyvsp[0]; } -#line 4192 "awkgram.c" +#line 4280 "awkgram.c" break; case 180: #line 1988 "awkgram.y" - { + { /* indirect function call */ INSTRUCTION *f, *t; char *name; @@ -4226,12 +4314,12 @@ regular_print: yyval = list_prepend(yyvsp[0], t); at_seen = false; } -#line 4230 "awkgram.c" +#line 4318 "awkgram.c" break; case 181: #line 2025 "awkgram.y" - { + { NODE *n; char *name = yyvsp[-3]->func_name; char *qname = qualify_name(name, strlen(name)); @@ -4263,50 +4351,50 @@ regular_print: yyval = list_append(t, yyvsp[-3]); } } -#line 4267 "awkgram.c" +#line 4355 "awkgram.c" break; case 182: #line 2061 "awkgram.y" - { yyval = NULL; } -#line 4273 "awkgram.c" + { yyval = NULL; } +#line 4361 "awkgram.c" break; case 183: #line 2063 "awkgram.y" - { yyval = yyvsp[0]; } -#line 4279 "awkgram.c" + { yyval = yyvsp[0]; } +#line 4367 "awkgram.c" break; case 184: #line 2068 "awkgram.y" - { yyval = NULL; } -#line 4285 "awkgram.c" + { yyval = NULL; } +#line 4373 "awkgram.c" break; case 185: #line 2070 "awkgram.y" - { yyval = yyvsp[-1]; } -#line 4291 "awkgram.c" + { yyval = yyvsp[-1]; } +#line 4379 "awkgram.c" break; case 186: #line 2075 "awkgram.y" - { yyval = yyvsp[0]; } -#line 4297 "awkgram.c" + { yyval = yyvsp[0]; } +#line 4385 "awkgram.c" break; case 187: #line 2077 "awkgram.y" - { + { yyval = list_merge(yyvsp[-1], yyvsp[0]); } -#line 4305 "awkgram.c" +#line 4393 "awkgram.c" break; case 188: #line 2084 "awkgram.y" - { + { INSTRUCTION *ip = yyvsp[0]->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ if (count > 1) { @@ -4319,12 +4407,12 @@ regular_print: sub_counter++; /* count # of dimensions */ yyval = yyvsp[0]; } -#line 4323 "awkgram.c" +#line 4411 "awkgram.c" break; case 189: #line 2101 "awkgram.y" - { + { INSTRUCTION *t = yyvsp[-1]; if (yyvsp[-1] == NULL) { error_ln(yyvsp[0]->source_line, @@ -4337,54 +4425,54 @@ regular_print: yyvsp[0]->sub_count = count_expressions(&t, false); yyval = list_append(t, yyvsp[0]); } -#line 4341 "awkgram.c" +#line 4429 "awkgram.c" break; case 190: #line 2118 "awkgram.y" - { yyval = yyvsp[0]; } -#line 4347 "awkgram.c" + { yyval = yyvsp[0]; } +#line 4435 "awkgram.c" break; case 191: #line 2120 "awkgram.y" - { + { yyval = list_merge(yyvsp[-1], yyvsp[0]); } -#line 4355 "awkgram.c" +#line 4443 "awkgram.c" break; case 192: #line 2127 "awkgram.y" - { yyval = yyvsp[-1]; } -#line 4361 "awkgram.c" + { yyval = yyvsp[-1]; } +#line 4449 "awkgram.c" break; case 193: #line 2132 "awkgram.y" - { + { yyvsp[0]->opcode = Op_push; yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lextok, Node_var_new); yyval = list_create(yyvsp[0]); } -#line 4371 "awkgram.c" +#line 4459 "awkgram.c" break; case 194: #line 2138 "awkgram.y" - { + { char *arr = yyvsp[-1]->lextok; yyvsp[-1]->memory = variable(yyvsp[-1]->source_line, arr, Node_var_new); yyvsp[-1]->opcode = Op_push_array; yyval = list_prepend(yyvsp[0], yyvsp[-1]); } -#line 4383 "awkgram.c" +#line 4471 "awkgram.c" break; case 195: #line 2149 "awkgram.y" - { + { INSTRUCTION *ip = yyvsp[0]->nexti; if (ip->opcode == Op_push && ip->memory->type == Node_var @@ -4395,85 +4483,85 @@ regular_print: } else yyval = yyvsp[0]; } -#line 4399 "awkgram.c" +#line 4487 "awkgram.c" break; case 196: #line 2161 "awkgram.y" - { + { yyval = list_append(yyvsp[-1], yyvsp[-2]); if (yyvsp[0] != NULL) mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4409 "awkgram.c" +#line 4497 "awkgram.c" break; case 197: #line 2170 "awkgram.y" - { + { yyvsp[0]->opcode = Op_postincrement; } -#line 4417 "awkgram.c" +#line 4505 "awkgram.c" break; case 198: #line 2174 "awkgram.y" - { + { yyvsp[0]->opcode = Op_postdecrement; } -#line 4425 "awkgram.c" +#line 4513 "awkgram.c" break; case 199: #line 2178 "awkgram.y" - { yyval = NULL; } -#line 4431 "awkgram.c" + { yyval = NULL; } +#line 4519 "awkgram.c" break; case 200: #line 2182 "awkgram.y" - { yyval = yyvsp[0]; } -#line 4437 "awkgram.c" + { yyval = yyvsp[0]; } +#line 4525 "awkgram.c" break; case 201: #line 2186 "awkgram.y" - { yyval = yyvsp[0]; yyerrok; } -#line 4443 "awkgram.c" + { yyval = yyvsp[0]; yyerrok; } +#line 4531 "awkgram.c" break; case 202: #line 2190 "awkgram.y" - { yyerrok; } -#line 4449 "awkgram.c" + { yyerrok; } +#line 4537 "awkgram.c" break; case 203: #line 2195 "awkgram.y" - { yyval = NULL; } -#line 4455 "awkgram.c" + { yyval = NULL; } +#line 4543 "awkgram.c" break; case 205: #line 2200 "awkgram.y" - { yyerrok; } -#line 4461 "awkgram.c" + { yyerrok; } +#line 4549 "awkgram.c" break; case 206: #line 2204 "awkgram.y" - { yyval = yyvsp[0]; yyerrok; } -#line 4467 "awkgram.c" + { yyval = yyvsp[0]; yyerrok; } +#line 4555 "awkgram.c" break; case 207: #line 2208 "awkgram.y" - { yyval = yyvsp[0]; yyerrok; } -#line 4473 "awkgram.c" + { yyval = yyvsp[0]; yyerrok; } +#line 4561 "awkgram.c" break; -#line 4477 "awkgram.c" +#line 4565 "awkgram.c" default: break; } @@ -4537,7 +4625,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.4.2. */ +/* A Bison parser, made by GNU Bison 3.5. */ /* Bison implementation for Yacc-like parsers in C @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.4.2" +#define YYBISON_VERSION "3.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -69,7 +69,6 @@ #define yyerror zzerror #define yydebug zzdebug #define yynerrs zznerrs - #define yylval zzlval #define yychar zzchar @@ -141,8 +140,17 @@ static void append_cmdarg(CMDARG *arg); static int find_argument(CMDARG *arg); #define YYSTYPE CMDARG * -#line 145 "command.c" +#line 144 "command.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast<Type> (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus @@ -293,28 +301,75 @@ int zzparse (void); # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + <limits.h> and (if available) <stdint.h> are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include <limits.h> /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -322,7 +377,7 @@ typedef short yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -330,7 +385,19 @@ typedef short yytype_int16; # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_uint8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -344,22 +411,20 @@ typedef short yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif #endif /* Suppress unused-variable warnings by "using" E. */ @@ -371,11 +436,11 @@ typedef short yytype_int16; #if defined __GNUC__ && ! defined __ICC && 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\"")\ +# 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 \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -388,6 +453,18 @@ typedef short yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + #define YY_ASSERT(E) ((void) (0 && (E))) @@ -466,17 +543,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -489,11 +566,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -505,12 +582,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -536,14 +613,15 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 303 + /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ -static const yytype_uint8 yytranslate[] = +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 58, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -580,7 +658,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { 0, 109, 109, 110, 128, 129, 179, 186, 187, 188, 189, 190, 194, 195, 196, 197, 201, 202, 203, 204, @@ -632,7 +710,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -643,14 +721,14 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -151 +#define YYPACT_NINF (-151) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-151))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -148 +#define YYTABLE_NINF (-148) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -785,7 +863,7 @@ static const yytype_int16 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_int8 yystos[] = { 0, 60, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, @@ -811,7 +889,7 @@ static const yytype_uint8 yystos[] = }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_int8 yyr1[] = { 0, 59, 60, 60, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, @@ -832,7 +910,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 0, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -961,7 +1039,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -984,12 +1062,12 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) @@ -1041,13 +1119,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -1083,12 +1161,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1119,10 +1197,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1135,19 +1213,19 @@ yytnamerr (char *yyres, const char *yystr) *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) +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int 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_NULLPTR; - /* Arguments of yyformat. */ + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -1175,6 +1253,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1199,7 +1279,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else @@ -1226,7 +1307,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else @@ -1256,8 +1339,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; @@ -1300,7 +1383,7 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1312,16 +1395,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYSIZE_T yystacksize; + YYPTRDIFF_T yystacksize; int yyn; int yyresult; @@ -1335,7 +1418,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1367,12 +1450,14 @@ yynewstate: /*--------------------------------------------------------------------. -| yynewstate -- set current state (the top of the stack) to yystate. | +| yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - *yyssp = (yytype_int16) yystate; + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE @@ -1380,23 +1465,23 @@ yysetstate: #else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); + YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; @@ -1410,9 +1495,10 @@ yysetstate: yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); @@ -1426,8 +1512,10 @@ yysetstate: yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; @@ -1493,14 +1581,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1537,7 +1624,7 @@ yyreduce: { case 3: #line 111 "command.y" - { + { cmd_idx = -1; want_nodeval = false; if (lexptr_begin != NULL) { @@ -1551,12 +1638,12 @@ yyreduce: arg_list = NULL; } } -#line 1555 "command.c" +#line 1642 "command.c" break; case 5: #line 130 "command.y" - { + { if (dbg_errcount == 0 && cmd_idx >= 0) { Func_cmd cmdfunc; bool terminate = false; @@ -1605,26 +1692,26 @@ yyreduce: YYACCEPT; } } -#line 1609 "command.c" +#line 1696 "command.c" break; case 6: #line 180 "command.y" - { + { yyerrok; } -#line 1617 "command.c" +#line 1704 "command.c" break; case 22: #line 214 "command.y" - { want_nodeval = true; } -#line 1623 "command.c" + { want_nodeval = true; } +#line 1710 "command.c" break; case 23: #line 219 "command.y" - { + { if (dbg_errcount == 0) { /* don't free arg_list; passed on to statement_list * non-terminal (empty rule action). See below. @@ -1639,38 +1726,38 @@ yyreduce: in_eval = true; } } -#line 1643 "command.c" +#line 1730 "command.c" break; case 24: #line 238 "command.y" - { + { yyval = append_statement(arg_list, (char *) start_EVAL); if (read_a_line == read_commands_string) /* unserializing 'eval' in 'commands' */ yyval->a_string[0] = '\0'; free_cmdarg(arg_list); arg_list = NULL; } -#line 1655 "command.c" +#line 1742 "command.c" break; case 25: #line 245 "command.y" - { yyval = append_statement(yyvsp[-1], lexptr_begin); } -#line 1661 "command.c" + { yyval = append_statement(yyvsp[-1], lexptr_begin); } +#line 1748 "command.c" break; case 26: #line 246 "command.y" - { + { yyval = yyvsp[-1]; } -#line 1669 "command.c" +#line 1756 "command.c" break; case 27: #line 253 "command.y" - { + { arg_list = append_statement(yyvsp[-1], (char *) end_EVAL); if (read_a_line == read_commands_string) { /* unserializing 'eval' in 'commands' */ char *str = arg_list->a_string; @@ -1685,12 +1772,12 @@ yyreduce: cmd_idx = find_command("eval", 4); in_eval = false; } -#line 1689 "command.c" +#line 1776 "command.c" break; case 28: #line 269 "command.y" - { + { NODE *n; CMDARG *arg; n = yyvsp[0]->a_node; @@ -1700,22 +1787,22 @@ yyreduce: free_cmdarg(arg_list); arg_list = arg; } -#line 1704 "command.c" +#line 1791 "command.c" break; case 34: #line 288 "command.y" - { + { if (cmdtab[cmd_idx].class == D_FRAME && yyvsp[0] != NULL && yyvsp[0]->a_int < 0) yyerror(_("invalid frame number: %d"), yyvsp[0]->a_int); } -#line 1714 "command.c" +#line 1801 "command.c" break; case 35: #line 294 "command.y" - { + { int idx = find_argument(yyvsp[0]); if (idx < 0) yyerror(_("info: invalid option - \"%s\""), yyvsp[0]->a_string); @@ -1726,66 +1813,66 @@ yyreduce: yyvsp[0]->a_argument = argtab[idx].value; } } -#line 1730 "command.c" +#line 1817 "command.c" break; case 38: #line 307 "command.y" - { want_nodeval = true; } -#line 1736 "command.c" + { want_nodeval = true; } +#line 1823 "command.c" break; case 40: #line 308 "command.y" - { want_nodeval = true; } -#line 1742 "command.c" + { want_nodeval = true; } +#line 1829 "command.c" break; case 46: #line 313 "command.y" - { want_nodeval = true; } -#line 1748 "command.c" + { want_nodeval = true; } +#line 1835 "command.c" break; case 49: #line 315 "command.y" - { want_nodeval = true; } -#line 1754 "command.c" + { want_nodeval = true; } +#line 1841 "command.c" break; case 51: #line 316 "command.y" - { want_nodeval = true; } -#line 1760 "command.c" + { want_nodeval = true; } +#line 1847 "command.c" break; case 53: #line 317 "command.y" - { want_nodeval = true; } -#line 1766 "command.c" + { want_nodeval = true; } +#line 1853 "command.c" break; case 57: #line 321 "command.y" - { + { if (in_cmd_src(yyvsp[0]->a_string)) yyerror(_("source \"%s\": already sourced."), yyvsp[0]->a_string); } -#line 1775 "command.c" +#line 1862 "command.c" break; case 58: #line 326 "command.y" - { + { if (! input_from_tty) yyerror(_("save \"%s\": command not permitted."), yyvsp[0]->a_string); } -#line 1784 "command.c" +#line 1871 "command.c" break; case 59: #line 331 "command.y" - { + { int type = 0; int num; @@ -1810,12 +1897,12 @@ yyreduce: } } } -#line 1814 "command.c" +#line 1901 "command.c" break; case 60: #line 357 "command.y" - { + { if (! in_commands) yyerror(_("`end' valid only in command `commands' or `eval'")); else { @@ -1824,21 +1911,21 @@ yyreduce: in_commands = false; } } -#line 1828 "command.c" +#line 1915 "command.c" break; case 61: #line 367 "command.y" - { + { if (! in_commands) yyerror(_("`silent' valid only in command `commands'")); } -#line 1837 "command.c" +#line 1924 "command.c" break; case 62: #line 372 "command.y" - { + { int idx = find_argument(yyvsp[0]); if (idx < 0) yyerror(_("trace: invalid option - \"%s\""), yyvsp[0]->a_string); @@ -1849,30 +1936,30 @@ yyreduce: yyvsp[0]->a_argument = argtab[idx].value; } } -#line 1853 "command.c" +#line 1940 "command.c" break; case 63: #line 383 "command.y" - { want_nodeval = true; } -#line 1859 "command.c" + { want_nodeval = true; } +#line 1946 "command.c" break; case 64: #line 384 "command.y" - { + { int type; int num = yyvsp[-2]->a_int; type = has_break_or_watch_point(&num, false); if (! type) yyerror(_("condition: invalid breakpoint/watchpoint number")); } -#line 1871 "command.c" +#line 1958 "command.c" break; case 65: #line 392 "command.y" - { + { if (in_commands) { /* Prepend command 'eval' to argument list */ CMDARG *arg; @@ -1882,12 +1969,12 @@ yyreduce: arg_list = arg; } } -#line 1886 "command.c" +#line 1973 "command.c" break; case 66: #line 406 "command.y" - { + { if (yyvsp[0] != NULL) { NODE *n = yyvsp[0]->a_node; yyvsp[0]->type = D_string; @@ -1896,77 +1983,77 @@ yyreduce: } yyval = yyvsp[0]; } -#line 1900 "command.c" +#line 1987 "command.c" break; case 68: #line 420 "command.y" - { yyval = NULL; } -#line 1906 "command.c" + { yyval = NULL; } +#line 1993 "command.c" break; case 69: #line 425 "command.y" - { yyval = NULL; } -#line 1912 "command.c" + { yyval = NULL; } +#line 1999 "command.c" break; case 74: #line 434 "command.y" - { yyval = NULL; } -#line 1918 "command.c" + { yyval = NULL; } +#line 2005 "command.c" break; case 75: #line 439 "command.y" - { yyval = NULL; } -#line 1924 "command.c" + { yyval = NULL; } +#line 2011 "command.c" break; case 77: #line 442 "command.y" - { yyval = NULL; } -#line 1930 "command.c" + { yyval = NULL; } +#line 2017 "command.c" break; case 78: #line 447 "command.y" - { + { NODE *n; n = yyvsp[0]->a_node; if ((n->flags & STRING) == 0) yyerror(_("argument not a string")); } -#line 1941 "command.c" +#line 2028 "command.c" break; case 79: #line 457 "command.y" - { yyval = NULL; } -#line 1947 "command.c" + { yyval = NULL; } +#line 2034 "command.c" break; case 80: #line 459 "command.y" - { + { if (find_option(yyvsp[0]->a_string) < 0) yyerror(_("option: invalid parameter - \"%s\""), yyvsp[0]->a_string); } -#line 1956 "command.c" +#line 2043 "command.c" break; case 81: #line 464 "command.y" - { + { if (find_option(yyvsp[-2]->a_string) < 0) yyerror(_("option: invalid parameter - \"%s\""), yyvsp[-2]->a_string); } -#line 1965 "command.c" +#line 2052 "command.c" break; case 82: #line 472 "command.y" - { + { NODE *n; n = lookup(yyvsp[0]->a_string); if (n == NULL || n->type != Node_func) @@ -1978,54 +2065,54 @@ yyreduce: yyvsp[0]->a_node = n; } } -#line 1982 "command.c" +#line 2069 "command.c" break; case 83: #line 488 "command.y" - { yyval = NULL; } -#line 1988 "command.c" + { yyval = NULL; } +#line 2075 "command.c" break; case 88: #line 497 "command.y" - { yyval = NULL; } -#line 1994 "command.c" + { yyval = NULL; } +#line 2081 "command.c" break; case 89: #line 498 "command.y" - { want_nodeval = true; } -#line 2000 "command.c" + { want_nodeval = true; } +#line 2087 "command.c" break; case 92: #line 500 "command.y" - { want_nodeval = true; } -#line 2006 "command.c" + { want_nodeval = true; } +#line 2093 "command.c" break; case 95: #line 506 "command.y" - { yyval = NULL; } -#line 2012 "command.c" + { yyval = NULL; } +#line 2099 "command.c" break; case 97: #line 512 "command.y" - { yyval = NULL; } -#line 2018 "command.c" + { yyval = NULL; } +#line 2105 "command.c" break; case 99: #line 518 "command.y" - { yyval = NULL; } -#line 2024 "command.c" + { yyval = NULL; } +#line 2111 "command.c" break; case 104: #line 530 "command.y" - { + { int idx = find_argument(yyvsp[-1]); if (idx < 0) yyerror(_("enable: invalid option - \"%s\""), yyvsp[-1]->a_string); @@ -2036,53 +2123,53 @@ yyreduce: yyvsp[-1]->a_argument = argtab[idx].value; } } -#line 2040 "command.c" +#line 2127 "command.c" break; case 106: #line 546 "command.y" - { + { yyvsp[0]->type = D_array; /* dump all items */ yyvsp[0]->a_count = 0; } -#line 2049 "command.c" +#line 2136 "command.c" break; case 107: #line 551 "command.y" - { + { yyvsp[-1]->type = D_array; yyvsp[-1]->a_count = num_dim; } -#line 2058 "command.c" +#line 2145 "command.c" break; case 117: #line 577 "command.y" - { yyval = NULL; } -#line 2064 "command.c" + { yyval = NULL; } +#line 2151 "command.c" break; case 118: #line 579 "command.y" - { yyval = NULL; } -#line 2070 "command.c" + { yyval = NULL; } +#line 2157 "command.c" break; case 119: #line 581 "command.y" - { + { CMDARG *a; a = mk_cmdarg(D_int); a->a_int = -1; append_cmdarg(a); } -#line 2081 "command.c" +#line 2168 "command.c" break; case 126: #line 597 "command.y" - { + { if (yyvsp[-2]->a_int > yyvsp[0]->a_int) yyerror(_("invalid range specification: %d - %d"), yyvsp[-2]->a_int, yyvsp[0]->a_int); @@ -2090,30 +2177,30 @@ yyreduce: yyvsp[-2]->type = D_range; yyval = yyvsp[-2]; } -#line 2094 "command.c" +#line 2181 "command.c" break; case 127: #line 609 "command.y" - { yyval = NULL; } -#line 2100 "command.c" + { yyval = NULL; } +#line 2187 "command.c" break; case 134: #line 623 "command.y" - { yyval = yyvsp[0]; } -#line 2106 "command.c" + { yyval = yyvsp[0]; } +#line 2193 "command.c" break; case 135: #line 625 "command.y" - { yyval = yyvsp[-2]; } -#line 2112 "command.c" + { yyval = yyvsp[-2]; } +#line 2199 "command.c" break; case 137: #line 631 "command.y" - { + { CMDARG *a; NODE *subs; int count = 0; @@ -2127,24 +2214,24 @@ yyreduce: yyvsp[-1]->a_node = subs; yyval = yyvsp[-1]; } -#line 2131 "command.c" +#line 2218 "command.c" break; case 139: #line 650 "command.y" - { yyval = yyvsp[0]; num_dim = 1; } -#line 2137 "command.c" + { yyval = yyvsp[0]; num_dim = 1; } +#line 2224 "command.c" break; case 140: #line 652 "command.y" - { yyval = yyvsp[-1]; num_dim++; } -#line 2143 "command.c" + { yyval = yyvsp[-1]; num_dim++; } +#line 2230 "command.c" break; case 142: #line 658 "command.y" - { + { NODE *n = yyvsp[0]->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value for field number")); @@ -2152,40 +2239,40 @@ yyreduce: yyvsp[0]->type = D_field; yyval = yyvsp[0]; } -#line 2156 "command.c" +#line 2243 "command.c" break; case 143: #line 667 "command.y" - { + { /* a_string is array name, a_count is dimension count */ yyvsp[-1]->type = D_subscript; yyvsp[-1]->a_count = num_dim; yyval = yyvsp[-1]; } -#line 2167 "command.c" +#line 2254 "command.c" break; case 144: #line 677 "command.y" - { yyval = yyvsp[0]; } -#line 2173 "command.c" + { yyval = yyvsp[0]; } +#line 2260 "command.c" break; case 145: #line 679 "command.y" - { + { NODE *n = yyvsp[0]->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); yyval = yyvsp[0]; } -#line 2184 "command.c" +#line 2271 "command.c" break; case 146: #line 686 "command.y" - { + { NODE *n = yyvsp[0]->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -2193,77 +2280,77 @@ yyreduce: negate_num(n); yyval = yyvsp[0]; } -#line 2197 "command.c" +#line 2284 "command.c" break; case 147: #line 698 "command.y" - { yyval = NULL; } -#line 2203 "command.c" + { yyval = NULL; } +#line 2290 "command.c" break; case 148: #line 700 "command.y" - { yyval = yyvsp[0]; } -#line 2209 "command.c" + { yyval = yyvsp[0]; } +#line 2296 "command.c" break; case 149: #line 705 "command.y" - { yyval = NULL; } -#line 2215 "command.c" + { yyval = NULL; } +#line 2302 "command.c" break; case 150: #line 707 "command.y" - { yyval = yyvsp[0]; } -#line 2221 "command.c" + { yyval = yyvsp[0]; } +#line 2308 "command.c" break; case 151: #line 712 "command.y" - { + { if (yyvsp[0]->a_int == 0) yyerror(_("non-zero integer value")); yyval = yyvsp[0]; } -#line 2231 "command.c" +#line 2318 "command.c" break; case 152: #line 718 "command.y" - { + { if (yyvsp[0]->a_int == 0) yyerror(_("non-zero integer value")); yyval = yyvsp[0]; } -#line 2241 "command.c" +#line 2328 "command.c" break; case 153: #line 727 "command.y" - { yyval = yyvsp[0]; } -#line 2247 "command.c" + { yyval = yyvsp[0]; } +#line 2334 "command.c" break; case 154: #line 729 "command.y" - { yyval = yyvsp[0]; } -#line 2253 "command.c" + { yyval = yyvsp[0]; } +#line 2340 "command.c" break; case 155: #line 731 "command.y" - { + { yyvsp[0]->a_int = - yyvsp[0]->a_int; yyval = yyvsp[0]; } -#line 2262 "command.c" +#line 2349 "command.c" break; case 156: #line 739 "command.y" - { + { if (lexptr_begin != NULL) { if (input_from_tty && lexptr_begin[0] != '\0') add_history(lexptr_begin); @@ -2271,11 +2358,11 @@ yyreduce: lexptr_begin = NULL; } } -#line 2275 "command.c" +#line 2362 "command.c" break; -#line 2279 "command.c" +#line 2366 "command.c" default: break; } @@ -2339,7 +2426,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; |