"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "awkgram.c" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

awkgram.c  (gawk-5.0.1.tar.xz):awkgram.c  (gawk-5.1.0.tar.xz)
/* A Bison parser, made by GNU Bison 3.4. */ /* A Bison parser, made by GNU Bison 3.5.4. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
Inc. Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 51 skipping to change at line 51
define necessary library symbols; they are noted "INFRINGES ON define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */ USER NAME SPACE" below. */
/* Undocumented macros, especially those whose name start with YY_, /* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */ are private implementation details. Do not rely on them. */
/* Identify Bison output. */ /* Identify Bison output. */
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "3.4" #define YYBISON_VERSION "3.5.4"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */ /* Pure parsers. */
#define YYPURE 0 #define YYPURE 0
/* Push parsers. */ /* Push parsers. */
#define YYPUSH 0 #define YYPUSH 0
skipping to change at line 233 skipping to change at line 233
static inline INSTRUCTION *list_append(INSTRUCTION *l, INSTRUCTION *x); static inline INSTRUCTION *list_append(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x); static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2); static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2);
extern double fmod(double x, double y); extern double fmod(double x, double y);
#define YYSTYPE INSTRUCTION * #define YYSTYPE INSTRUCTION *
#line 235 "awkgram.c" #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 # ifndef YY_NULLPTR
# if defined __cplusplus # if defined __cplusplus
# if 201103L <= __cplusplus # if 201103L <= __cplusplus
# define YY_NULLPTR nullptr # define YY_NULLPTR nullptr
# else # else
# define YY_NULLPTR 0 # define YY_NULLPTR 0
# endif # endif
# else # else
# define YY_NULLPTR ((void*)0) # define YY_NULLPTR ((void*)0)
# endif # endif
skipping to change at line 391 skipping to change at line 400
#endif #endif
extern YYSTYPE yylval; extern YYSTYPE yylval;
int yyparse (void); int yyparse (void);
#ifdef short #ifdef short
# undef short # undef short
#endif #endif
#ifdef YYTYPE_UINT8 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
typedef YYTYPE_UINT8 yytype_uint8; <limits.h> and (if available) <stdint.h> are included
#else so that the code can choose integer types of a good width. */
typedef unsigned char yytype_uint8;
#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 #endif
#ifdef YYTYPE_INT8 /* Narrow types that promote to a signed type and that can represent a
typedef YYTYPE_INT8 yytype_int8; 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 #else
typedef signed char yytype_int8; typedef signed char yytype_int8;
#endif #endif
#ifdef YYTYPE_UINT16 #ifdef __INT_LEAST16_MAX__
typedef YYTYPE_UINT16 yytype_uint16; typedef __INT_LEAST16_TYPE__ yytype_int16;
#elif defined YY_STDINT_H
typedef int_least16_t yytype_int16;
#else #else
typedef unsigned short yytype_uint16; typedef short yytype_int16;
#endif #endif
#ifdef YYTYPE_INT16 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef YYTYPE_INT16 yytype_int16; 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 #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 #endif
#ifndef YYSIZE_T #ifndef YYSIZE_T
# ifdef __SIZE_TYPE__ # ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__
# elif defined size_t # elif defined size_t
# define YYSIZE_T 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 */ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t # define YYSIZE_T size_t
# else # else
# define YYSIZE_T unsigned # define YYSIZE_T unsigned
# endif # endif
#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_ #ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS # if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS # if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif # endif
# endif # endif
# ifndef YY_ # ifndef YY_
# define YY_(Msgid) Msgid # define YY_(Msgid) Msgid
# endif # endif
#endif #endif
#ifndef YY_ATTRIBUTE #ifndef YY_ATTRIBUTE_PURE
# if (defined __GNUC__ \ # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else # else
# define YY_ATTRIBUTE(Spec) /* empty */ # define YY_ATTRIBUTE_PURE
# endif # endif
#endif #endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED #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 #endif
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E)) # define YYUSE(E) ((void) (E))
#else #else
# define YYUSE(E) /* empty */ # define YYUSE(E) /* empty */
#endif #endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR_ _ #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR_ _
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop") _Pragma ("GCC diagnostic pop")
#else #else
# define YY_INITIAL_VALUE(Value) Value # define YY_INITIAL_VALUE(Value) Value
#endif #endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END # define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif #endif
#ifndef YY_INITIAL_VALUE #ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */ # define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif #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))) #define YY_ASSERT(E) ((void) (0 && (E)))
#if ! defined yyoverflow || YYERROR_VERBOSE #if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */ /* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA # ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA
# ifdef __GNUC__ # ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca # define YYSTACK_ALLOC __builtin_alloca
skipping to change at line 562 skipping to change at line 640
# endif # endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \ #if (! defined yyoverflow \
&& (! defined __cplusplus \ && (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */ /* A type that is properly aligned for any stack member. */
union yyalloc union yyalloc
{ {
yytype_int16 yyss_alloc; yy_state_t yyss_alloc;
YYSTYPE yyvs_alloc; YYSTYPE yyvs_alloc;
}; };
/* The size of the maximum gap between one aligned stack and the next. */ /* 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 /* The size of an array large to enough to hold all stacks, each with
N elements. */ N elements. */
# define YYSTACK_BYTES(N) \ # define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM) + YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1 # define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The /* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next stack. Advance YYPTR to a properly aligned location for the next
stack. */ stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \ do \
{ \ { \
YYSIZE_T yynewbytes; \ YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \ } \
while (0) while (0)
#endif #endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do /* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */ not overlap. */
# ifndef YYCOPY # ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__ # if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \ # define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
# else # else
# define YYCOPY(Dst, Src, Count) \ # define YYCOPY(Dst, Src, Count) \
do \ do \
{ \ { \
YYSIZE_T yyi; \ YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \ (Dst)[yyi] = (Src)[yyi]; \
} \ } \
while (0) while (0)
# endif # endif
# endif # endif
#endif /* !YYCOPY_NEEDED */ #endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */ /* YYFINAL -- State number of the termination state. */
#define YYFINAL 2 #define YYFINAL 2
skipping to change at line 635 skipping to change at line 713
#define YYNRULES 207 #define YYNRULES 207
/* YYNSTATES -- Number of states. */ /* YYNSTATES -- Number of states. */
#define YYNSTATES 355 #define YYNSTATES 355
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 310 #define YYMAXUTOK 310
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \ #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 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */ as returned by yylex. */
static const yytype_uint8 yytranslate[] = static const yytype_int8 yytranslate[] =
{ {
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 65, 2, 2, 68, 64, 2, 2, 2, 2, 2, 65, 2, 2, 68, 64, 2, 2,
69, 70, 62, 60, 57, 61, 2, 63, 2, 2, 69, 70, 62, 60, 57, 61, 2, 63, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 56, 76, 2, 2, 2, 2, 2, 2, 2, 2, 56, 76,
58, 2, 59, 55, 71, 2, 2, 2, 2, 2, 58, 2, 59, 55, 71, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
skipping to change at line 677 skipping to change at line 755
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
66 66
}; };
#if YYDEBUG #if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ /* 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, 0, 232, 232, 233, 238, 248, 252, 264, 272, 286,
297, 307, 317, 330, 340, 342, 347, 357, 359, 364, 297, 307, 317, 330, 340, 342, 347, 357, 359, 364,
366, 368, 374, 378, 383, 413, 425, 437, 443, 452, 366, 368, 374, 378, 383, 413, 425, 437, 443, 452,
470, 471, 482, 488, 496, 497, 501, 501, 535, 534, 470, 471, 482, 488, 496, 497, 501, 501, 535, 534,
568, 583, 585, 590, 591, 611, 616, 617, 621, 632, 568, 583, 585, 590, 591, 611, 616, 617, 621, 632,
637, 644, 752, 803, 853, 979, 1000, 1021, 1031, 1041, 637, 644, 752, 803, 853, 979, 1001, 1022, 1032, 1042,
1051, 1062, 1075, 1093, 1092, 1109, 1127, 1127, 1229, 1229, 1052, 1063, 1076, 1094, 1093, 1110, 1128, 1128, 1230, 1230,
1262, 1292, 1300, 1301, 1307, 1308, 1315, 1320, 1333, 1348, 1263, 1293, 1301, 1302, 1308, 1309, 1316, 1321, 1334, 1349,
1350, 1358, 1365, 1367, 1375, 1384, 1386, 1395, 1396, 1404, 1351, 1359, 1366, 1368, 1376, 1385, 1387, 1396, 1397, 1405,
1409, 1409, 1422, 1428, 1440, 1444, 1466, 1467, 1473, 1474, 1410, 1410, 1423, 1430, 1443, 1447, 1469, 1470, 1476, 1477,
1483, 1484, 1489, 1494, 1511, 1513, 1515, 1522, 1523, 1529, 1486, 1487, 1492, 1497, 1514, 1516, 1518, 1525, 1526, 1532,
1530, 1535, 1537, 1544, 1546, 1554, 1559, 1570, 1571, 1576, 1533, 1538, 1540, 1547, 1549, 1557, 1562, 1573, 1574, 1579,
1578, 1585, 1587, 1595, 1600, 1610, 1611, 1616, 1623, 1627, 1581, 1588, 1590, 1598, 1603, 1613, 1614, 1619, 1626, 1630,
1629, 1631, 1644, 1661, 1671, 1678, 1680, 1685, 1687, 1689, 1632, 1634, 1647, 1664, 1674, 1681, 1683, 1688, 1690, 1692,
1697, 1699, 1704, 1706, 1711, 1713, 1715, 1772, 1774, 1776, 1700, 1702, 1707, 1709, 1714, 1716, 1718, 1775, 1777, 1779,
1778, 1780, 1782, 1784, 1786, 1800, 1805, 1810, 1835, 1841, 1781, 1783, 1785, 1787, 1789, 1803, 1808, 1813, 1839, 1845,
1843, 1845, 1847, 1849, 1851, 1856, 1860, 1892, 1900, 1906, 1847, 1849, 1851, 1853, 1855, 1860, 1864, 1896, 1904, 1910,
1912, 1925, 1926, 1927, 1932, 1937, 1941, 1945, 1960, 1981, 1916, 1929, 1930, 1931, 1936, 1941, 1945, 1949, 1964, 1985,
1986, 2023, 2060, 2061, 2067, 2068, 2073, 2075, 2082, 2099, 1990, 2027, 2064, 2065, 2071, 2072, 2077, 2079, 2086, 2103,
2116, 2118, 2125, 2130, 2136, 2147, 2159, 2168, 2172, 2177, 2120, 2122, 2129, 2134, 2140, 2151, 2163, 2172, 2176, 2181,
2181, 2185, 2189, 2194, 2195, 2199, 2203, 2207 2185, 2189, 2193, 2198, 2199, 2203, 2207, 2211
}; };
#endif #endif
#if YYDEBUG || YYERROR_VERBOSE || 0 #if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "FUNC_CALL", "NAME", "REGEXP", "$end", "error", "$undefined", "FUNC_CALL", "NAME", "REGEXP",
"FILENAME", "YNUMBER", "YSTRING", "TYPED_REGEXP", "RELOP", "IO_OUT", "FILENAME", "YNUMBER", "YSTRING", "TYPED_REGEXP", "RELOP", "IO_OUT",
skipping to change at line 742 skipping to change at line 820
"opt_variable", "delete_subscript_list", "delete_subscript", "opt_variable", "delete_subscript_list", "delete_subscript",
"delete_exp_list", "bracketed_exp_list", "subscript", "subscript_list", "delete_exp_list", "bracketed_exp_list", "subscript", "subscript_list",
"simple_variable", "variable", "opt_incdec", "l_brace", "r_brace", "simple_variable", "variable", "opt_incdec", "l_brace", "r_brace",
"r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR
}; };
#endif #endif
# ifdef YYPRINT # ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the /* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */ (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, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 63, 58, 44, 60, 62, 305, 306, 307, 308, 309, 63, 58, 44, 60, 62,
43, 45, 42, 47, 37, 33, 310, 94, 36, 40, 43, 45, 42, 47, 37, 33, 310, 94, 36, 40,
41, 64, 91, 93, 123, 125, 59 41, 64, 91, 93, 123, 125, 59
}; };
# endif # endif
#define YYPACT_NINF -283 #define YYPACT_NINF (-283)
#define yypact_value_is_default(Yystate) \ #define yypact_value_is_default(Yyn) \
(!!((Yystate) == (-283))) ((Yyn) == YYPACT_NINF)
#define YYTABLE_NINF -119 #define YYTABLE_NINF (-119)
#define yytable_value_is_error(Yytable_value) \ #define yytable_value_is_error(Yyn) \
(!!((Yytable_value) == (-119))) ((Yyn) == YYTABLE_NINF)
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */ STATE-NUM. */
static const yytype_int16 yypact[] = static const yytype_int16 yypact[] =
{ {
-283, 316, -283, -283, -45, -28, -283, -283, -283, -283, -283, 316, -283, -283, -45, -28, -283, -283, -283, -283,
160, -283, -283, 23, 23, 23, -39, -18, -283, -283, 160, -283, -283, 23, 23, 23, -39, -18, -283, -283,
-283, 1047, 1047, -283, 1047, 1075, 818, 257, -283, 99, -283, 1047, 1047, -283, 1047, 1075, 818, 257, -283, 99,
-20, -283, -283, 11, 1017, 974, 378, 415, -283, -283, -20, -283, -283, 11, 1017, 974, 378, 415, -283, -283,
-283, -283, 329, 742, 818, -283, 0, -283, -283, -283, -283, -283, 329, 742, 818, -283, 0, -283, -283, -283,
skipping to change at line 1196 skipping to change at line 1274
123, 123, 124, 124, 125, 125, 125, 126, 126, 126, 123, 123, 124, 124, 125, 125, 125, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127,
127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129,
129, 130, 131, 131, 132, 132, 133, 133, 134, 135, 129, 130, 131, 131, 132, 132, 133, 133, 134, 135,
136, 136, 137, 138, 138, 139, 139, 140, 140, 140, 136, 136, 137, 138, 138, 139, 139, 140, 140, 140,
141, 142, 143, 144, 144, 145, 146, 147 141, 142, 143, 144, 144, 145, 146, 147
}; };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ /* 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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
4, 4, 4, 1, 2, 1, 1, 2, 1, 1, 4, 4, 4, 1, 2, 1, 1, 2, 1, 1,
2, 1, 0, 1, 3, 1, 1, 1, 1, 5, 2, 1, 0, 1, 3, 1, 1, 1, 1, 5,
1, 1, 1, 2, 1, 1, 0, 7, 0, 3, 1, 1, 1, 2, 1, 1, 0, 7, 0, 3,
1, 1, 1, 0, 2, 2, 1, 2, 2, 3, 1, 1, 1, 0, 2, 2, 1, 2, 2, 3,
1, 9, 6, 8, 8, 12, 11, 1, 2, 2, 1, 9, 6, 8, 8, 12, 11, 1, 2, 2,
2, 2, 3, 0, 4, 2, 0, 4, 0, 4, 2, 2, 3, 0, 4, 2, 0, 4, 0, 4,
4, 1, 0, 1, 0, 2, 2, 5, 4, 1, 4, 1, 0, 1, 0, 2, 2, 5, 4, 1,
2, 2, 1, 1, 1, 1, 1, 1, 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, 3, 0,
skipping to change at line 1298 skipping to change at line 1376
yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
{ {
FILE *yyoutput = yyo; FILE *yyoutput = yyo;
YYUSE (yyoutput); YYUSE (yyoutput);
if (!yyvaluep) if (!yyvaluep)
return; return;
# ifdef YYPRINT # ifdef YYPRINT
if (yytype < YYNTOKENS) if (yytype < YYNTOKENS)
YYPRINT (yyo, yytoknum[yytype], *yyvaluep); YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif # endif
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype); YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
} }
/*---------------------------. /*---------------------------.
| Print this symbol on YYO. | | Print this symbol on YYO. |
`---------------------------*/ `---------------------------*/
static void static void
yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
{ {
YYFPRINTF (yyo, "%s %s (", YYFPRINTF (yyo, "%s %s (",
skipping to change at line 1321 skipping to change at line 1401
yy_symbol_value_print (yyo, yytype, yyvaluep); yy_symbol_value_print (yyo, yytype, yyvaluep);
YYFPRINTF (yyo, ")"); YYFPRINTF (yyo, ")");
} }
/*------------------------------------------------------------------. /*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its | | yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). | | TOP (included). |
`------------------------------------------------------------------*/ `------------------------------------------------------------------*/
static void 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"); YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++) for (; yybottom <= yytop; yybottom++)
{ {
int yybot = *yybottom; int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot); YYFPRINTF (stderr, " %d", yybot);
} }
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
skipping to change at line 1343 skipping to change at line 1423
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_stack_print ((Bottom), (Top)); \ yy_stack_print ((Bottom), (Top)); \
} while (0) } while (0)
/*------------------------------------------------. /*------------------------------------------------.
| Report that the YYRULE is going to be reduced. | | Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/ `------------------------------------------------*/
static void 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 yynrhs = yyr2[yyrule];
int yyi; 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); yyrule - 1, yylno);
/* The symbols being reduced. */ /* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) for (yyi = 0; yyi < yynrhs; yyi++)
{ {
YYFPRINTF (stderr, " $%d = ", yyi + 1); YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]], yystos[+yyssp[yyi + 1 - yynrhs]],
&yyvsp[(yyi + 1) - (yynrhs)] &yyvsp[(yyi + 1) - (yynrhs)]
); );
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
} }
# define YY_REDUCE_PRINT(Rule) \ # define YY_REDUCE_PRINT(Rule) \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule); \ yy_reduce_print (yyssp, yyvsp, Rule); \
skipping to change at line 1398 skipping to change at line 1478
evaluated with infinite-precision integer arithmetic. */ evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH #ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000 # define YYMAXDEPTH 10000
#endif #endif
#if YYERROR_VERBOSE #if YYERROR_VERBOSE
# ifndef yystrlen # ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H # if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
# else # else
/* Return the length of YYSTR. */ /* Return the length of YYSTR. */
static YYSIZE_T static YYPTRDIFF_T
yystrlen (const char *yystr) yystrlen (const char *yystr)
{ {
YYSIZE_T yylen; YYPTRDIFF_T yylen;
for (yylen = 0; yystr[yylen]; yylen++) for (yylen = 0; yystr[yylen]; yylen++)
continue; continue;
return yylen; return yylen;
} }
# endif # endif
# endif # endif
# ifndef yystpcpy # ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy # define yystpcpy stpcpy
skipping to change at line 1440 skipping to change at line 1520
# endif # endif
# ifndef yytnamerr # ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result null, do not copy; instead, return the length of what the result
would have been. */ would have been. */
static YYSIZE_T static YYPTRDIFF_T
yytnamerr (char *yyres, const char *yystr) yytnamerr (char *yyres, const char *yystr)
{ {
if (*yystr == '"') if (*yystr == '"')
{ {
YYSIZE_T yyn = 0; YYPTRDIFF_T yyn = 0;
char const *yyp = yystr; char const *yyp = yystr;
for (;;) for (;;)
switch (*++yyp) switch (*++yyp)
{ {
case '\'': case '\'':
case ',': case ',':
goto do_not_strip_quotes; goto do_not_strip_quotes;
case '\\': case '\\':
skipping to change at line 1476 skipping to change at line 1556
break; break;
case '"': case '"':
if (yyres) if (yyres)
yyres[yyn] = '\0'; yyres[yyn] = '\0';
return yyn; return yyn;
} }
do_not_strip_quotes: ; do_not_strip_quotes: ;
} }
if (! yyres) if (yyres)
return yystpcpy (yyres, yystr) - yyres;
else
return yystrlen (yystr); return yystrlen (yystr);
return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
} }
# endif # endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is about the unexpected token YYTOKEN for the state stack whose top is
YYSSP. YYSSP.
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
not large enough to hold the message. In that case, also set not large enough to hold the message. In that case, also set
*YYMSG_ALLOC to the required number of bytes. Return 2 if the *YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */ required number of bytes is too large to store. */
static int static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken) yy_state_t *yyssp, int yytoken)
{ {
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = YY_NULLPTR; 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]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Actual size of YYARG. */
"expected"). */
int yycount = 0; int yycount = 0;
/* Cumulated lengths of YYARG. */
YYPTRDIFF_T yysize = 0;
/* There are many possibilities here to consider: /* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then - If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected is an error action. In that case, don't check for expected
tokens because there are none. tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if - The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus, this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that that there is no unexpected or expected token to report. In that
skipping to change at line 1531 skipping to change at line 1611
correct lookahead information, and it depends on the parser not correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected (from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be one exception: it will still contain any token that will not be
accepted due to an error action in a later state. accepted due to an error action in a later state.
*/ */
if (yytoken != YYEMPTY) if (yytoken != YYEMPTY)
{ {
int yyn = yypact[*yyssp]; int yyn = yypact[+*yyssp];
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
yysize = yysize0;
yyarg[yycount++] = yytname[yytoken]; yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn)) if (!yypact_value_is_default (yyn))
{ {
/* Start YYX at -YYN if negative to avoid negative indexes in /* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */ this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0; int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */ /* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1; int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
skipping to change at line 1556 skipping to change at line 1638
&& !yytable_value_is_error (yytable[yyx + yyn])) && !yytable_value_is_error (yytable[yyx + yyn]))
{ {
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{ {
yycount = 1; yycount = 1;
yysize = yysize0; yysize = yysize0;
break; break;
} }
yyarg[yycount++] = yytname[yyx]; 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) if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1; yysize = yysize1;
else else
return 2; return 2;
} }
} }
} }
} }
switch (yycount) switch (yycount)
skipping to change at line 1583 skipping to change at line 1666
YYCASE_(0, YY_("syntax error")); YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %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_(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")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or % s"));
# undef YYCASE_ # undef YYCASE_
} }
{ {
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) if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1; yysize = yysize1;
else else
return 2; return 2;
} }
if (*yymsg_alloc < yysize) if (*yymsg_alloc < yysize)
{ {
*yymsg_alloc = 2 * yysize; *yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc if (! (yysize <= *yymsg_alloc
skipping to change at line 1613 skipping to change at line 1698
char *yyp = *yymsg; char *yyp = *yymsg;
int yyi = 0; int yyi = 0;
while ((*yyp = *yyformat) != '\0') while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{ {
yyp += yytnamerr (yyp, yyarg[yyi++]); yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2; yyformat += 2;
} }
else else
{ {
yyp++; ++yyp;
yyformat++; ++yyformat;
} }
} }
return 0; return 0;
} }
#endif /* YYERROR_VERBOSE */ #endif /* YYERROR_VERBOSE */
/*-----------------------------------------------. /*-----------------------------------------------.
| Release the memory associated to this symbol. | | Release the memory associated to this symbol. |
`-----------------------------------------------*/ `-----------------------------------------------*/
skipping to change at line 1653 skipping to change at line 1738
/* Number of syntax errors so far. */ /* Number of syntax errors so far. */
int yynerrs; int yynerrs;
/*----------. /*----------.
| yyparse. | | yyparse. |
`----------*/ `----------*/
int int
yyparse (void) yyparse (void)
{ {
int yystate; yy_state_fast_t yystate;
/* Number of tokens to shift before error messages enabled. */ /* Number of tokens to shift before error messages enabled. */
int yyerrstatus; int yyerrstatus;
/* The stacks and their tools: /* The stacks and their tools:
'yyss': related to states. 'yyss': related to states.
'yyvs': related to semantic values. 'yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */ to reallocate them elsewhere. */
/* The state stack. */ /* The state stack. */
yytype_int16 yyssa[YYINITDEPTH]; yy_state_t yyssa[YYINITDEPTH];
yytype_int16 *yyss; yy_state_t *yyss;
yytype_int16 *yyssp; yy_state_t *yyssp;
/* The semantic value stack. */ /* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs; YYSTYPE *yyvs;
YYSTYPE *yyvsp; YYSTYPE *yyvsp;
YYSIZE_T yystacksize; YYPTRDIFF_T yystacksize;
int yyn; int yyn;
int yyresult; int yyresult;
/* Lookahead token as an internal (translated) token number. */ /* Lookahead token as an internal (translated) token number. */
int yytoken = 0; int yytoken = 0;
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
#if YYERROR_VERBOSE #if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */ /* Buffer for error messages, and its allocated size. */
char yymsgbuf[128]; char yymsgbuf[128];
char *yymsg = yymsgbuf; char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
#endif #endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule. /* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */ Keep to zero when no symbol should be popped. */
int yylen = 0; int yylen = 0;
yyssp = yyss = yyssa; yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa; yyvsp = yyvs = yyvsa;
skipping to change at line 1718 skipping to change at line 1803
/*------------------------------------------------------------. /*------------------------------------------------------------.
| yynewstate -- push a new state, which is found in yystate. | | yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/ `------------------------------------------------------------*/
yynewstate: yynewstate:
/* In all cases, when you get here, the value and location stacks /* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */ have just been pushed. So pushing a state here evens the stacks. */
yyssp++; yyssp++;
/*--------------------------------------------------------------------. /*--------------------------------------------------------------------.
| yynewstate -- set current state (the top of the stack) to yystate. | | yysetstate -- set current state (the top of the stack) to yystate. |
`--------------------------------------------------------------------*/ `--------------------------------------------------------------------*/
yysetstate: yysetstate:
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YYDPRINTF ((stderr, "Entering state %d\n", yystate));
YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 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 (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE #if !defined yyoverflow && !defined YYSTACK_RELOCATE
goto yyexhaustedlab; goto yyexhaustedlab;
#else #else
{ {
/* Get the current used size of the three stacks, in elements. */ /* 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 # if defined yyoverflow
{ {
/* Give user a chance to reallocate the stack. Use copies of /* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into these so that the &'s don't force the real ones into
memory. */ memory. */
yy_state_t *yyss1 = yyss;
YYSTYPE *yyvs1 = yyvs; YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the /* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */ be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"), yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp), &yyss1, yysize * YYSIZEOF (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp), &yyvs1, yysize * YYSIZEOF (*yyvsp),
&yystacksize); &yystacksize);
yyss = yyss1; yyss = yyss1;
yyvs = yyvs1; yyvs = yyvs1;
} }
# else /* defined YYSTACK_RELOCATE */ # else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */ /* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize) if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab; goto yyexhaustedlab;
yystacksize *= 2; yystacksize *= 2;
if (YYMAXDEPTH < yystacksize) if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH; yystacksize = YYMAXDEPTH;
{ {
yytype_int16 *yyss1 = yyss; yy_state_t *yyss1 = yyss;
union yyalloc *yyptr = 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) if (! yyptr)
goto yyexhaustedlab; goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE # undef YYSTACK_RELOCATE
if (yyss1 != yyssa) if (yyss1 != yyssa)
YYSTACK_FREE (yyss1); YYSTACK_FREE (yyss1);
} }
# endif # endif
yyssp = yyss + yysize - 1; yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1; yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n", YY_IGNORE_USELESS_CAST_BEGIN
(unsigned long) yystacksize)); YYDPRINTF ((stderr, "Stack size increased to %ld\n",
YY_CAST (long, yystacksize)));
YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
YYABORT; YYABORT;
} }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
if (yystate == YYFINAL) if (yystate == YYFINAL)
YYACCEPT; YYACCEPT;
goto yybackup; goto yybackup;
skipping to change at line 1843 skipping to change at line 1933
goto yyreduce; goto yyreduce;
} }
/* Count tokens shifted since error; after three, turn off error /* Count tokens shifted since error; after three, turn off error
status. */ status. */
if (yyerrstatus) if (yyerrstatus)
yyerrstatus--; yyerrstatus--;
/* Shift the lookahead token. */ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn; yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval; *++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Discard the shifted token. */
yychar = YYEMPTY;
goto yynewstate; goto yynewstate;
/*-----------------------------------------------------------. /*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. | | yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/ `-----------------------------------------------------------*/
yydefault: yydefault:
yyn = yydefact[yystate]; yyn = yydefact[yystate];
if (yyn == 0) if (yyn == 0)
goto yyerrlab; goto yyerrlab;
goto yyreduce; goto yyreduce;
skipping to change at line 1884 skipping to change at line 1973
users should not rely upon it. Assigning to YYVAL users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */ GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen]; yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn); YY_REDUCE_PRINT (yyn);
switch (yyn) switch (yyn)
{ {
case 2: case 2:
#line 232 "awkgram.y" #line 232 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 1917 "awkgram.c" #line 2007 "awkgram.c"
break; break;
case 3: case 3:
#line 234 "awkgram.y" #line 234 "awkgram.y"
{ {
rule = 0; rule = 0;
yyerrok; yyerrok;
} }
#line 1926 "awkgram.c" #line 2016 "awkgram.c"
break; break;
case 4: case 4:
#line 239 "awkgram.y" #line 239 "awkgram.y"
{ {
if (yyvsp[0] != NULL) { if (yyvsp[0] != NULL) {
if (yyvsp[-1] == NULL) if (yyvsp[-1] == NULL)
outer_comment = yyvsp[0]; outer_comment = yyvsp[0];
else else
interblock_comment = yyvsp[0]; interblock_comment = yyvsp[0];
} }
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} }
#line 1940 "awkgram.c" #line 2030 "awkgram.c"
break; break;
case 5: case 5:
#line 249 "awkgram.y" #line 249 "awkgram.y"
{ {
next_sourcefile(); next_sourcefile();
} }
#line 1948 "awkgram.c" #line 2038 "awkgram.c"
break; break;
case 6: case 6:
#line 253 "awkgram.y" #line 253 "awkgram.y"
{ {
rule = 0; rule = 0;
/* /*
* If errors, give up, don't produce an infinite * If errors, give up, don't produce an infinite
* stream of syntax error messages. * stream of syntax error messages.
*/ */
/* yyerrok; */ /* yyerrok; */
} }
#line 1961 "awkgram.c" #line 2051 "awkgram.c"
break; break;
case 7: case 7:
#line 265 "awkgram.y" #line 265 "awkgram.y"
{ {
(void) append_rule(yyvsp[-1], yyvsp[0]); (void) append_rule(yyvsp[-1], yyvsp[0]);
if (pending_comment != NULL) { if (pending_comment != NULL) {
interblock_comment = pending_comment; interblock_comment = pending_comment;
pending_comment = NULL; pending_comment = NULL;
} }
} }
#line 1973 "awkgram.c" #line 2063 "awkgram.c"
break; break;
case 8: case 8:
#line 273 "awkgram.y" #line 273 "awkgram.y"
{ {
if (rule != Rule) { if (rule != Rule) {
msg(_("%s blocks must have an action part"), ruletab[rule ]); msg(_("%s blocks must have an action part"), ruletab[rule ]);
errcount++; errcount++;
} else if (yyvsp[-1] == NULL) { } else if (yyvsp[-1] == NULL) {
msg(_("each rule must have a pattern or an action part")) ; msg(_("each rule must have a pattern or an action part")) ;
errcount++; errcount++;
} else { /* pattern rule with non-empty pattern */ } else { /* pattern rule with non-empty pattern */
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
list_append(yyvsp[-1], yyvsp[0]); list_append(yyvsp[-1], yyvsp[0]);
(void) append_rule(yyvsp[-1], NULL); (void) append_rule(yyvsp[-1], NULL);
} }
} }
#line 1991 "awkgram.c" #line 2081 "awkgram.c"
break; break;
case 9: case 9:
#line 287 "awkgram.y" #line 287 "awkgram.y"
{ {
in_function = false; in_function = false;
(void) mk_function(yyvsp[-1], yyvsp[0]); (void) mk_function(yyvsp[-1], yyvsp[0]);
want_param_names = DONT_CHECK; want_param_names = DONT_CHECK;
if (pending_comment != NULL) { if (pending_comment != NULL) {
interblock_comment = pending_comment; interblock_comment = pending_comment;
pending_comment = NULL; pending_comment = NULL;
} }
yyerrok; yyerrok;
} }
#line 2006 "awkgram.c" #line 2096 "awkgram.c"
break; break;
case 10: case 10:
#line 298 "awkgram.y" #line 298 "awkgram.y"
{ {
want_source = false; want_source = false;
at_seen = false; at_seen = false;
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
SRCFILE *s = (SRCFILE *) yyvsp[-1]; SRCFILE *s = (SRCFILE *) yyvsp[-1];
s->comment = yyvsp[0]; s->comment = yyvsp[0];
} }
yyerrok; yyerrok;
} }
#line 2020 "awkgram.c" #line 2110 "awkgram.c"
break; break;
case 11: case 11:
#line 308 "awkgram.y" #line 308 "awkgram.y"
{ {
want_source = false; want_source = false;
at_seen = false; at_seen = false;
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
SRCFILE *s = (SRCFILE *) yyvsp[-1]; SRCFILE *s = (SRCFILE *) yyvsp[-1];
s->comment = yyvsp[0]; s->comment = yyvsp[0];
} }
yyerrok; yyerrok;
} }
#line 2034 "awkgram.c" #line 2124 "awkgram.c"
break; break;
case 12: case 12:
#line 318 "awkgram.y" #line 318 "awkgram.y"
{ {
want_source = false; want_source = false;
at_seen = false; at_seen = false;
// this frees $3 storage in all cases // this frees $3 storage in all cases
set_namespace(yyvsp[-1], yyvsp[0]); set_namespace(yyvsp[-1], yyvsp[0]);
yyerrok; yyerrok;
} }
#line 2048 "awkgram.c" #line 2138 "awkgram.c"
break; break;
case 13: case 13:
#line 331 "awkgram.y" #line 331 "awkgram.y"
{ {
void *srcfile = NULL; void *srcfile = NULL;
if (! include_source(yyvsp[0], & srcfile)) if (! include_source(yyvsp[0], & srcfile))
YYABORT; YYABORT;
efree(yyvsp[0]->lextok); efree(yyvsp[0]->lextok);
bcfree(yyvsp[0]); bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile; yyval = (INSTRUCTION *) srcfile;
} }
#line 2062 "awkgram.c" #line 2152 "awkgram.c"
break; break;
case 14: case 14:
#line 341 "awkgram.y" #line 341 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2068 "awkgram.c" #line 2158 "awkgram.c"
break; break;
case 15: case 15:
#line 343 "awkgram.y" #line 343 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2074 "awkgram.c" #line 2164 "awkgram.c"
break; break;
case 16: case 16:
#line 348 "awkgram.y" #line 348 "awkgram.y"
{ {
void *srcfile; void *srcfile;
if (! load_library(yyvsp[0], & srcfile)) if (! load_library(yyvsp[0], & srcfile))
YYABORT; YYABORT;
efree(yyvsp[0]->lextok); efree(yyvsp[0]->lextok);
bcfree(yyvsp[0]); bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile; yyval = (INSTRUCTION *) srcfile;
} }
#line 2088 "awkgram.c" #line 2178 "awkgram.c"
break; break;
case 17: case 17:
#line 358 "awkgram.y" #line 358 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2094 "awkgram.c" #line 2184 "awkgram.c"
break; break;
case 18: case 18:
#line 360 "awkgram.y" #line 360 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2100 "awkgram.c" #line 2190 "awkgram.c"
break; break;
case 19: case 19:
#line 365 "awkgram.y" #line 365 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 2106 "awkgram.c" #line 2196 "awkgram.c"
break; break;
case 20: case 20:
#line 367 "awkgram.y" #line 367 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2112 "awkgram.c" #line 2202 "awkgram.c"
break; break;
case 21: case 21:
#line 369 "awkgram.y" #line 369 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2118 "awkgram.c" #line 2208 "awkgram.c"
break; break;
case 22: case 22:
#line 374 "awkgram.y" #line 374 "awkgram.y"
{ {
rule = Rule; rule = Rule;
yyval = NULL; yyval = NULL;
} }
#line 2127 "awkgram.c" #line 2217 "awkgram.c"
break; break;
case 23: case 23:
#line 379 "awkgram.y" #line 379 "awkgram.y"
{ {
rule = Rule; rule = Rule;
} }
#line 2135 "awkgram.c" #line 2225 "awkgram.c"
break; break;
case 24: case 24:
#line 384 "awkgram.y" #line 384 "awkgram.y"
{ {
INSTRUCTION *tp; INSTRUCTION *tp;
add_lint(yyvsp[-2], LINT_assign_in_cond); add_lint(yyvsp[-2], LINT_assign_in_cond);
add_lint(yyvsp[0], LINT_assign_in_cond); add_lint(yyvsp[0], LINT_assign_in_cond);
tp = instruction(Op_no_op); tp = instruction(Op_no_op);
list_prepend(yyvsp[-2], bcalloc(Op_line_range, !!do_pretty_print + 1, 0)); list_prepend(yyvsp[-2], bcalloc(Op_line_range, !!do_pretty_print + 1, 0));
yyvsp[-2]->nexti->triggered = false; yyvsp[-2]->nexti->triggered = false;
yyvsp[-2]->nexti->target_jmp = yyvsp[0]->nexti; yyvsp[-2]->nexti->target_jmp = yyvsp[0]->nexti;
skipping to change at line 2137 skipping to change at line 2226
(yyvsp[-2]->nexti + 1)->condpair_left = yyvsp[-2]->lasti; (yyvsp[-2]->nexti + 1)->condpair_left = yyvsp[-2]->lasti;
(yyvsp[-2]->nexti + 1)->condpair_right = yyvsp[0]->lasti; (yyvsp[-2]->nexti + 1)->condpair_right = yyvsp[0]->lasti;
} }
/* Put any comments in front of the range expression */ /* Put any comments in front of the range expression */
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyval = list_append(list_merge(list_prepend(yyvsp[-2], yy vsp[-1]), yyvsp[0]), tp); yyval = list_append(list_merge(list_prepend(yyvsp[-2], yy vsp[-1]), yyvsp[0]), tp);
else else
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp); yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp);
rule = Rule; rule = Rule;
} }
#line 2169 "awkgram.c" #line 2259 "awkgram.c"
break; break;
case 25: case 25:
#line 414 "awkgram.y" #line 414 "awkgram.y"
{ {
static int begin_seen = 0; static int begin_seen = 0;
if (do_lint_old && ++begin_seen == 2) if (do_lint_old && ++begin_seen == 2)
warning_ln(yyvsp[0]->source_line, lintwarn_ln(yyvsp[0]->source_line,
_("old awk does not support multiple `BEGIN' or ` END' rules")); _("old awk does not support multiple `BEGIN' or ` END' rules"));
yyvsp[0]->in_rule = rule = BEGIN; yyvsp[0]->in_rule = rule = BEGIN;
yyvsp[0]->source_file = source; yyvsp[0]->source_file = source;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2185 "awkgram.c" #line 2275 "awkgram.c"
break; break;
case 26: case 26:
#line 426 "awkgram.y" #line 426 "awkgram.y"
{ {
static int end_seen = 0; static int end_seen = 0;
if (do_lint_old && ++end_seen == 2) if (do_lint_old && ++end_seen == 2)
warning_ln(yyvsp[0]->source_line, lintwarn_ln(yyvsp[0]->source_line,
_("old awk does not support multiple `BEGIN' or ` END' rules")); _("old awk does not support multiple `BEGIN' or ` END' rules"));
yyvsp[0]->in_rule = rule = END; yyvsp[0]->in_rule = rule = END;
yyvsp[0]->source_file = source; yyvsp[0]->source_file = source;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2201 "awkgram.c" #line 2291 "awkgram.c"
break; break;
case 27: case 27:
#line 438 "awkgram.y" #line 438 "awkgram.y"
{ {
yyvsp[0]->in_rule = rule = BEGINFILE; yyvsp[0]->in_rule = rule = BEGINFILE;
yyvsp[0]->source_file = source; yyvsp[0]->source_file = source;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2211 "awkgram.c" #line 2301 "awkgram.c"
break; break;
case 28: case 28:
#line 444 "awkgram.y" #line 444 "awkgram.y"
{ {
yyvsp[0]->in_rule = rule = ENDFILE; yyvsp[0]->in_rule = rule = ENDFILE;
yyvsp[0]->source_file = source; yyvsp[0]->source_file = source;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2221 "awkgram.c" #line 2311 "awkgram.c"
break; break;
case 29: case 29:
#line 453 "awkgram.y" #line 453 "awkgram.y"
{ {
INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yy vsp[-2]); INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yy vsp[-2]);
if (yyvsp[-2] != NULL && yyvsp[0] != NULL) { if (yyvsp[-2] != NULL && yyvsp[0] != NULL) {
merge_comments(yyvsp[-2], yyvsp[0]); merge_comments(yyvsp[-2], yyvsp[0]);
pending_comment = yyvsp[-2]; pending_comment = yyvsp[-2];
} else if (yyvsp[-2] != NULL) { } else if (yyvsp[-2] != NULL) {
pending_comment = yyvsp[-2]; pending_comment = yyvsp[-2];
} else if (yyvsp[0] != NULL) { } else if (yyvsp[0] != NULL) {
pending_comment = yyvsp[0]; pending_comment = yyvsp[0];
} }
yyval = ip; yyval = ip;
} }
#line 2240 "awkgram.c" #line 2330 "awkgram.c"
break; break;
case 31: case 31:
#line 472 "awkgram.y" #line 472 "awkgram.y"
{ {
const char *name = yyvsp[0]->lextok; const char *name = yyvsp[0]->lextok;
char *qname = qualify_name(name, strlen(name)); char *qname = qualify_name(name, strlen(name));
if (qname != name) { if (qname != name) {
efree((void *)name); efree((void *)name);
yyvsp[0]->lextok = qname; yyvsp[0]->lextok = qname;
} }
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2255 "awkgram.c" #line 2345 "awkgram.c"
break; break;
case 32: case 32:
#line 483 "awkgram.y" #line 483 "awkgram.y"
{ {
yyerror(_("`%s' is a built-in function, it cannot be redefined"), yyerror(_("`%s' is a built-in function, it cannot be redefined"),
tokstart); tokstart);
YYABORT; YYABORT;
} }
#line 2265 "awkgram.c" #line 2355 "awkgram.c"
break; break;
case 33: case 33:
#line 489 "awkgram.y" #line 489 "awkgram.y"
{ {
yyval = yyvsp[0]; yyval = yyvsp[0];
at_seen = false; at_seen = false;
} }
#line 2274 "awkgram.c" #line 2364 "awkgram.c"
break; break;
case 36: case 36:
#line 501 "awkgram.y" #line 501 "awkgram.y"
{ want_param_names = FUNC_HEADER; } { want_param_names = FUNC_HEADER; }
#line 2280 "awkgram.c" #line 2370 "awkgram.c"
break; break;
case 37: case 37:
#line 502 "awkgram.y" #line 502 "awkgram.y"
{ {
INSTRUCTION *func_comment = NULL; INSTRUCTION *func_comment = NULL;
// Merge any comments found in the parameter list with those // Merge any comments found in the parameter list with those
// following the function header, associate the whole shebang // following the function header, associate the whole shebang
// with the function as one block comment. // with the function as one block comment.
if (yyvsp[-2] != NULL && yyvsp[-2]->comment != NULL) { if (yyvsp[-2] != NULL && yyvsp[-2]->comment != NULL) {
if (yyvsp[0] != NULL) { if (yyvsp[0] != NULL) {
merge_comments(yyvsp[-2]->comment, yyvsp[0]); merge_comments(yyvsp[-2]->comment, yyvsp[0]);
} }
func_comment = yyvsp[-2]->comment; func_comment = yyvsp[-2]->comment;
} else if (yyvsp[0] != NULL) { } else if (yyvsp[0] != NULL) {
skipping to change at line 2278 skipping to change at line 2367
yyvsp[-6]->comment = func_comment; yyvsp[-6]->comment = func_comment;
if (install_function(yyvsp[-5]->lextok, yyvsp[-6], yyvsp[-2]) < 0 ) if (install_function(yyvsp[-5]->lextok, yyvsp[-6], yyvsp[-2]) < 0 )
YYABORT; YYABORT;
in_function = true; in_function = true;
yyvsp[-5]->lextok = NULL; yyvsp[-5]->lextok = NULL;
bcfree(yyvsp[-5]); bcfree(yyvsp[-5]);
/* $5 already free'd in install_function */ /* $5 already free'd in install_function */
yyval = yyvsp[-6]; yyval = yyvsp[-6];
want_param_names = FUNC_BODY; want_param_names = FUNC_BODY;
} }
#line 2310 "awkgram.c" #line 2400 "awkgram.c"
break; break;
case 38: case 38:
#line 535 "awkgram.y" #line 535 "awkgram.y"
{ want_regexp = true; } { want_regexp = true; }
#line 2316 "awkgram.c" #line 2406 "awkgram.c"
break; break;
case 39: case 39:
#line 537 "awkgram.y" #line 537 "awkgram.y"
{ {
NODE *n, *exp; NODE *n, *exp;
char *re; char *re;
size_t len; size_t len;
re = yyvsp[0]->lextok; re = yyvsp[0]->lextok;
yyvsp[0]->lextok = NULL; yyvsp[0]->lextok = NULL;
len = strlen(re); len = strlen(re);
if (do_lint) { if (do_lint) {
if (len == 0) if (len == 0)
lintwarn_ln(yyvsp[0]->source_line, lintwarn_ln(yyvsp[0]->source_line,
skipping to change at line 2317 skipping to change at line 2406
exp = make_str_node(re, len, ALREADY_MALLOCED); exp = make_str_node(re, len, ALREADY_MALLOCED);
n = make_regnode(Node_regex, exp); n = make_regnode(Node_regex, exp);
if (n == NULL) { if (n == NULL) {
unref(exp); unref(exp);
YYABORT; YYABORT;
} }
yyval = yyvsp[0]; yyval = yyvsp[0];
yyval->opcode = Op_match_rec; yyval->opcode = Op_match_rec;
yyval->memory = n; yyval->memory = n;
} }
#line 2349 "awkgram.c" #line 2439 "awkgram.c"
break; break;
case 40: case 40:
#line 569 "awkgram.y" #line 569 "awkgram.y"
{ {
char *re; char *re;
size_t len; size_t len;
re = yyvsp[0]->lextok; re = yyvsp[0]->lextok;
yyvsp[0]->lextok = NULL; yyvsp[0]->lextok = NULL;
len = strlen(re); len = strlen(re);
yyval = yyvsp[0]; yyval = yyvsp[0];
yyval->opcode = Op_push_re; yyval->opcode = Op_push_re;
yyval->memory = make_typed_regex(re, len); yyval->memory = make_typed_regex(re, len);
} }
#line 2366 "awkgram.c" #line 2456 "awkgram.c"
break; break;
case 41: case 41:
#line 584 "awkgram.y" #line 584 "awkgram.y"
{ bcfree(yyvsp[0]); } { bcfree(yyvsp[0]); }
#line 2372 "awkgram.c" #line 2462 "awkgram.c"
break; break;
case 43: case 43:
#line 590 "awkgram.y" #line 590 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2378 "awkgram.c" #line 2468 "awkgram.c"
break; break;
case 44: case 44:
#line 592 "awkgram.y" #line 592 "awkgram.y"
{ {
if (yyvsp[0] == NULL) { if (yyvsp[0] == NULL) {
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} else { } else {
add_lint(yyvsp[0], LINT_no_effect); add_lint(yyvsp[0], LINT_no_effect);
if (yyvsp[-1] == NULL) { if (yyvsp[-1] == NULL) {
yyval = yyvsp[0]; yyval = yyvsp[0];
} else { } else {
yyval = list_merge(yyvsp[-1], yyvsp[0]); yyval = list_merge(yyvsp[-1], yyvsp[0]);
} }
} }
if (trailing_comment != NULL) { if (trailing_comment != NULL) {
yyval = list_append(yyval, trailing_comment); yyval = list_append(yyval, trailing_comment);
trailing_comment = NULL; trailing_comment = NULL;
} }
yyerrok; yyerrok;
} }
#line 2402 "awkgram.c" #line 2492 "awkgram.c"
break; break;
case 45: case 45:
#line 612 "awkgram.y" #line 612 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 2408 "awkgram.c" #line 2498 "awkgram.c"
break; break;
case 46: case 46:
#line 616 "awkgram.y" #line 616 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 2414 "awkgram.c" #line 2504 "awkgram.c"
break; break;
case 47: case 47:
#line 617 "awkgram.y" #line 617 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 2420 "awkgram.c" #line 2510 "awkgram.c"
break; break;
case 48: case 48:
#line 622 "awkgram.y" #line 622 "awkgram.y"
{ {
if (yyvsp[0] != NULL) { if (yyvsp[0] != NULL) {
INSTRUCTION *ip; INSTRUCTION *ip;
merge_comments(yyvsp[0], NULL); merge_comments(yyvsp[0], NULL);
ip = list_create(instruction(Op_no_op)); ip = list_create(instruction(Op_no_op));
yyval = list_append(ip, yyvsp[0]); yyval = list_append(ip, yyvsp[0]);
} else } else
yyval = NULL; yyval = NULL;
} }
#line 2435 "awkgram.c" #line 2525 "awkgram.c"
break; break;
case 49: case 49:
#line 633 "awkgram.y" #line 633 "awkgram.y"
{ {
trailing_comment = yyvsp[0]; // NULL or comment trailing_comment = yyvsp[0]; // NULL or comment
yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]); yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]);
} }
#line 2444 "awkgram.c" #line 2534 "awkgram.c"
break; break;
case 50: case 50:
#line 638 "awkgram.y" #line 638 "awkgram.y"
{ {
if (do_pretty_print) if (do_pretty_print)
yyval = list_prepend(yyvsp[0], instruction(Op_exec_count) ); yyval = list_prepend(yyvsp[0], instruction(Op_exec_count) );
else else
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2455 "awkgram.c" #line 2545 "awkgram.c"
break; break;
case 51: case 51:
#line 645 "awkgram.y" #line 645 "awkgram.y"
{ {
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt; INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak; INSTRUCTION *ip, *nextc, *tbreak;
const char **case_values = NULL; const char **case_values = NULL;
int maxcount = 128; int maxcount = 128;
int case_count = 0; int case_count = 0;
int i; int i;
tbreak = instruction(Op_no_op); tbreak = instruction(Op_no_op);
cstmt = list_create(tbreak); cstmt = list_create(tbreak);
cexp = list_create(instruction(Op_pop)); cexp = list_create(instruction(Op_pop));
skipping to change at line 2535 skipping to change at line 2624
(void) list_append(cexp, dflt); (void) list_append(cexp, dflt);
(void) list_merge(ip, cexp); (void) list_merge(ip, cexp);
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
(void) list_append(cstmt, yyvsp[-1]); (void) list_append(cstmt, yyvsp[-1]);
yyval = list_merge(ip, cstmt); yyval = list_merge(ip, cstmt);
break_allowed--; break_allowed--;
fix_break_continue(ip, tbreak, NULL); fix_break_continue(ip, tbreak, NULL);
} }
#line 2567 "awkgram.c" #line 2657 "awkgram.c"
break; break;
case 52: case 52:
#line 753 "awkgram.y" #line 753 "awkgram.y"
{ {
/* /*
* ----------------- * -----------------
* tc: * tc:
* cond * cond
* ----------------- * -----------------
* [Op_jmp_false tb ] * [Op_jmp_false tb ]
* ----------------- * -----------------
* body * body
* ----------------- * -----------------
* [Op_jmp tc ] * [Op_jmp tc ]
skipping to change at line 2590 skipping to change at line 2679
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
(void) list_merge(ip, yyvsp[0]); (void) list_merge(ip, yyvsp[0]);
(void) list_append(ip, instruction(Op_jmp)); (void) list_append(ip, instruction(Op_jmp));
ip->lasti->target_jmp = tcont; ip->lasti->target_jmp = tcont;
yyval = list_append(ip, tbreak); yyval = list_append(ip, tbreak);
break_allowed--; break_allowed--;
continue_allowed--; continue_allowed--;
fix_break_continue(ip, tbreak, tcont); fix_break_continue(ip, tbreak, tcont);
} }
#line 2622 "awkgram.c" #line 2712 "awkgram.c"
break; break;
case 53: case 53:
#line 804 "awkgram.y" #line 804 "awkgram.y"
{ {
/* /*
* ----------------- * -----------------
* z: * z:
* body * body
* ----------------- * -----------------
* tc: * tc:
* cond * cond
* ----------------- * -----------------
* [Op_jmp_true | z ] * [Op_jmp_true | z ]
* tb:[Op_no_op ] * tb:[Op_no_op ]
skipping to change at line 2644 skipping to change at line 2733
yyvsp[-7]->target_continue = tcont; yyvsp[-7]->target_continue = tcont;
(yyvsp[-7] + 1)->doloop_cond = tcont; (yyvsp[-7] + 1)->doloop_cond = tcont;
yyval = list_prepend(ip, yyvsp[-7]); yyval = list_prepend(ip, yyvsp[-7]);
bcfree(yyvsp[-4]); bcfree(yyvsp[-4]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyvsp[-7]->comment = yyvsp[0]; yyvsp[-7]->comment = yyvsp[0];
} }
/* else /* else
$1 and $4 are NULLs */ $1 and $4 are NULLs */
} }
#line 2676 "awkgram.c" #line 2766 "awkgram.c"
break; break;
case 54: case 54:
#line 854 "awkgram.y" #line 854 "awkgram.y"
{ {
INSTRUCTION *ip; INSTRUCTION *ip;
char *var_name = yyvsp[-5]->lextok; char *var_name = yyvsp[-5]->lextok;
if (yyvsp[0] != NULL if (yyvsp[0] != NULL
&& yyvsp[0]->lasti->opcode == Op_K_delete && yyvsp[0]->lasti->opcode == Op_K_delete
&& yyvsp[0]->lasti->expr_count == 1 && yyvsp[0]->lasti->expr_count == 1
&& yyvsp[0]->nexti->opcode == Op_push && yyvsp[0]->nexti->opcode == Op_push
&& (yyvsp[0]->nexti->memory->type != Node_var || !(yyvsp[0]->nexti->memory->var_update)) && (yyvsp[0]->nexti->memory->type != Node_var || !(yyvsp[0]->nexti->memory->var_update))
&& strcmp(yyvsp[0]->nexti->memory->vname, var_nam e) == 0 && strcmp(yyvsp[0]->nexti->memory->vname, var_nam e) == 0
) { ) {
skipping to change at line 2774 skipping to change at line 2863
(void) list_append(ip, instruction(Op_jmp)); (void) list_append(ip, instruction(Op_jmp));
ip->lasti->target_jmp = yyvsp[-4]; ip->lasti->target_jmp = yyvsp[-4];
yyval = list_append(ip, tbreak); yyval = list_append(ip, tbreak);
fix_break_continue(ip, tbreak, tcont); fix_break_continue(ip, tbreak, tcont);
} }
break_allowed--; break_allowed--;
continue_allowed--; continue_allowed--;
} }
#line 2806 "awkgram.c" #line 2896 "awkgram.c"
break; break;
case 55: case 55:
#line 980 "awkgram.y" #line 980 "awkgram.y"
{ {
if (yyvsp[-7] != NULL) { if (yyvsp[-7] != NULL) {
merge_comments(yyvsp[-7], NULL); merge_comments(yyvsp[-7], NULL);
yyvsp[-11]->comment = yyvsp[-7]; yyvsp[-11]->comment = yyvsp[-7];
} }
if (yyvsp[-4] != NULL) { if (yyvsp[-4] != NULL) {
merge_comments(yyvsp[-4], NULL); merge_comments(yyvsp[-4], NULL);
if (yyvsp[-11]->comment == NULL) { if (yyvsp[-11]->comment == NULL) {
yyvsp[-4]->memory->comment_type = FOR_COMMENT; yyvsp[-4]->memory->comment_type = FOR_COMMENT;
yyvsp[-11]->comment = yyvsp[-4]; yyvsp[-11]->comment = yyvsp[-4];
} else } else
yyvsp[-11]->comment->comment = yyvsp[-4]; yyvsp[-11]->comment->comment = yyvsp[-4];
} }
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]); yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
add_lint(yyvsp[-6], LINT_assign_in_cond);
yyval = mk_for_loop(yyvsp[-11], yyvsp[-9], yyvsp[-6], yyvsp[-3], yyvsp[0]); yyval = mk_for_loop(yyvsp[-11], yyvsp[-9], yyvsp[-6], yyvsp[-3], yyvsp[0]);
break_allowed--; break_allowed--;
continue_allowed--; continue_allowed--;
} }
#line 2831 "awkgram.c" #line 2922 "awkgram.c"
break; break;
case 56: case 56:
#line 1001 "awkgram.y" #line 1002 "awkgram.y"
{ {
if (yyvsp[-6] != NULL) { if (yyvsp[-6] != NULL) {
merge_comments(yyvsp[-6], NULL); merge_comments(yyvsp[-6], NULL);
yyvsp[-10]->comment = yyvsp[-6]; yyvsp[-10]->comment = yyvsp[-6];
} }
if (yyvsp[-4] != NULL) { if (yyvsp[-4] != NULL) {
merge_comments(yyvsp[-4], NULL); merge_comments(yyvsp[-4], NULL);
if (yyvsp[-10]->comment == NULL) { if (yyvsp[-10]->comment == NULL) {
yyvsp[-4]->memory->comment_type = FOR_COMMENT; yyvsp[-4]->memory->comment_type = FOR_COMMENT;
yyvsp[-10]->comment = yyvsp[-4]; yyvsp[-10]->comment = yyvsp[-4];
} else } else
yyvsp[-10]->comment->comment = yyvsp[-4]; yyvsp[-10]->comment->comment = yyvsp[-4];
} }
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]); yyvsp[0] = list_prepend(yyvsp[0], yyvsp[-1]);
yyval = mk_for_loop(yyvsp[-10], yyvsp[-8], (INSTRUCTION *) NULL, yyvsp[-3], yyvsp[0]); yyval = mk_for_loop(yyvsp[-10], yyvsp[-8], (INSTRUCTION *) NULL, yyvsp[-3], yyvsp[0]);
break_allowed--; break_allowed--;
continue_allowed--; continue_allowed--;
} }
#line 2856 "awkgram.c" #line 2947 "awkgram.c"
break; break;
case 57: case 57:
#line 1022 "awkgram.y" #line 1023 "awkgram.y"
{ {
if (do_pretty_print) if (do_pretty_print)
yyval = list_prepend(yyvsp[0], instruction(Op_exec_count) ); yyval = list_prepend(yyvsp[0], instruction(Op_exec_count) );
else else
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 2867 "awkgram.c" #line 2958 "awkgram.c"
break; break;
case 58: case 58:
#line 1032 "awkgram.y" #line 1033 "awkgram.y"
{ {
if (! break_allowed) if (! break_allowed)
error_ln(yyvsp[-1]->source_line, error_ln(yyvsp[-1]->source_line,
_("`break' is not allowed outside a loop or switc h")); _("`break' is not allowed outside a loop or switc h"));
yyvsp[-1]->target_jmp = NULL; yyvsp[-1]->target_jmp = NULL;
yyval = list_create(yyvsp[-1]); yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]); yyval = list_append(yyval, yyvsp[0]);
} }
#line 2881 "awkgram.c" #line 2972 "awkgram.c"
break; break;
case 59: case 59:
#line 1042 "awkgram.y" #line 1043 "awkgram.y"
{ {
if (! continue_allowed) if (! continue_allowed)
error_ln(yyvsp[-1]->source_line, error_ln(yyvsp[-1]->source_line,
_("`continue' is not allowed outside a loop")); _("`continue' is not allowed outside a loop"));
yyvsp[-1]->target_jmp = NULL; yyvsp[-1]->target_jmp = NULL;
yyval = list_create(yyvsp[-1]); yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]); yyval = list_append(yyval, yyvsp[0]);
} }
#line 2895 "awkgram.c" #line 2986 "awkgram.c"
break; break;
case 60: case 60:
#line 1052 "awkgram.y" #line 1053 "awkgram.y"
{ {
/* if inside function (rule = 0), resolve context at run-time */ /* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule) if (rule && rule != Rule)
error_ln(yyvsp[-1]->source_line, error_ln(yyvsp[-1]->source_line,
_("`next' used in %s action"), ruletab[rule]); _("`next' used in %s action"), ruletab[rule]);
yyvsp[-1]->target_jmp = ip_rec; yyvsp[-1]->target_jmp = ip_rec;
yyval = list_create(yyvsp[-1]); yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]); yyval = list_append(yyval, yyvsp[0]);
} }
#line 2910 "awkgram.c" #line 3001 "awkgram.c"
break; break;
case 61: case 61:
#line 1063 "awkgram.y" #line 1064 "awkgram.y"
{ {
/* if inside function (rule = 0), resolve context at run-time */ /* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE) if (rule == BEGIN || rule == END || rule == ENDFILE)
error_ln(yyvsp[-1]->source_line, error_ln(yyvsp[-1]->source_line,
_("`nextfile' used in %s action"), ruletab[rule]) ; _("`nextfile' used in %s action"), ruletab[rule]) ;
yyvsp[-1]->target_newfile = ip_newfile; yyvsp[-1]->target_newfile = ip_newfile;
yyvsp[-1]->target_endfile = ip_endfile; yyvsp[-1]->target_endfile = ip_endfile;
yyval = list_create(yyvsp[-1]); yyval = list_create(yyvsp[-1]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]); yyval = list_append(yyval, yyvsp[0]);
} }
#line 2927 "awkgram.c" #line 3018 "awkgram.c"
break; break;
case 62: case 62:
#line 1076 "awkgram.y" #line 1077 "awkgram.y"
{ {
/* Initialize the two possible jump targets, the actual target /* Initialize the two possible jump targets, the actual target
* is resolved at run-time. * is resolved at run-time.
*/ */
yyvsp[-2]->target_end = ip_end; /* first instruction in end_block */ yyvsp[-2]->target_end = ip_end; /* first instruction in end_block */
yyvsp[-2]->target_atexit = ip_atexit; /* cleanup and go home */ yyvsp[-2]->target_atexit = ip_atexit; /* cleanup and go home */
if (yyvsp[-1] == NULL) { if (yyvsp[-1] == NULL) {
yyval = list_create(yyvsp[-2]); yyval = list_create(yyvsp[-2]);
(void) list_prepend(yyval, instruction(Op_push_i)); (void) list_prepend(yyval, instruction(Op_push_i));
yyval->nexti->memory = dupnode(Nnull_string); yyval->nexti->memory = dupnode(Nnull_string);
} else } else
yyval = list_append(yyvsp[-1], yyvsp[-2]); yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]); yyval = list_append(yyval, yyvsp[0]);
} }
#line 2948 "awkgram.c" #line 3039 "awkgram.c"
break; break;
case 63: case 63:
#line 1093 "awkgram.y" #line 1094 "awkgram.y"
{ {
if (! in_function) if (! in_function)
yyerror(_("`return' used outside function context")); yyerror(_("`return' used outside function context"));
} }
#line 2957 "awkgram.c" #line 3048 "awkgram.c"
break; break;
case 64: case 64:
#line 1096 "awkgram.y" #line 1097 "awkgram.y"
{ {
if (called_from_eval) if (called_from_eval)
yyvsp[-3]->opcode = Op_K_return_from_eval; yyvsp[-3]->opcode = Op_K_return_from_eval;
if (yyvsp[-1] == NULL) { if (yyvsp[-1] == NULL) {
yyval = list_create(yyvsp[-3]); yyval = list_create(yyvsp[-3]);
(void) list_prepend(yyval, instruction(Op_push_i)); (void) list_prepend(yyval, instruction(Op_push_i));
yyval->nexti->memory = dupnode(Nnull_string); yyval->nexti->memory = dupnode(Nnull_string);
} else } else
yyval = list_append(yyvsp[-1], yyvsp[-3]); yyval = list_append(yyvsp[-1], yyvsp[-3]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]); yyval = list_append(yyval, yyvsp[0]);
} }
#line 2975 "awkgram.c" #line 3066 "awkgram.c"
break; break;
case 65: case 65:
#line 1110 "awkgram.y" #line 1111 "awkgram.y"
{ {
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
yyval = list_append(yyvsp[-1], yyvsp[0]); yyval = list_append(yyvsp[-1], yyvsp[0]);
else else
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} }
#line 2986 "awkgram.c" #line 3077 "awkgram.c"
break; break;
case 66: case 66:
#line 1127 "awkgram.y" #line 1128 "awkgram.y"
{ in_print = true; in_parens = 0; } { in_print = true; in_parens = 0; }
#line 2992 "awkgram.c" #line 3083 "awkgram.c"
break; break;
case 67: case 67:
#line 1128 "awkgram.y" #line 1129 "awkgram.y"
{ {
/* /*
* Optimization: plain `print' has no expression list, so $3 is n ull. * Optimization: plain `print' has no expression list, so $3 is n ull.
* If $3 is NULL or is a bytecode list for $0 use Op_K_print_rec, * If $3 is NULL or is a bytecode list for $0 use Op_K_print_rec,
* which is faster for these two cases. * which is faster for these two cases.
*/ */
if (do_optimize && yyvsp[-3]->opcode == Op_K_print && if (do_optimize && yyvsp[-3]->opcode == Op_K_print &&
(yyvsp[-1] == NULL (yyvsp[-1] == NULL
|| (yyvsp[-1]->lasti->opcode == Op_field_spec || (yyvsp[-1]->lasti->opcode == Op_field_spec
&& yyvsp[-1]->nexti->nexti->nexti == yyvs p[-1]->lasti && yyvsp[-1]->nexti->nexti->nexti == yyvs p[-1]->lasti
skipping to change at line 3065 skipping to change at line 3155
yyvsp[-3]->opcode = Op_K_print_re c; yyvsp[-3]->opcode = Op_K_print_re c;
yyval = list_append(yyvsp[0], yyvsp[-3]); yyval = list_append(yyvsp[0], yyvsp[-3]);
} else { } else {
INSTRUCTION *t = yyvsp[-1]; INSTRUCTION *t = yyvsp[-1];
yyvsp[-3]->expr_count = count_expressions (&t, false); yyvsp[-3]->expr_count = count_expressions (&t, false);
yyval = list_append(list_merge(yyvsp[0], t), yyvsp[-3]); yyval = list_append(list_merge(yyvsp[0], t), yyvsp[-3]);
} }
} }
} }
} }
#line 3097 "awkgram.c" #line 3188 "awkgram.c"
break; break;
case 68: case 68:
#line 1229 "awkgram.y" #line 1230 "awkgram.y"
{ sub_counter = 0; } { sub_counter = 0; }
#line 3103 "awkgram.c" #line 3194 "awkgram.c"
break; break;
case 69: case 69:
#line 1230 "awkgram.y" #line 1231 "awkgram.y"
{ {
char *arr = yyvsp[-2]->lextok; char *arr = yyvsp[-2]->lextok;
yyvsp[-2]->opcode = Op_push_array; yyvsp[-2]->opcode = Op_push_array;
yyvsp[-2]->memory = variable(yyvsp[-2]->source_line, arr, Node_va r_new); yyvsp[-2]->memory = variable(yyvsp[-2]->source_line, arr, Node_va r_new);
if (! do_posix && ! do_traditional) { if (! do_posix && ! do_traditional) {
if (yyvsp[-2]->memory == symbol_table) if (yyvsp[-2]->memory == symbol_table)
fatal(_("`delete' is not allowed with SYMTAB")); fatal(_("`delete' is not allowed with SYMTAB"));
else if (yyvsp[-2]->memory == func_table) else if (yyvsp[-2]->memory == func_table)
fatal(_("`delete' is not allowed with FUNCTAB")); fatal(_("`delete' is not allowed with FUNCTAB"));
skipping to change at line 3108 skipping to change at line 3198
* Also, since BWK awk supports it, we don't have to * Also, since BWK awk supports it, we don't have to
* check do_traditional either. * check do_traditional either.
*/ */
yyvsp[-3]->expr_count = 0; yyvsp[-3]->expr_count = 0;
yyval = list_append(list_create(yyvsp[-2]), yyvsp[-3]); yyval = list_append(list_create(yyvsp[-2]), yyvsp[-3]);
} else { } else {
yyvsp[-3]->expr_count = sub_counter; yyvsp[-3]->expr_count = sub_counter;
yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyv sp[-3]); yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyv sp[-3]);
} }
} }
#line 3140 "awkgram.c" #line 3231 "awkgram.c"
break; break;
case 70: case 70:
#line 1267 "awkgram.y" #line 1268 "awkgram.y"
{ {
static bool warned = false; static bool warned = false;
char *arr = yyvsp[-1]->lextok; char *arr = yyvsp[-1]->lextok;
if (do_lint && ! warned) { if (do_lint && ! warned) {
warned = true; warned = true;
lintwarn_ln(yyvsp[-3]->source_line, lintwarn_ln(yyvsp[-3]->source_line,
_("`delete(array)' is a non-portable tawk extensi on")); _("`delete(array)' is a non-portable tawk extensi on"));
} }
if (do_traditional) { if (do_traditional) {
error_ln(yyvsp[-3]->source_line, error_ln(yyvsp[-3]->source_line,
skipping to change at line 3138 skipping to change at line 3228
yyvsp[-3]->expr_count = 0; yyvsp[-3]->expr_count = 0;
yyval = list_append(list_create(yyvsp[-1]), yyvsp[-3]); yyval = list_append(list_create(yyvsp[-1]), yyvsp[-3]);
if (! do_posix && ! do_traditional) { if (! do_posix && ! do_traditional) {
if (yyvsp[-1]->memory == symbol_table) if (yyvsp[-1]->memory == symbol_table)
fatal(_("`delete' is not allowed with SYMTAB")); fatal(_("`delete' is not allowed with SYMTAB"));
else if (yyvsp[-1]->memory == func_table) else if (yyvsp[-1]->memory == func_table)
fatal(_("`delete' is not allowed with FUNCTAB")); fatal(_("`delete' is not allowed with FUNCTAB"));
} }
} }
#line 3170 "awkgram.c" #line 3261 "awkgram.c"
break; break;
case 71: case 71:
#line 1293 "awkgram.y" #line 1294 "awkgram.y"
{ {
yyval = optimize_assignment(yyvsp[0]); yyval = optimize_assignment(yyvsp[0]);
} }
#line 3178 "awkgram.c" #line 3269 "awkgram.c"
break; break;
case 72: case 72:
#line 1300 "awkgram.y" #line 1301 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3184 "awkgram.c" #line 3275 "awkgram.c"
break; break;
case 73: case 73:
#line 1302 "awkgram.y" #line 1303 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3190 "awkgram.c" #line 3281 "awkgram.c"
break; break;
case 74: case 74:
#line 1307 "awkgram.y" #line 1308 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3196 "awkgram.c" #line 3287 "awkgram.c"
break; break;
case 75: case 75:
#line 1309 "awkgram.y" #line 1310 "awkgram.y"
{ {
if (yyvsp[-1] == NULL) if (yyvsp[-1] == NULL)
yyval = list_create(yyvsp[0]); yyval = list_create(yyvsp[0]);
else else
yyval = list_prepend(yyvsp[-1], yyvsp[0]); yyval = list_prepend(yyvsp[-1], yyvsp[0]);
} }
#line 3207 "awkgram.c" #line 3298 "awkgram.c"
break; break;
case 76: case 76:
#line 1316 "awkgram.y" #line 1317 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3213 "awkgram.c" #line 3304 "awkgram.c"
break; break;
case 77: case 77:
#line 1321 "awkgram.y" #line 1322 "awkgram.y"
{ {
INSTRUCTION *casestmt = yyvsp[0]; INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL) if (yyvsp[0] == NULL)
casestmt = list_create(instruction(Op_no_op)); casestmt = list_create(instruction(Op_no_op));
if (do_pretty_print) if (do_pretty_print)
(void) list_prepend(casestmt, instruction(Op_exec_count)) ; (void) list_prepend(casestmt, instruction(Op_exec_count)) ;
yyvsp[-4]->case_exp = yyvsp[-3]; yyvsp[-4]->case_exp = yyvsp[-3];
yyvsp[-4]->case_stmt = casestmt; yyvsp[-4]->case_stmt = casestmt;
yyvsp[-4]->comment = yyvsp[-1]; yyvsp[-4]->comment = yyvsp[-1];
bcfree(yyvsp[-2]); bcfree(yyvsp[-2]);
yyval = yyvsp[-4]; yyval = yyvsp[-4];
} }
#line 3230 "awkgram.c" #line 3321 "awkgram.c"
break; break;
case 78: case 78:
#line 1334 "awkgram.y" #line 1335 "awkgram.y"
{ {
INSTRUCTION *casestmt = yyvsp[0]; INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL) if (yyvsp[0] == NULL)
casestmt = list_create(instruction(Op_no_op)); casestmt = list_create(instruction(Op_no_op));
if (do_pretty_print) if (do_pretty_print)
(void) list_prepend(casestmt, instruction(Op_exec_count)) ; (void) list_prepend(casestmt, instruction(Op_exec_count)) ;
bcfree(yyvsp[-2]); bcfree(yyvsp[-2]);
yyvsp[-3]->case_stmt = casestmt; yyvsp[-3]->case_stmt = casestmt;
yyvsp[-3]->comment = yyvsp[-1]; yyvsp[-3]->comment = yyvsp[-1];
yyval = yyvsp[-3]; yyval = yyvsp[-3];
} }
#line 3246 "awkgram.c" #line 3337 "awkgram.c"
break; break;
case 79: case 79:
#line 1349 "awkgram.y" #line 1350 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3252 "awkgram.c" #line 3343 "awkgram.c"
break; break;
case 80: case 80:
#line 1351 "awkgram.y" #line 1352 "awkgram.y"
{ {
NODE *n = yyvsp[0]->memory; NODE *n = yyvsp[0]->memory;
(void) force_number(n); (void) force_number(n);
negate_num(n); negate_num(n);
bcfree(yyvsp[-1]); bcfree(yyvsp[-1]);
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3264 "awkgram.c" #line 3355 "awkgram.c"
break; break;
case 81: case 81:
#line 1359 "awkgram.y" #line 1360 "awkgram.y"
{ {
NODE *n = yyvsp[0]->lasti->memory; NODE *n = yyvsp[0]->lasti->memory;
bcfree(yyvsp[-1]); bcfree(yyvsp[-1]);
add_sign_to_num(n, '+'); add_sign_to_num(n, '+');
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3275 "awkgram.c" #line 3366 "awkgram.c"
break; break;
case 82: case 82:
#line 1366 "awkgram.y" #line 1367 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3281 "awkgram.c" #line 3372 "awkgram.c"
break; break;
case 83: case 83:
#line 1368 "awkgram.y" #line 1369 "awkgram.y"
{ {
if (yyvsp[0]->memory->type == Node_regex) if (yyvsp[0]->memory->type == Node_regex)
yyvsp[0]->opcode = Op_push_re; yyvsp[0]->opcode = Op_push_re;
else else
yyvsp[0]->opcode = Op_push; yyvsp[0]->opcode = Op_push;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3293 "awkgram.c" #line 3384 "awkgram.c"
break; break;
case 84: case 84:
#line 1376 "awkgram.y" #line 1377 "awkgram.y"
{ {
assert((yyvsp[0]->memory->flags & REGEX) == REGEX); assert((yyvsp[0]->memory->flags & REGEX) == REGEX);
yyvsp[0]->opcode = Op_push_re; yyvsp[0]->opcode = Op_push_re;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3303 "awkgram.c" #line 3394 "awkgram.c"
break; break;
case 85: case 85:
#line 1385 "awkgram.y" #line 1386 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3309 "awkgram.c" #line 3400 "awkgram.c"
break; break;
case 86: case 86:
#line 1387 "awkgram.y" #line 1388 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3315 "awkgram.c" #line 3406 "awkgram.c"
break; break;
case 88: case 88:
#line 1397 "awkgram.y" #line 1398 "awkgram.y"
{ {
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} }
#line 3323 "awkgram.c" #line 3414 "awkgram.c"
break; break;
case 89: case 89:
#line 1404 "awkgram.y" #line 1405 "awkgram.y"
{ {
in_print = false; in_print = false;
in_parens = 0; in_parens = 0;
yyval = NULL; yyval = NULL;
} }
#line 3333 "awkgram.c" #line 3424 "awkgram.c"
break; break;
case 90: case 90:
#line 1409 "awkgram.y" #line 1410 "awkgram.y"
{ in_print = false; in_parens = 0; } { in_print = false; in_parens = 0; }
#line 3339 "awkgram.c" #line 3430 "awkgram.c"
break; break;
case 91: case 91:
#line 1410 "awkgram.y" #line 1411 "awkgram.y"
{ {
if (yyvsp[-2]->redir_type == redirect_twoway if (yyvsp[-2]->redir_type == redirect_twoway
&& yyvsp[0]->lasti->opcode == Op_K_getline_redir && yyvsp[0]->lasti->opcode == Op_K_getline_redir
&& yyvsp[0]->lasti->redir_type == redirect_twoway ) && yyvsp[0]->lasti->redir_type == redirect_twoway )
yyerror(_("multistage two-way pipelines don't work")); yyerror(_("multistage two-way pipelines don't work"));
if (do_lint && yyvsp[-2]->redir_type == redirect_output && yyvsp[ 0]->lasti->opcode == Op_concat) if (do_lint && yyvsp[-2]->redir_type == redirect_output && yyvsp[ 0]->lasti->opcode == Op_concat)
lintwarn(_("concatenation as I/O `>' redirection target i s ambiguous")); lintwarn(_("concatenation as I/O `>' redirection target i s ambiguous"));
yyval = list_prepend(yyvsp[0], yyvsp[-2]); yyval = list_prepend(yyvsp[0], yyvsp[-2]);
} }
#line 3353 "awkgram.c" #line 3444 "awkgram.c"
break; break;
case 92: case 92:
#line 1423 "awkgram.y" #line 1424 "awkgram.y"
{ {
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[-5]->comment = yyvsp[-1]; yyvsp[-5]->comment = yyvsp[-1];
add_lint(yyvsp[-3], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL, NULL); yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL, NULL);
} }
#line 3363 "awkgram.c" #line 3455 "awkgram.c"
break; break;
case 93: case 93:
#line 1430 "awkgram.y" #line 1432 "awkgram.y"
{ {
if (yyvsp[-4] != NULL) if (yyvsp[-4] != NULL)
yyvsp[-8]->comment = yyvsp[-4]; yyvsp[-8]->comment = yyvsp[-4];
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[-2]->comment = yyvsp[-1]; yyvsp[-2]->comment = yyvsp[-1];
add_lint(yyvsp[-6], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]); yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]);
} }
#line 3375 "awkgram.c" #line 3468 "awkgram.c"
break; break;
case 94: case 94:
#line 1441 "awkgram.y" #line 1444 "awkgram.y"
{ {
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3383 "awkgram.c" #line 3476 "awkgram.c"
break; break;
case 95: case 95:
#line 1445 "awkgram.y" #line 1448 "awkgram.y"
{ {
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) { if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) {
assert(yyvsp[0]->memory->comment_type == BLOCK_CO MMENT); assert(yyvsp[0]->memory->comment_type == BLOCK_CO MMENT);
yyvsp[-1]->comment = yyvsp[0]; // chain them yyvsp[-1]->comment = yyvsp[0]; // chain them
} else { } else {
merge_comments(yyvsp[-1], yyvsp[0]); merge_comments(yyvsp[-1], yyvsp[0]);
} }
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} else if (yyvsp[-1] != NULL) { } else if (yyvsp[-1] != NULL) {
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} else if (yyvsp[0] != NULL) { } else if (yyvsp[0] != NULL) {
yyval = yyvsp[0]; yyval = yyvsp[0];
} else } else
yyval = NULL; yyval = NULL;
} }
#line 3405 "awkgram.c" #line 3498 "awkgram.c"
break; break;
case 96: case 96:
#line 1466 "awkgram.y" #line 1469 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3411 "awkgram.c" #line 3504 "awkgram.c"
break; break;
case 97: case 97:
#line 1468 "awkgram.y" #line 1471 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3417 "awkgram.c" #line 3510 "awkgram.c"
break; break;
case 98: case 98:
#line 1473 "awkgram.y" #line 1476 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3423 "awkgram.c" #line 3516 "awkgram.c"
break; break;
case 99: case 99:
#line 1475 "awkgram.y" #line 1478 "awkgram.y"
{ {
bcfree(yyvsp[-1]); bcfree(yyvsp[-1]);
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3432 "awkgram.c" #line 3525 "awkgram.c"
break; break;
case 100: case 100:
#line 1483 "awkgram.y" #line 1486 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3438 "awkgram.c" #line 3531 "awkgram.c"
break; break;
case 101: case 101:
#line 1485 "awkgram.y" #line 1488 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3444 "awkgram.c" #line 3537 "awkgram.c"
break; break;
case 102: case 102:
#line 1490 "awkgram.y" #line 1493 "awkgram.y"
{ {
yyvsp[0]->param_count = 0; yyvsp[0]->param_count = 0;
yyval = list_create(yyvsp[0]); yyval = list_create(yyvsp[0]);
} }
#line 3453 "awkgram.c" #line 3546 "awkgram.c"
break; break;
case 103: case 103:
#line 1495 "awkgram.y" #line 1498 "awkgram.y"
{ {
if (yyvsp[-2] != NULL && yyvsp[0] != NULL) { if (yyvsp[-2] != NULL && yyvsp[0] != NULL) {
yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count + 1 ; yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count + 1 ;
yyval = list_append(yyvsp[-2], yyvsp[0]); yyval = list_append(yyvsp[-2], yyvsp[0]);
yyerrok; yyerrok;
// newlines are allowed after commas, catch any comments // newlines are allowed after commas, catch any comments
if (yyvsp[-1] != NULL) { if (yyvsp[-1] != NULL) {
if (yyvsp[-2]->comment != NULL) if (yyvsp[-2]->comment != NULL)
merge_comments(yyvsp[-2]->comment, yyvsp[ -1]); merge_comments(yyvsp[-2]->comment, yyvsp[ -1]);
else else
yyvsp[-2]->comment = yyvsp[-1]; yyvsp[-2]->comment = yyvsp[-1];
} }
} else } else
yyval = NULL; yyval = NULL;
} }
#line 3474 "awkgram.c" #line 3567 "awkgram.c"
break; break;
case 104: case 104:
#line 1512 "awkgram.y" #line 1515 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3480 "awkgram.c" #line 3573 "awkgram.c"
break; break;
case 105: case 105:
#line 1514 "awkgram.y" #line 1517 "awkgram.y"
{ yyval = yyvsp[-1]; } { yyval = yyvsp[-1]; }
#line 3486 "awkgram.c" #line 3579 "awkgram.c"
break; break;
case 106: case 106:
#line 1516 "awkgram.y" #line 1519 "awkgram.y"
{ yyval = yyvsp[-2]; } { yyval = yyvsp[-2]; }
#line 3492 "awkgram.c" #line 3585 "awkgram.c"
break; break;
case 107: case 107:
#line 1522 "awkgram.y" #line 1525 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3498 "awkgram.c" #line 3591 "awkgram.c"
break; break;
case 108: case 108:
#line 1524 "awkgram.y" #line 1527 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3504 "awkgram.c" #line 3597 "awkgram.c"
break; break;
case 109: case 109:
#line 1529 "awkgram.y" #line 1532 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3510 "awkgram.c" #line 3603 "awkgram.c"
break; break;
case 110: case 110:
#line 1531 "awkgram.y" #line 1534 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3516 "awkgram.c" #line 3609 "awkgram.c"
break; break;
case 111: case 111:
#line 1536 "awkgram.y" #line 1539 "awkgram.y"
{ yyval = mk_expression_list(NULL, yyvsp[0]); } { yyval = mk_expression_list(NULL, yyvsp[0]); }
#line 3522 "awkgram.c" #line 3615 "awkgram.c"
break; break;
case 112: case 112:
#line 1538 "awkgram.y" #line 1541 "awkgram.y"
{ {
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1]; yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok; yyerrok;
} }
#line 3533 "awkgram.c" #line 3626 "awkgram.c"
break; break;
case 113: case 113:
#line 1545 "awkgram.y" #line 1548 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3539 "awkgram.c" #line 3632 "awkgram.c"
break; break;
case 114: case 114:
#line 1547 "awkgram.y" #line 1550 "awkgram.y"
{ {
/* /*
* Returning the expression list instead of NULL lets * Returning the expression list instead of NULL lets
* snode get a list of arguments that it can count. * snode get a list of arguments that it can count.
*/ */
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} }
#line 3551 "awkgram.c" #line 3644 "awkgram.c"
break; break;
case 115: case 115:
#line 1555 "awkgram.y" #line 1558 "awkgram.y"
{ {
/* Ditto */ /* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
} }
#line 3560 "awkgram.c" #line 3653 "awkgram.c"
break; break;
case 116: case 116:
#line 1560 "awkgram.y" #line 1563 "awkgram.y"
{ {
/* Ditto */ /* Ditto */
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1]; yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = yyvsp[-2]; yyval = yyvsp[-2];
} }
#line 3571 "awkgram.c" #line 3664 "awkgram.c"
break; break;
case 117: case 117:
#line 1570 "awkgram.y" #line 1573 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3577 "awkgram.c" #line 3670 "awkgram.c"
break; break;
case 118: case 118:
#line 1572 "awkgram.y" #line 1575 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3583 "awkgram.c" #line 3676 "awkgram.c"
break; break;
case 119: case 119:
#line 1577 "awkgram.y" #line 1580 "awkgram.y"
{ yyval = mk_expression_list(NULL, yyvsp[0]); } { yyval = mk_expression_list(NULL, yyvsp[0]); }
#line 3589 "awkgram.c" #line 3682 "awkgram.c"
break; break;
case 120: case 120:
#line 1579 "awkgram.y" #line 1582 "awkgram.y"
{ {
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1]; yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok; yyerrok;
} }
#line 3600 "awkgram.c" #line 3693 "awkgram.c"
break; break;
case 121: case 121:
#line 1586 "awkgram.y" #line 1589 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 3606 "awkgram.c" #line 3699 "awkgram.c"
break; break;
case 122: case 122:
#line 1588 "awkgram.y" #line 1591 "awkgram.y"
{ {
/* /*
* Returning the expression list instead of NULL lets * Returning the expression list instead of NULL lets
* snode get a list of arguments that it can count. * snode get a list of arguments that it can count.
*/ */
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} }
#line 3618 "awkgram.c" #line 3711 "awkgram.c"
break; break;
case 123: case 123:
#line 1596 "awkgram.y" #line 1599 "awkgram.y"
{ {
/* Ditto */ /* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
} }
#line 3627 "awkgram.c" #line 3720 "awkgram.c"
break; break;
case 124: case 124:
#line 1601 "awkgram.y" #line 1604 "awkgram.y"
{ {
/* Ditto */ /* Ditto */
if (yyvsp[-1] != NULL) if (yyvsp[-1] != NULL)
yyvsp[-2]->comment = yyvsp[-1]; yyvsp[-2]->comment = yyvsp[-1];
yyval = yyvsp[-2]; yyval = yyvsp[-2];
} }
#line 3638 "awkgram.c" #line 3731 "awkgram.c"
break; break;
case 125: case 125:
#line 1610 "awkgram.y" #line 1613 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3644 "awkgram.c" #line 3737 "awkgram.c"
break; break;
case 126: case 126:
#line 1611 "awkgram.y" #line 1614 "awkgram.y"
{ yyval = list_create(yyvsp[0]); } { yyval = list_create(yyvsp[0]); }
#line 3650 "awkgram.c" #line 3743 "awkgram.c"
break; break;
case 127: case 127:
#line 1617 "awkgram.y" #line 1620 "awkgram.y"
{ {
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec) if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line, lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of assignment")); _("regular expression on right of assignment"));
yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]); yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]);
} }
#line 3661 "awkgram.c" #line 3754 "awkgram.c"
break; break;
case 128: case 128:
#line 1624 "awkgram.y" #line 1627 "awkgram.y"
{ {
yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1] ); yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1] );
} }
#line 3669 "awkgram.c" #line 3762 "awkgram.c"
break; break;
case 129: case 129:
#line 1628 "awkgram.y" #line 1631 "awkgram.y"
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3675 "awkgram.c" #line 3768 "awkgram.c"
break; break;
case 130: case 130:
#line 1630 "awkgram.y" #line 1633 "awkgram.y"
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3681 "awkgram.c" #line 3774 "awkgram.c"
break; break;
case 131: case 131:
#line 1632 "awkgram.y" #line 1635 "awkgram.y"
{ {
if (yyvsp[-2]->lasti->opcode == Op_match_rec) if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line, warning_ln(yyvsp[-1]->source_line,
_("regular expression on left of `~' or `!~' oper ator")); _("regular expression on left of `~' or `!~' oper ator"));
assert(yyvsp[0]->opcode == Op_push_re assert(yyvsp[0]->opcode == Op_push_re
&& (yyvsp[0]->memory->flags & REGEX) != 0); && (yyvsp[0]->memory->flags & REGEX) != 0);
/* RHS is @/.../ */ /* RHS is @/.../ */
yyvsp[-1]->memory = yyvsp[0]->memory; yyvsp[-1]->memory = yyvsp[0]->memory;
bcfree(yyvsp[0]); bcfree(yyvsp[0]);
yyval = list_append(yyvsp[-2], yyvsp[-1]); yyval = list_append(yyvsp[-2], yyvsp[-1]);
} }
#line 3698 "awkgram.c" #line 3791 "awkgram.c"
break; break;
case 132: case 132:
#line 1645 "awkgram.y" #line 1648 "awkgram.y"
{ {
if (yyvsp[-2]->lasti->opcode == Op_match_rec) if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line, warning_ln(yyvsp[-1]->source_line,
_("regular expression on left of `~' or `!~' oper ator")); _("regular expression on left of `~' or `!~' oper ator"));
if (yyvsp[0]->lasti == yyvsp[0]->nexti && yyvsp[0]->nexti->opcode == Op_match_rec) { if (yyvsp[0]->lasti == yyvsp[0]->nexti && yyvsp[0]->nexti->opcode == Op_match_rec) {
/* RHS is /.../ */ /* RHS is /.../ */
yyvsp[-1]->memory = yyvsp[0]->nexti->memory; yyvsp[-1]->memory = yyvsp[0]->nexti->memory;
bcfree(yyvsp[0]->nexti); /* Op_match_rec */ bcfree(yyvsp[0]->nexti); /* Op_match_rec */
bcfree(yyvsp[0]); /* Op_list */ bcfree(yyvsp[0]); /* Op_list */
yyval = list_append(yyvsp[-2], yyvsp[-1]); yyval = list_append(yyvsp[-2], yyvsp[-1]);
} else { } else {
yyvsp[-1]->memory = make_regnode(Node_dynregex, NULL); yyvsp[-1]->memory = make_regnode(Node_dynregex, NULL);
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvs p[-1]); yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvs p[-1]);
} }
} }
#line 3719 "awkgram.c" #line 3812 "awkgram.c"
break; break;
case 133: case 133:
#line 1662 "awkgram.y" #line 1665 "awkgram.y"
{ {
if (do_lint_old) if (do_lint_old)
warning_ln(yyvsp[-1]->source_line, lintwarn_ln(yyvsp[-1]->source_line,
_("old awk does not support the keyword `in' exce pt after `for'")); _("old awk does not support the keyword `in' exce pt after `for'"));
yyvsp[0]->nexti->opcode = Op_push_array; yyvsp[0]->nexti->opcode = Op_push_array;
yyvsp[-1]->opcode = Op_in_array; yyvsp[-1]->opcode = Op_in_array;
yyvsp[-1]->expr_count = 1; yyvsp[-1]->expr_count = 1;
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
} }
#line 3733 "awkgram.c" #line 3826 "awkgram.c"
break; break;
case 134: case 134:
#line 1672 "awkgram.y" #line 1675 "awkgram.y"
{ {
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec) if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line, lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of comparison")); _("regular expression on right of comparison"));
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
} }
#line 3744 "awkgram.c" #line 3837 "awkgram.c"
break; break;
case 135: case 135:
#line 1679 "awkgram.y" #line 1682 "awkgram.y"
{ yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]) { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyv
; } sp[0]); }
#line 3750 "awkgram.c" #line 3843 "awkgram.c"
break; break;
case 136: case 136:
#line 1681 "awkgram.y" #line 1684 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3756 "awkgram.c" #line 3849 "awkgram.c"
break; break;
case 137: case 137:
#line 1686 "awkgram.y" #line 1689 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3762 "awkgram.c" #line 3855 "awkgram.c"
break; break;
case 138: case 138:
#line 1688 "awkgram.y" #line 1691 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3768 "awkgram.c" #line 3861 "awkgram.c"
break; break;
case 139: case 139:
#line 1690 "awkgram.y" #line 1693 "awkgram.y"
{ {
yyvsp[0]->opcode = Op_assign_quotient; yyvsp[0]->opcode = Op_assign_quotient;
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 3777 "awkgram.c" #line 3870 "awkgram.c"
break; break;
case 140: case 140:
#line 1698 "awkgram.y" #line 1701 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3783 "awkgram.c" #line 3876 "awkgram.c"
break; break;
case 141: case 141:
#line 1700 "awkgram.y" #line 1703 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3789 "awkgram.c" #line 3882 "awkgram.c"
break; break;
case 142: case 142:
#line 1705 "awkgram.y" #line 1708 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3795 "awkgram.c" #line 3888 "awkgram.c"
break; break;
case 143: case 143:
#line 1707 "awkgram.y" #line 1710 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3801 "awkgram.c" #line 3894 "awkgram.c"
break; break;
case 144: case 144:
#line 1712 "awkgram.y" #line 1715 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3807 "awkgram.c" #line 3900 "awkgram.c"
break; break;
case 145: case 145:
#line 1714 "awkgram.y" #line 1717 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 3813 "awkgram.c" #line 3906 "awkgram.c"
break; break;
case 146: case 146:
#line 1716 "awkgram.y" #line 1719 "awkgram.y"
{ {
int count = 2; int count = 2;
bool is_simple_var = false; bool is_simple_var = false;
if (yyvsp[-1]->lasti->opcode == Op_concat) { if (yyvsp[-1]->lasti->opcode == Op_concat) {
/* multiple (> 2) adjacent strings optimization */ /* multiple (> 2) adjacent strings optimization */
is_simple_var = (yyvsp[-1]->lasti->concat_flag & CSVAR) ! = 0; is_simple_var = (yyvsp[-1]->lasti->concat_flag & CSVAR) ! = 0;
count = yyvsp[-1]->lasti->expr_count + 1; count = yyvsp[-1]->lasti->expr_count + 1;
yyvsp[-1]->lasti->opcode = Op_no_op; yyvsp[-1]->lasti->opcode = Op_no_op;
} else { } else {
is_simple_var = (yyvsp[-1]->nexti->opcode == Op_push is_simple_var = (yyvsp[-1]->nexti->opcode == Op_push
skipping to change at line 3839 skipping to change at line 3931
yyval = yyvsp[-1]; yyval = yyvsp[-1];
} else { } else {
plain_concat: plain_concat:
yyval = list_append(list_merge(yyvsp[-1], yyvsp[0]), inst ruction(Op_concat)); yyval = list_append(list_merge(yyvsp[-1], yyvsp[0]), inst ruction(Op_concat));
yyval->lasti->concat_flag = (is_simple_var ? CSVAR : 0); yyval->lasti->concat_flag = (is_simple_var ? CSVAR : 0);
yyval->lasti->expr_count = count; yyval->lasti->expr_count = count;
if (count > max_args) if (count > max_args)
max_args = count; max_args = count;
} }
} }
#line 3871 "awkgram.c" #line 3964 "awkgram.c"
break; break;
case 148: case 148:
#line 1775 "awkgram.y" #line 1778 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3877 "awkgram.c" #line 3970 "awkgram.c"
break; break;
case 149: case 149:
#line 1777 "awkgram.y" #line 1780 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3883 "awkgram.c" #line 3976 "awkgram.c"
break; break;
case 150: case 150:
#line 1779 "awkgram.y" #line 1782 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3889 "awkgram.c" #line 3982 "awkgram.c"
break; break;
case 151: case 151:
#line 1781 "awkgram.y" #line 1784 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3895 "awkgram.c" #line 3988 "awkgram.c"
break; break;
case 152: case 152:
#line 1783 "awkgram.y" #line 1786 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3901 "awkgram.c" #line 3994 "awkgram.c"
break; break;
case 153: case 153:
#line 1785 "awkgram.y" #line 1788 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3907 "awkgram.c" #line 4000 "awkgram.c"
break; break;
case 154: case 154:
#line 1787 "awkgram.y" #line 1790 "awkgram.y"
{ {
/* /*
* In BEGINFILE/ENDFILE, allow `getline [var] < file' * In BEGINFILE/ENDFILE, allow `getline [var] < file'
*/ */
if ((rule == BEGINFILE || rule == ENDFILE) && yyvsp[0] == NULL) if ((rule == BEGINFILE || rule == ENDFILE) && yyvsp[0] == NULL)
error_ln(yyvsp[-2]->source_line, error_ln(yyvsp[-2]->source_line,
_("non-redirected `getline' invalid inside `%s' rule"), ruletab[rule]); _("non-redirected `getline' invalid inside `%s' rule"), ruletab[rule]);
if (do_lint && rule == END && yyvsp[0] == NULL) if (do_lint && rule == END && yyvsp[0] == NULL)
lintwarn_ln(yyvsp[-2]->source_line, lintwarn_ln(yyvsp[-2]->source_line,
_("non-redirected `getline' undefined inside END action")); _("non-redirected `getline' undefined inside END action"));
yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input ); yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input );
} }
#line 3925 "awkgram.c" #line 4018 "awkgram.c"
break; break;
case 155: case 155:
#line 1801 "awkgram.y" #line 1804 "awkgram.y"
{ {
yyvsp[0]->opcode = Op_postincrement; yyvsp[0]->opcode = Op_postincrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
} }
#line 3934 "awkgram.c" #line 4027 "awkgram.c"
break; break;
case 156: case 156:
#line 1806 "awkgram.y" #line 1809 "awkgram.y"
{ {
yyvsp[0]->opcode = Op_postdecrement; yyvsp[0]->opcode = Op_postdecrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
} }
#line 3943 "awkgram.c" #line 4036 "awkgram.c"
break; break;
case 157: case 157:
#line 1811 "awkgram.y" #line 1814 "awkgram.y"
{ {
if (do_lint_old) { if (do_lint_old) {
/* first one is warning so that second one comes out if warni ngs are fatal */
warning_ln(yyvsp[-1]->source_line, warning_ln(yyvsp[-1]->source_line,
_("old awk does not support the keyword `in' exce pt after `for'")); _("old awk does not support the keyword `in' exce pt after `for'"));
warning_ln(yyvsp[-1]->source_line, lintwarn_ln(yyvsp[-1]->source_line,
_("old awk does not support multidimensional arra ys")); _("old awk does not support multidimensional arra ys"));
} }
yyvsp[0]->nexti->opcode = Op_push_array; yyvsp[0]->nexti->opcode = Op_push_array;
yyvsp[-1]->opcode = Op_in_array; yyvsp[-1]->opcode = Op_in_array;
if (yyvsp[-3] == NULL) { /* error */ if (yyvsp[-3] == NULL) { /* error */
errcount++; errcount++;
yyvsp[-1]->expr_count = 0; yyvsp[-1]->expr_count = 0;
yyval = list_merge(yyvsp[0], yyvsp[-1]); yyval = list_merge(yyvsp[0], yyvsp[-1]);
} else { } else {
INSTRUCTION *t = yyvsp[-3]; INSTRUCTION *t = yyvsp[-3];
yyvsp[-1]->expr_count = count_expressions(&t, false); yyvsp[-1]->expr_count = count_expressions(&t, false);
yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]); yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]);
} }
} }
#line 3967 "awkgram.c" #line 4061 "awkgram.c"
break; break;
case 158: case 158:
#line 1836 "awkgram.y" #line 1840 "awkgram.y"
{ {
yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->r edir_type); yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->r edir_type);
bcfree(yyvsp[-2]); bcfree(yyvsp[-2]);
} }
#line 3976 "awkgram.c" #line 4070 "awkgram.c"
break; break;
case 159: case 159:
#line 1842 "awkgram.y" #line 1846 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3982 "awkgram.c" #line 4076 "awkgram.c"
break; break;
case 160: case 160:
#line 1844 "awkgram.y" #line 1848 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3988 "awkgram.c" #line 4082 "awkgram.c"
break; break;
case 161: case 161:
#line 1846 "awkgram.y" #line 1850 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 3994 "awkgram.c" #line 4088 "awkgram.c"
break; break;
case 162: case 162:
#line 1848 "awkgram.y" #line 1852 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 4000 "awkgram.c" #line 4094 "awkgram.c"
break; break;
case 163: case 163:
#line 1850 "awkgram.y" #line 1854 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 4006 "awkgram.c" #line 4100 "awkgram.c"
break; break;
case 164: case 164:
#line 1852 "awkgram.y" #line 1856 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
#line 4012 "awkgram.c" #line 4106 "awkgram.c"
break; break;
case 165: case 165:
#line 1857 "awkgram.y" #line 1861 "awkgram.y"
{ {
yyval = list_create(yyvsp[0]); yyval = list_create(yyvsp[0]);
} }
#line 4020 "awkgram.c" #line 4114 "awkgram.c"
break; break;
case 166: case 166:
#line 1861 "awkgram.y" #line 1865 "awkgram.y"
{ {
if (yyvsp[0]->opcode == Op_match_rec) { if (yyvsp[0]->opcode == Op_match_rec) {
yyvsp[0]->opcode = Op_nomatch; yyvsp[0]->opcode = Op_nomatch;
yyvsp[-1]->opcode = Op_push_i; yyvsp[-1]->opcode = Op_push_i;
yyvsp[-1]->memory = set_profile_text(make_number(0.0), "0 ", 1); yyvsp[-1]->memory = set_profile_text(make_number(0.0), "0 ", 1);
yyval = list_append(list_append(list_create(yyvsp[-1]), yyval = list_append(list_append(list_create(yyvsp[-1]),
instruction(Op_field_spec)), yyvs p[0]); instruction(Op_field_spec)), yyvs p[0]);
} else { } else {
if (do_optimize && yyvsp[0]->nexti == yyvsp[0]->lasti if (do_optimize && yyvsp[0]->nexti == yyvsp[0]->lasti
&& yyvsp[0]->nexti->opcode == Op_push_i && yyvsp[0]->nexti->opcode == Op_push_i
&& (yyvsp[0]->nexti->memory->flags & (MPF N|MPZN|INTLSTR)) == 0 && (yyvsp[0]->nexti->memory->flags & (MPF N|MPZN|INTLSTR)) == 0
skipping to change at line 4024 skipping to change at line 4117
n->numbr = (AWKNUM) (n->numbr == 0.0); n->numbr = (AWKNUM) (n->numbr == 0.0);
bcfree(yyvsp[-1]); bcfree(yyvsp[-1]);
yyval = yyvsp[0]; yyval = yyvsp[0];
} else { } else {
yyvsp[-1]->opcode = Op_not; yyvsp[-1]->opcode = Op_not;
add_lint(yyvsp[0], LINT_assign_in_cond); add_lint(yyvsp[0], LINT_assign_in_cond);
yyval = list_append(yyvsp[0], yyvsp[-1]); yyval = list_append(yyvsp[0], yyvsp[-1]);
} }
} }
} }
#line 4056 "awkgram.c" #line 4150 "awkgram.c"
break; break;
case 167: case 167:
#line 1893 "awkgram.y" #line 1897 "awkgram.y"
{ {
// Always include. Allows us to lint warn on // Always include. Allows us to lint warn on
// print "foo" > "bar" 1 // print "foo" > "bar" 1
// but not warn on // but not warn on
// print "foo" > ("bar" 1) // print "foo" > ("bar" 1)
yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline)) ; yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline)) ;
} }
#line 4068 "awkgram.c" #line 4162 "awkgram.c"
break; break;
case 168: case 168:
#line 1901 "awkgram.y" #line 1905 "awkgram.y"
{ {
yyval = snode(yyvsp[-1], yyvsp[-3]); yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL) if (yyval == NULL)
YYABORT; YYABORT;
} }
#line 4078 "awkgram.c" #line 4172 "awkgram.c"
break; break;
case 169: case 169:
#line 1907 "awkgram.y" #line 1911 "awkgram.y"
{ {
yyval = snode(yyvsp[-1], yyvsp[-3]); yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL) if (yyval == NULL)
YYABORT; YYABORT;
} }
#line 4088 "awkgram.c" #line 4182 "awkgram.c"
break; break;
case 170: case 170:
#line 1913 "awkgram.y" #line 1917 "awkgram.y"
{ {
static bool warned = false; static bool warned = false;
if (do_lint && ! warned) { if (do_lint && ! warned) {
warned = true; warned = true;
lintwarn_ln(yyvsp[0]->source_line, lintwarn_ln(yyvsp[0]->source_line,
_("call of `length' without parentheses is not po rtable")); _("call of `length' without parentheses is not po rtable"));
} }
yyval = snode(NULL, yyvsp[0]); yyval = snode(NULL, yyvsp[0]);
if (yyval == NULL) if (yyval == NULL)
YYABORT; YYABORT;
} }
#line 4105 "awkgram.c" #line 4199 "awkgram.c"
break; break;
case 173: case 173:
#line 1928 "awkgram.y" #line 1932 "awkgram.y"
{ {
yyvsp[-1]->opcode = Op_preincrement; yyvsp[-1]->opcode = Op_preincrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
} }
#line 4114 "awkgram.c" #line 4208 "awkgram.c"
break; break;
case 174: case 174:
#line 1933 "awkgram.y" #line 1937 "awkgram.y"
{ {
yyvsp[-1]->opcode = Op_predecrement; yyvsp[-1]->opcode = Op_predecrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
} }
#line 4123 "awkgram.c" #line 4217 "awkgram.c"
break; break;
case 175: case 175:
#line 1938 "awkgram.y" #line 1942 "awkgram.y"
{ {
yyval = list_create(yyvsp[0]); yyval = list_create(yyvsp[0]);
} }
#line 4131 "awkgram.c" #line 4225 "awkgram.c"
break; break;
case 176: case 176:
#line 1942 "awkgram.y" #line 1946 "awkgram.y"
{ {
yyval = list_create(yyvsp[0]); yyval = list_create(yyvsp[0]);
} }
#line 4139 "awkgram.c" #line 4233 "awkgram.c"
break; break;
case 177: case 177:
#line 1946 "awkgram.y" #line 1950 "awkgram.y"
{ {
if (yyvsp[0]->lasti->opcode == Op_push_i if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0 && (yyvsp[0]->lasti->memory->flags & STRING) == 0
) { ) {
NODE *n = yyvsp[0]->lasti->memory; NODE *n = yyvsp[0]->lasti->memory;
(void) force_number(n); (void) force_number(n);
negate_num(n); negate_num(n);
yyval = yyvsp[0]; yyval = yyvsp[0];
bcfree(yyvsp[-1]); bcfree(yyvsp[-1]);
} else { } else {
yyvsp[-1]->opcode = Op_unary_minus; yyvsp[-1]->opcode = Op_unary_minus;
yyval = list_append(yyvsp[0], yyvsp[-1]); yyval = list_append(yyvsp[0], yyvsp[-1]);
} }
} }
#line 4158 "awkgram.c" #line 4252 "awkgram.c"
break; break;
case 178: case 178:
#line 1961 "awkgram.y" #line 1965 "awkgram.y"
{ {
if (yyvsp[0]->lasti->opcode == Op_push_i if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0 && (yyvsp[0]->lasti->memory->flags & STRING) == 0
&& (yyvsp[0]->lasti->memory->flags & NUMCONSTSTR) != 0) { && (yyvsp[0]->lasti->memory->flags & NUMCONSTSTR) != 0) {
NODE *n = yyvsp[0]->lasti->memory; NODE *n = yyvsp[0]->lasti->memory;
add_sign_to_num(n, '+'); add_sign_to_num(n, '+');
yyval = yyvsp[0]; yyval = yyvsp[0];
bcfree(yyvsp[-1]); bcfree(yyvsp[-1]);
} else { } else {
/* /*
* was: $$ = $2 * was: $$ = $2
* POSIX semantics: force a conversion to numeric type * POSIX semantics: force a conversion to numeric type
*/ */
yyvsp[-1]->opcode = Op_unary_plus; yyvsp[-1]->opcode = Op_unary_plus;
yyval = list_append(yyvsp[0], yyvsp[-1]); yyval = list_append(yyvsp[0], yyvsp[-1]);
} }
} }
#line 4180 "awkgram.c" #line 4274 "awkgram.c"
break; break;
case 179: case 179:
#line 1982 "awkgram.y" #line 1986 "awkgram.y"
{ {
func_use(yyvsp[0]->lasti->func_name, FUNC_USE); func_use(yyvsp[0]->lasti->func_name, FUNC_USE);
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 4189 "awkgram.c" #line 4283 "awkgram.c"
break; break;
case 180: case 180:
#line 1987 "awkgram.y" #line 1991 "awkgram.y"
{ {
/* indirect function call */ /* indirect function call */
INSTRUCTION *f, *t; INSTRUCTION *f, *t;
char *name; char *name;
NODE *indirect_var; NODE *indirect_var;
static bool warned = false; static bool warned = false;
const char *msg = _("indirect function calls are a gawk extension "); const char *msg = _("indirect function calls are a gawk extension ");
if (do_traditional || do_posix) if (do_traditional || do_posix)
yyerror("%s", msg); yyerror("%s", msg);
else if (do_lint && ! warned) { else if (do_lint_extensions && ! warned) {
warned = true; warned = true;
lintwarn("%s", msg); lintwarn("%s", msg);
} }
f = yyvsp[0]->lasti; f = yyvsp[0]->lasti;
f->opcode = Op_indirect_func_call; f->opcode = Op_indirect_func_call;
name = estrdup(f->func_name, strlen(f->func_name)); name = estrdup(f->func_name, strlen(f->func_name));
if (is_std_var(name)) if (is_std_var(name))
yyerror(_("can not use special variable `%s' for indirect function call"), name); yyerror(_("cannot use special variable `%s' for indirect function call"), name);
indirect_var = variable(f->source_line, name, Node_var_new); indirect_var = variable(f->source_line, name, Node_var_new);
t = instruction(Op_push); t = instruction(Op_push);
t->memory = indirect_var; t->memory = indirect_var;
/* prepend indirect var instead of appending to arguments (opt_ex pression_list), /* prepend indirect var instead of appending to arguments (opt_ex pression_list),
* and pop it off in setup_frame (eval.c) (left to right evaluati on order); Test case: * and pop it off in setup_frame (eval.c) (left to right evaluati on order); Test case:
* f = "fun" * f = "fun"
* @f(f="real_fun") * @f(f="real_fun")
*/ */
yyval = list_prepend(yyvsp[0], t); yyval = list_prepend(yyvsp[0], t);
at_seen = false; at_seen = false;
} }
#line 4227 "awkgram.c" #line 4321 "awkgram.c"
break; break;
case 181: case 181:
#line 2024 "awkgram.y" #line 2028 "awkgram.y"
{ {
NODE *n; NODE *n;
char *name = yyvsp[-3]->func_name; char *name = yyvsp[-3]->func_name;
char *qname = qualify_name(name, strlen(name)); char *qname = qualify_name(name, strlen(name));
if (qname != name) { if (qname != name) {
efree((char *) name); efree((char *) name);
yyvsp[-3]->func_name = qname; yyvsp[-3]->func_name = qname;
} }
if (! at_seen) { if (! at_seen) {
skipping to change at line 4232 skipping to change at line 4325
yyvsp[-3]->func_body = NULL; yyvsp[-3]->func_body = NULL;
if (yyvsp[-1] == NULL) { /* no argument or error */ if (yyvsp[-1] == NULL) { /* no argument or error */
(yyvsp[-3] + 1)->expr_count = 0; (yyvsp[-3] + 1)->expr_count = 0;
yyval = list_create(yyvsp[-3]); yyval = list_create(yyvsp[-3]);
} else { } else {
INSTRUCTION *t = yyvsp[-1]; INSTRUCTION *t = yyvsp[-1];
(yyvsp[-3] + 1)->expr_count = count_expressions(&t, true) ; (yyvsp[-3] + 1)->expr_count = count_expressions(&t, true) ;
yyval = list_append(t, yyvsp[-3]); yyval = list_append(t, yyvsp[-3]);
} }
} }
#line 4264 "awkgram.c" #line 4358 "awkgram.c"
break; break;
case 182: case 182:
#line 2060 "awkgram.y" #line 2064 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 4270 "awkgram.c" #line 4364 "awkgram.c"
break; break;
case 183: case 183:
#line 2062 "awkgram.y" #line 2066 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 4276 "awkgram.c" #line 4370 "awkgram.c"
break; break;
case 184: case 184:
#line 2067 "awkgram.y" #line 2071 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 4282 "awkgram.c" #line 4376 "awkgram.c"
break; break;
case 185: case 185:
#line 2069 "awkgram.y" #line 2073 "awkgram.y"
{ yyval = yyvsp[-1]; } { yyval = yyvsp[-1]; }
#line 4288 "awkgram.c" #line 4382 "awkgram.c"
break; break;
case 186: case 186:
#line 2074 "awkgram.y" #line 2078 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 4294 "awkgram.c" #line 4388 "awkgram.c"
break; break;
case 187: case 187:
#line 2076 "awkgram.y" #line 2080 "awkgram.y"
{ {
yyval = list_merge(yyvsp[-1], yyvsp[0]); yyval = list_merge(yyvsp[-1], yyvsp[0]);
} }
#line 4302 "awkgram.c" #line 4396 "awkgram.c"
break; break;
case 188: case 188:
#line 2083 "awkgram.y" #line 2087 "awkgram.y"
{ {
INSTRUCTION *ip = yyvsp[0]->lasti; INSTRUCTION *ip = yyvsp[0]->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressi ons */ int count = ip->sub_count; /* # of SUBSEP-seperated expressi ons */
if (count > 1) { if (count > 1) {
/* change Op_subscript or Op_sub_array to Op_concat */ /* change Op_subscript or Op_sub_array to Op_concat */
ip->opcode = Op_concat; ip->opcode = Op_concat;
ip->concat_flag = CSUBSEP; ip->concat_flag = CSUBSEP;
ip->expr_count = count; ip->expr_count = count;
} else } else
ip->opcode = Op_no_op; ip->opcode = Op_no_op;
sub_counter++; /* count # of dimensions */ sub_counter++; /* count # of dimensions */
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 4320 "awkgram.c" #line 4414 "awkgram.c"
break; break;
case 189: case 189:
#line 2100 "awkgram.y" #line 2104 "awkgram.y"
{ {
INSTRUCTION *t = yyvsp[-1]; INSTRUCTION *t = yyvsp[-1];
if (yyvsp[-1] == NULL) { if (yyvsp[-1] == NULL) {
error_ln(yyvsp[0]->source_line, error_ln(yyvsp[0]->source_line,
_("invalid subscript expression")); _("invalid subscript expression"));
/* install Null string as subscript. */ /* install Null string as subscript. */
t = list_create(instruction(Op_push_i)); t = list_create(instruction(Op_push_i));
t->nexti->memory = dupnode(Nnull_string); t->nexti->memory = dupnode(Nnull_string);
yyvsp[0]->sub_count = 1; yyvsp[0]->sub_count = 1;
} else } else
yyvsp[0]->sub_count = count_expressions(&t, false); yyvsp[0]->sub_count = count_expressions(&t, false);
yyval = list_append(t, yyvsp[0]); yyval = list_append(t, yyvsp[0]);
} }
#line 4338 "awkgram.c" #line 4432 "awkgram.c"
break; break;
case 190: case 190:
#line 2117 "awkgram.y" #line 2121 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 4344 "awkgram.c" #line 4438 "awkgram.c"
break; break;
case 191: case 191:
#line 2119 "awkgram.y" #line 2123 "awkgram.y"
{ {
yyval = list_merge(yyvsp[-1], yyvsp[0]); yyval = list_merge(yyvsp[-1], yyvsp[0]);
} }
#line 4352 "awkgram.c" #line 4446 "awkgram.c"
break; break;
case 192: case 192:
#line 2126 "awkgram.y" #line 2130 "awkgram.y"
{ yyval = yyvsp[-1]; } { yyval = yyvsp[-1]; }
#line 4358 "awkgram.c" #line 4452 "awkgram.c"
break; break;
case 193: case 193:
#line 2131 "awkgram.y" #line 2135 "awkgram.y"
{ {
yyvsp[0]->opcode = Op_push; yyvsp[0]->opcode = Op_push;
yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lext ok, Node_var_new); yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lext ok, Node_var_new);
yyval = list_create(yyvsp[0]); yyval = list_create(yyvsp[0]);
} }
#line 4368 "awkgram.c" #line 4462 "awkgram.c"
break; break;
case 194: case 194:
#line 2137 "awkgram.y" #line 2141 "awkgram.y"
{ {
char *arr = yyvsp[-1]->lextok; char *arr = yyvsp[-1]->lextok;
yyvsp[-1]->memory = variable(yyvsp[-1]->source_line, arr, Node_va r_new); yyvsp[-1]->memory = variable(yyvsp[-1]->source_line, arr, Node_va r_new);
yyvsp[-1]->opcode = Op_push_array; yyvsp[-1]->opcode = Op_push_array;
yyval = list_prepend(yyvsp[0], yyvsp[-1]); yyval = list_prepend(yyvsp[0], yyvsp[-1]);
} }
#line 4380 "awkgram.c" #line 4474 "awkgram.c"
break; break;
case 195: case 195:
#line 2148 "awkgram.y" #line 2152 "awkgram.y"
{ {
INSTRUCTION *ip = yyvsp[0]->nexti; INSTRUCTION *ip = yyvsp[0]->nexti;
if (ip->opcode == Op_push if (ip->opcode == Op_push
&& ip->memory->type == Node_var && ip->memory->type == Node_var
&& ip->memory->var_update && ip->memory->var_update
) { ) {
yyval = list_prepend(yyvsp[0], instruction(Op_var_update) ); yyval = list_prepend(yyvsp[0], instruction(Op_var_update) );
yyval->nexti->update_var = ip->memory->var_update; yyval->nexti->update_var = ip->memory->var_update;
} else } else
yyval = yyvsp[0]; yyval = yyvsp[0];
} }
#line 4396 "awkgram.c" #line 4490 "awkgram.c"
break; break;
case 196: case 196:
#line 2160 "awkgram.y" #line 2164 "awkgram.y"
{ {
yyval = list_append(yyvsp[-1], yyvsp[-2]); yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != NULL) if (yyvsp[0] != NULL)
mk_assignment(yyvsp[-1], NULL, yyvsp[0]); mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
} }
#line 4406 "awkgram.c" #line 4500 "awkgram.c"
break; break;
case 197: case 197:
#line 2169 "awkgram.y" #line 2173 "awkgram.y"
{ {
yyvsp[0]->opcode = Op_postincrement; yyvsp[0]->opcode = Op_postincrement;
} }
#line 4414 "awkgram.c" #line 4508 "awkgram.c"
break; break;
case 198: case 198:
#line 2173 "awkgram.y" #line 2177 "awkgram.y"
{ {
yyvsp[0]->opcode = Op_postdecrement; yyvsp[0]->opcode = Op_postdecrement;
} }
#line 4422 "awkgram.c" #line 4516 "awkgram.c"
break; break;
case 199: case 199:
#line 2177 "awkgram.y" #line 2181 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 4428 "awkgram.c" #line 4522 "awkgram.c"
break; break;
case 200: case 200:
#line 2181 "awkgram.y" #line 2185 "awkgram.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 4434 "awkgram.c" #line 4528 "awkgram.c"
break; break;
case 201: case 201:
#line 2185 "awkgram.y" #line 2189 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; } { yyval = yyvsp[0]; yyerrok; }
#line 4440 "awkgram.c" #line 4534 "awkgram.c"
break; break;
case 202: case 202:
#line 2189 "awkgram.y" #line 2193 "awkgram.y"
{ yyerrok; } { yyerrok; }
#line 4446 "awkgram.c" #line 4540 "awkgram.c"
break; break;
case 203: case 203:
#line 2194 "awkgram.y" #line 2198 "awkgram.y"
{ yyval = NULL; } { yyval = NULL; }
#line 4452 "awkgram.c" #line 4546 "awkgram.c"
break; break;
case 205: case 205:
#line 2199 "awkgram.y" #line 2203 "awkgram.y"
{ yyerrok; } { yyerrok; }
#line 4458 "awkgram.c" #line 4552 "awkgram.c"
break; break;
case 206: case 206:
#line 2203 "awkgram.y" #line 2207 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; } { yyval = yyvsp[0]; yyerrok; }
#line 4464 "awkgram.c" #line 4558 "awkgram.c"
break; break;
case 207: case 207:
#line 2207 "awkgram.y" #line 2211 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; } { yyval = yyvsp[0]; yyerrok; }
#line 4470 "awkgram.c" #line 4564 "awkgram.c"
break; break;
#line 4474 "awkgram.c" #line 4568 "awkgram.c"
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken. approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action, One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
skipping to change at line 4504 skipping to change at line 4597
{ {
char const *yymsgp = YY_("syntax error"); char const *yymsgp = YY_("syntax error");
int yysyntax_error_status; int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR; yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0) if (yysyntax_error_status == 0)
yymsgp = yymsg; yymsgp = yymsg;
else if (yysyntax_error_status == 1) else if (yysyntax_error_status == 1)
{ {
if (yymsg != yymsgbuf) if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg); YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_all oc)));
if (!yymsg) if (!yymsg)
{ {
yymsg = yymsgbuf; yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf; yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2; yysyntax_error_status = 2;
} }
else else
{ {
yysyntax_error_status = YYSYNTAX_ERROR; yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg; yymsgp = yymsg;
skipping to change at line 4649 skipping to change at line 4742
yydestruct ("Cleanup: discarding lookahead", yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval); yytoken, &yylval);
} }
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */ this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss) while (yyssp != yyss)
{ {
yydestruct ("Cleanup: popping", yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp); yystos[+*yyssp], yyvsp);
YYPOPSTACK (1); YYPOPSTACK (1);
} }
#ifndef yyoverflow #ifndef yyoverflow
if (yyss != yyssa) if (yyss != yyssa)
YYSTACK_FREE (yyss); YYSTACK_FREE (yyss);
#endif #endif
#if YYERROR_VERBOSE #if YYERROR_VERBOSE
if (yymsg != yymsgbuf) if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg); YYSTACK_FREE (yymsg);
#endif #endif
return yyresult; return yyresult;
} }
#line 2209 "awkgram.y" #line 2213 "awkgram.y"
struct token { struct token {
const char *operator; /* text to match */ const char *operator; /* text to match */
OPCODE value; /* type */ OPCODE value; /* type */
int class; /* lexical class */ int class; /* lexical class */
unsigned flags; /* # of args. allowed and compatability * / unsigned flags; /* # of args. allowed and compatability * /
# define ARGS 0xFF /* 0, 1, 2, 3 args allowed (any combination */ # define ARGS 0xFF /* 0, 1, 2, 3 args allowed (any combination */
# define A(n) (1<<(n)) # define A(n) (1<<(n))
# define VERSION_MASK 0xFF00 /* old awk is zero */ # define VERSION_MASK 0xFF00 /* old awk is zero */
# define NOT_OLD 0x0100 /* feature not in old awk */ # define NOT_OLD 0x0100 /* feature not in old awk */
skipping to change at line 5304 skipping to change at line 5397
return do_add_srcfile(stype, src, NULL, thisfile); return do_add_srcfile(stype, src, NULL, thisfile);
path = find_source(src, & sbuf, & errno_val, stype == SRC_EXTLIB); path = find_source(src, & sbuf, & errno_val, stype == SRC_EXTLIB);
if (path == NULL) { if (path == NULL) {
if (errcode) { if (errcode) {
*errcode = errno_val; *errcode = errno_val;
return NULL; return NULL;
} }
/* use full messages to ease translation */ /* use full messages to ease translation */
fatal(stype != SRC_EXTLIB fatal(stype != SRC_EXTLIB
? _("can't open source file `%s' for reading (%s)") ? _("cannot open source file `%s' for reading: %s")
: _("can't open shared library `%s' for reading (%s)"), : _("cannot open shared library `%s' for reading: %s"),
src, src,
errno_val ? strerror(errno_val) : _("reason unkno wn")); errno_val ? strerror(errno_val) : _("reason unkno wn"));
} }
/* N.B. We do not eliminate duplicate SRC_FILE (-f) programs. */ /* N.B. We do not eliminate duplicate SRC_FILE (-f) programs. */
for (s = srcfiles->next; s != srcfiles; s = s->next) { for (s = srcfiles->next; s != srcfiles; s = s->next) {
if ((s->stype == SRC_FILE || s->stype == SRC_INC || s->stype == S RC_EXTLIB) && files_are_same(path, s)) { if ((s->stype == SRC_FILE || s->stype == SRC_INC || s->stype == S RC_EXTLIB) && files_are_same(path, s)) {
if (stype == SRC_INC || stype == SRC_EXTLIB) { if (stype == SRC_INC || stype == SRC_EXTLIB) {
/* eliminate duplicates */ /* eliminate duplicates */
if ((stype == SRC_INC) && (s->stype == SRC_FILE)) if ((stype == SRC_INC) && (s->stype == SRC_FILE))
fatal(_("can't include `%s' and use it as a program file"), src); fatal(_("cannot include `%s' and use it a s a program file"), src);
if (do_lint) { if (do_lint) {
int line = sourceline; int line = sourceline;
/* Kludge: the line number may be off for `@include file'. /* Kludge: the line number may be off for `@include file'.
* Since, this function is also used for '-f file' in main.c, * Since, this function is also used for '-f file' in main.c,
* sourceline > 1 check ensures that the call is at * sourceline > 1 check ensures that the call is at
* parse time. * parse time.
*/ */
if (sourceline > 1 && lasttok == NEWLINE) if (sourceline > 1 && lasttok == NEWLINE)
line--; line--;
skipping to change at line 5340 skipping to change at line 5433
: _("already loaded shared library `%s'"), : _("already loaded shared library `%s'"),
src); src);
} }
efree(path); efree(path);
if (already_included) if (already_included)
*already_included = true; *already_included = true;
return NULL; return NULL;
} else { } else {
/* duplicates are allowed for -f */ /* duplicates are allowed for -f */
if (s->stype == SRC_INC) if (s->stype == SRC_INC)
fatal(_("can't include `%s' and use it as a program file"), src); fatal(_("cannot include `%s' and use it a s a program file"), src);
/* no need to scan for further matches, since /* no need to scan for further matches, since
* they must be of homogeneous type */ * they must be of homogeneous type */
break; break;
} }
} }
} }
s = do_add_srcfile(stype, src, path, thisfile); s = do_add_srcfile(stype, src, path, thisfile);
s->sbuf = sbuf; s->sbuf = sbuf;
s->mtime = sbuf.st_mtime; s->mtime = sbuf.st_mtime;
skipping to change at line 5382 skipping to change at line 5475
if (do_lint) if (do_lint)
lintwarn_ln(file->source_line, _("empty filename after @i nclude")); lintwarn_ln(file->source_line, _("empty filename after @i nclude"));
return true; return true;
} }
s = add_srcfile(SRC_INC, src, sourcefile, &already_included, &errcode); s = add_srcfile(SRC_INC, src, sourcefile, &already_included, &errcode);
if (s == NULL) { if (s == NULL) {
if (already_included) if (already_included)
return true; return true;
error_ln(file->source_line, error_ln(file->source_line,
_("can't open source file `%s' for reading (%s)"), _("cannot open source file `%s' for reading: %s"),
src, errcode ? strerror(errcode) : _("reason unknown")); src, errcode ? strerror(errcode) : _("reason unknown"));
return false; return false;
} }
/* save scanner state for the current sourcefile */ /* save scanner state for the current sourcefile */
sourcefile->srclines = sourceline; sourcefile->srclines = sourceline;
sourcefile->lexptr = lexptr; sourcefile->lexptr = lexptr;
sourcefile->lexend = lexend; sourcefile->lexend = lexend;
sourcefile->lexptr_begin = lexptr_begin; sourcefile->lexptr_begin = lexptr_begin;
sourcefile->lexeme = lexeme; sourcefile->lexeme = lexeme;
skipping to change at line 5441 skipping to change at line 5534
if (do_pretty_print && ! do_profile) { if (do_pretty_print && ! do_profile) {
// create a fake one, don't try to open the file // create a fake one, don't try to open the file
s = do_add_srcfile(SRC_EXTLIB, src, src, sourcefile); s = do_add_srcfile(SRC_EXTLIB, src, src, sourcefile);
} else { } else {
s = add_srcfile(SRC_EXTLIB, src, sourcefile, &already_included, & errcode); s = add_srcfile(SRC_EXTLIB, src, sourcefile, &already_included, & errcode);
if (s == NULL) { if (s == NULL) {
if (already_included) if (already_included)
return true; return true;
error_ln(file->source_line, error_ln(file->source_line,
_("can't open shared library `%s' for reading (%s )"), _("cannot open shared library `%s' for reading: % s"),
src, errcode ? strerror(errcode) : _("reason unkn own")); src, errcode ? strerror(errcode) : _("reason unkn own"));
return false; return false;
} }
load_ext(s->fullpath); load_ext(s->fullpath);
} }
*srcfile_p = (void *) s; *srcfile_p = (void *) s;
return true; return true;
} }
skipping to change at line 5619 skipping to change at line 5712
source = sourcefile->src; source = sourcefile->src;
if (source == NULL) if (source == NULL)
return NULL; return NULL;
fd = srcopen(sourcefile); fd = srcopen(sourcefile);
if (fd <= INVALID_HANDLE) { if (fd <= INVALID_HANDLE) {
char *in; char *in;
/* suppress file name and line no. in error mesg */ /* suppress file name and line no. in error mesg */
in = source; in = source;
source = NULL; source = NULL;
error(_("can't open source file `%s' for reading (%s)"), error(_("cannot open source file `%s' for reading: %s"),
in, strerror(errno)); in, strerror(errno));
errcount++; errcount++;
lexeof = true; lexeof = true;
return sourcefile->src; return sourcefile->src;
} }
sourcefile->fd = fd; sourcefile->fd = fd;
l = optimal_bufsize(fd, &sbuf); l = optimal_bufsize(fd, &sbuf);
/* /*
* Make sure that something silly like * Make sure that something silly like
* AWKBUFSIZE=8 make check * AWKBUFSIZE=8 make check
* works ok. * works ok.
*/ */
#define A_DECENT_BUFFER_SIZE 128 #define A_DECENT_BUFFER_SIZE 128
if (l < A_DECENT_BUFFER_SIZE) if (l < A_DECENT_BUFFER_SIZE)
l = A_DECENT_BUFFER_SIZE; l = A_DECENT_BUFFER_SIZE;
#undef A_DECENT_BUFFER_SIZE #undef A_DECENT_BUFFER_SIZE
sourcefile->bufsize = l; sourcefile->bufsize = l;
newfile = true; newfile = true;
emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_bu f"); emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_bu f");
memset(sourcefile->buf, '\0', sourcefile->bufsize); // keep v algrind happy
lexptr = lexptr_begin = lexeme = sourcefile->buf; lexptr = lexptr_begin = lexeme = sourcefile->buf;
savelen = 0; savelen = 0;
sourceline = 1; sourceline = 1;
thisline = NULL; thisline = NULL;
} else { } else {
/* /*
* Here, we retain the current source line in the beginning of th e buffer. * Here, we retain the current source line in the beginning of th e buffer.
*/ */
int offset; int offset;
for (scan = lexeme; scan > lexptr_begin; scan--) for (scan = lexeme; scan > lexptr_begin; scan--)
skipping to change at line 5686 skipping to change at line 5780
lexeme = lexptr - offset; lexeme = lexptr - offset;
} else { } else {
savelen = 0; savelen = 0;
lexptr = lexeme = lexptr_begin; lexptr = lexeme = lexptr_begin;
thisline = NULL; thisline = NULL;
} }
} }
n = (*readfunc)(sourcefile->fd, lexptr, sourcefile->bufsize - savelen); n = (*readfunc)(sourcefile->fd, lexptr, sourcefile->bufsize - savelen);
if (n == -1) { if (n == -1) {
error(_("can't read sourcefile `%s' (%s)"), error(_("cannot read source file `%s': %s"),
source, strerror(errno)); source, strerror(errno));
errcount++; errcount++;
lexeof = true; lexeof = true;
} else { } else {
lexend = lexptr + n; lexend = lexptr + n;
if (n == 0) { if (n == 0) {
static bool warned = false; static bool warned = false;
if (do_lint && newfile && ! warned) { if (do_lint && newfile && ! warned) {
warned = true; warned = true;
sourceline = 0; sourceline = 0;
skipping to change at line 5756 skipping to change at line 5850
case '\f': case '\f':
case '\n': case '\n':
case '\r': case '\r':
case '\t': case '\t':
return; return;
default: default:
break; break;
} }
if (iscntrl(c) && ! isspace(c)) if (iscntrl(c) && ! isspace(c))
fatal(_("PEBKAC error: invalid character '\\%03o' in source code" // This is a PEBKAC error, but we'll be nice and not say so.
), c & 0xFF); fatal(_("error: invalid character '\\%03o' in source code"), c &
0xFF);
} }
/* nextc --- get the next input character */ /* nextc --- get the next input character */
// For namespaces, -e chunks must be syntactic units. // For namespaces, -e chunks must be syntactic units.
#define NO_CONTINUE_SOURCE_STRINGS 1 #define NO_CONTINUE_SOURCE_STRINGS 1
static int static int
nextc(bool check_for_bad) nextc(bool check_for_bad)
{ {
skipping to change at line 6311 skipping to change at line 6406
case ';': case ';':
case ',': case ',':
case '[': case '[':
return lasttok = c; return lasttok = c;
case ']': case ']':
c = nextc(true); c = nextc(true);
pushback(); pushback();
if (c == '[') { if (c == '[') {
if (do_traditional) if (do_traditional)
fatal(_("multidimensional arrays are a gawk exten sion")); fatal(_("multidimensional arrays are a gawk exten sion"));
if (do_lint) if (do_lint_extensions)
lintwarn(_("multidimensional arrays are a gawk ex tension")); lintwarn(_("multidimensional arrays are a gawk ex tension"));
yylval = GET_INSTRUCTION(Op_sub_array); yylval = GET_INSTRUCTION(Op_sub_array);
lasttok = ']'; lasttok = ']';
} else { } else {
yylval = GET_INSTRUCTION(Op_subscript); yylval = GET_INSTRUCTION(Op_subscript);
lasttok = SUBSCRIPT; /* end of subscripts */ lasttok = SUBSCRIPT; /* end of subscripts */
} }
return ']'; return ']';
case '*': case '*':
skipping to change at line 6337 skipping to change at line 6432
yylval = GET_INSTRUCTION(Op_times); yylval = GET_INSTRUCTION(Op_times);
return lasttok = '*'; return lasttok = '*';
} else if (c == '*') { } else if (c == '*') {
/* make ** and **= aliases for ^ and ^= */ /* make ** and **= aliases for ^ and ^= */
static bool did_warn_op = false, did_warn_assgn = false; static bool did_warn_op = false, did_warn_assgn = false;
if (nextc(true) == '=') { if (nextc(true) == '=') {
if (! did_warn_assgn) { if (! did_warn_assgn) {
did_warn_assgn = true; did_warn_assgn = true;
if (do_lint) if (do_lint)
lintwarn(_("POSIX does not allow operator `**='")); lintwarn(_("POSIX does not allow operator `%s'"), "**=");
if (do_lint_old) if (do_lint_old)
warning(_("old awk does not suppo rt operator `**='")); lintwarn(_("operator `%s' is not supported in old awk"), "**=");
} }
yylval = GET_INSTRUCTION(Op_assign_exp); yylval = GET_INSTRUCTION(Op_assign_exp);
return ASSIGNOP; return ASSIGNOP;
} else { } else {
pushback(); pushback();
if (! did_warn_op) { if (! did_warn_op) {
did_warn_op = true; did_warn_op = true;
if (do_lint) if (do_lint)
lintwarn(_("POSIX does not allow operator `**'")); lintwarn(_("POSIX does not allow operator `%s'"), "**");
if (do_lint_old) if (do_lint_old)
warning(_("old awk does not suppo rt operator `**'")); lintwarn(_("operator `%s' is not supported in old awk"), "**");
} }
yylval = GET_INSTRUCTION(Op_exp); yylval = GET_INSTRUCTION(Op_exp);
return lasttok = '^'; return lasttok = '^';
} }
} }
pushback(); pushback();
yylval = GET_INSTRUCTION(Op_times); yylval = GET_INSTRUCTION(Op_times);
return lasttok = '*'; return lasttok = '*';
case '/': case '/':
skipping to change at line 6385 skipping to change at line 6480
yylval = GET_INSTRUCTION(Op_mod); yylval = GET_INSTRUCTION(Op_mod);
return lasttok = '%'; return lasttok = '%';
case '^': case '^':
{ {
static bool did_warn_op = false, did_warn_assgn = false; static bool did_warn_op = false, did_warn_assgn = false;
if (nextc(true) == '=') { if (nextc(true) == '=') {
if (do_lint_old && ! did_warn_assgn) { if (do_lint_old && ! did_warn_assgn) {
did_warn_assgn = true; did_warn_assgn = true;
warning(_("operator `^=' is not supported in old awk")); lintwarn(_("operator `%s' is not supported in old awk"), "^=");
} }
yylval = GET_INSTRUCTION(Op_assign_exp); yylval = GET_INSTRUCTION(Op_assign_exp);
return lasttok = ASSIGNOP; return lasttok = ASSIGNOP;
} }
pushback(); pushback();
if (do_lint_old && ! did_warn_op) { if (do_lint_old && ! did_warn_op) {
did_warn_op = true; did_warn_op = true;
warning(_("operator `^' is not supported in old awk")); lintwarn(_("operator `%s' is not supported in old awk"), "^");
} }
yylval = GET_INSTRUCTION(Op_exp); yylval = GET_INSTRUCTION(Op_exp);
return lasttok = '^'; return lasttok = '^';
} }
case '+': case '+':
if ((c = nextc(true)) == '=') { if ((c = nextc(true)) == '=') {
yylval = GET_INSTRUCTION(Op_assign_plus); yylval = GET_INSTRUCTION(Op_assign_plus);
return lasttok = ASSIGNOP; return lasttok = ASSIGNOP;
} }
skipping to change at line 6848 skipping to change at line 6943
} }
if ((tokentab[mid].flags & NOT_POSIX) != 0 && (warntab[mi d] & NOT_POSIX) == 0) { if ((tokentab[mid].flags & NOT_POSIX) != 0 && (warntab[mi d] & NOT_POSIX) == 0) {
lintwarn(_("POSIX does not allow `%s'"), lintwarn(_("POSIX does not allow `%s'"),
tokentab[mid].operator); tokentab[mid].operator);
warntab[mid] |= NOT_POSIX; warntab[mid] |= NOT_POSIX;
} }
} }
if (do_lint_old && (tokentab[mid].flags & NOT_OLD) != 0 if (do_lint_old && (tokentab[mid].flags & NOT_OLD) != 0
&& (warntab[mid] & NOT_OLD) == 0 && (warntab[mid] & NOT_OLD) == 0
) { ) {
warning(_("`%s' is not supported in old awk"), lintwarn(_("`%s' is not supported in old awk"),
tokentab[mid].operator); tokentab[mid].operator);
warntab[mid] |= NOT_OLD; warntab[mid] |= NOT_OLD;
} }
if ((tokentab[mid].flags & BREAK) != 0) if ((tokentab[mid].flags & BREAK) != 0)
break_allowed++; break_allowed++;
if ((tokentab[mid].flags & CONTINUE) != 0) if ((tokentab[mid].flags & CONTINUE) != 0)
continue_allowed++; continue_allowed++;
switch (class) { switch (class) {
skipping to change at line 7050 skipping to change at line 7145
expr = list_create(instruction(Op_push_i)); expr = list_create(instruction(Op_push_i));
expr->nexti->memory = set_profile_text(make_numbe r(0.0), "0", 1); expr->nexti->memory = set_profile_text(make_numbe r(0.0), "0", 1);
(void) mk_expression_list(subn, (void) mk_expression_list(subn,
list_append(expr, instruction(Op_ field_spec))); list_append(expr, instruction(Op_ field_spec)));
} }
arg = arg->lasti->nexti; /* third arg list */ arg = arg->lasti->nexti; /* third arg list */
ip = arg->lasti; ip = arg->lasti;
if (ip->opcode == Op_push_i) { if (ip->opcode == Op_push_i) {
if (do_lint) if (do_lint)
lintwarn(_("%s: string literal as last ar g of substitute has no effect"), lintwarn(_("%s: string literal as last ar gument of substitute has no effect"),
operator); operator);
r->sub_flags |= LITERAL; r->sub_flags |= LITERAL;
} else { } else {
if (make_assignable(ip) == NULL) if (make_assignable(ip) == NULL)
yyerror(_("%s third parameter is not a ch angeable object"), yyerror(_("%s third parameter is not a ch angeable object"),
operator); operator);
else else
ip->do_reference = true; ip->do_reference = true;
} }
skipping to change at line 7365 skipping to change at line 7460
dump_vars(const char *fname) dump_vars(const char *fname)
{ {
FILE *fp; FILE *fp;
NODE **vars; NODE **vars;
if (fname == NULL) if (fname == NULL)
fp = stderr; fp = stderr;
else if (strcmp(fname, "-") == 0) else if (strcmp(fname, "-") == 0)
fp = stdout; fp = stdout;
else if ((fp = fopen(fname, "w")) == NULL) { else if ((fp = fopen(fname, "w")) == NULL) {
warning(_("could not open `%s' for writing (%s)"), fname, strerro r(errno)); warning(_("could not open `%s' for writing: %s"), fname, strerror (errno));
warning(_("sending variable list to standard error")); warning(_("sending variable list to standard error"));
fp = stderr; fp = stderr;
} }
vars = variable_list(); vars = variable_list();
print_vars(vars, fprintf, fp); print_vars(vars, fprintf, fp);
efree(vars); efree(vars);
if (fp != stdout && fp != stderr && fclose(fp) != 0) if (fp != stdout && fp != stderr && fclose(fp) != 0)
warning(_("%s: close failed (%s)"), fname, strerror(errno)); warning(_("%s: close failed: %s"), fname, strerror(errno));
} }
/* dump_funcs --- print all functions */ /* dump_funcs --- print all functions */
void void
dump_funcs() dump_funcs()
{ {
NODE **funcs; NODE **funcs;
funcs = function_list(true); funcs = function_list(true);
(void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, (voi d *) 0); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, (voi d *) 0);
skipping to change at line 7532 skipping to change at line 7627
emalloc(pnames, char **, pcount * sizeof(char *), "check_params"); emalloc(pnames, char **, pcount * sizeof(char *), "check_params");
for (i = 0, p = list->nexti; p != NULL; i++, p = np) { for (i = 0, p = list->nexti; p != NULL; i++, p = np) {
np = p->nexti; np = p->nexti;
name = p->lextok; name = p->lextok;
p->lextok = NULL; p->lextok = NULL;
if (strcmp(name, fname) == 0) { if (strcmp(name, fname) == 0) {
/* check for function foo(foo) { ... }. bleah. */ /* check for function foo(foo) { ... }. bleah. */
error_ln(p->source_line, error_ln(p->source_line,
_("function `%s': can't use function name as para meter name"), fname); _("function `%s': cannot use function name as par ameter name"), fname);
} else if (is_std_var(name)) { } else if (is_std_var(name)) {
error_ln(p->source_line, error_ln(p->source_line,
_("function `%s': can't use special variable `%s' as a function parameter"), _("function `%s': cannot use special variable `%s ' as a function parameter"),
fname, name); fname, name);
} else if (strchr(name, ':') != NULL) } else if (strchr(name, ':') != NULL)
error_ln(p->source_line, error_ln(p->source_line,
_("function `%s': parameter `%s' cannot contain a namespace"), _("function `%s': parameter `%s' cannot contain a namespace"),
fname, name); fname, name);
/* check for duplicate parameters */ /* check for duplicate parameters */
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (strcmp(name, pnames[j]) == 0) { if (strcmp(name, pnames[j]) == 0) {
error_ln(p->source_line, error_ln(p->source_line,
skipping to change at line 7714 skipping to change at line 7809
memset(n, 0, sizeof(NODE)); memset(n, 0, sizeof(NODE));
n->type = type; n->type = type;
n->re_cnt = 1; n->re_cnt = 1;
if (type == Node_regex) { if (type == Node_regex) {
n->re_reg[0] = make_regexp(exp->stptr, exp->stlen, false, true, f alse); n->re_reg[0] = make_regexp(exp->stptr, exp->stlen, false, true, f alse);
if (n->re_reg[0] == NULL) { if (n->re_reg[0] == NULL) {
freenode(n); freenode(n);
return NULL; return NULL;
} }
n->re_reg[1] = make_regexp(exp->stptr, exp->stlen, true, true, fa
lse);
if (n->re_reg[1] == NULL) {
refree(n->re_reg[0]);
freenode(n);
return NULL;
}
n->re_exp = exp; n->re_exp = exp;
n->re_flags = CONSTANT; n->re_flags = CONSTANT;
} }
return n; return n;
} }
/* mk_rexp --- make a regular expression constant */ /* mk_rexp --- make a regular expression constant */
static NODE * static NODE *
mk_rexp(INSTRUCTION *list) mk_rexp(INSTRUCTION *list)
 End of changes. 420 change blocks. 
695 lines changed or deleted 783 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)