aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog64
-rw-r--r--NEWS11
-rw-r--r--a.awk7
-rw-r--r--awk.h8
-rw-r--r--awkgram.c2135
-rw-r--r--awkgram.y125
-rw-r--r--builtin.c56
-rw-r--r--doc/ChangeLog10
-rw-r--r--doc/gawk.info1235
-rw-r--r--doc/gawk.texi129
-rw-r--r--doc/gawktexi.in129
-rw-r--r--eval.c6
-rw-r--r--hardregex-semantics.awk296
-rw-r--r--hardregex.txt24
-rw-r--r--profile.c38
-rw-r--r--re.c15
-rw-r--r--test/ChangeLog1
-rw-r--r--test/id.ok1
-rw-r--r--x.awk9
-rw-r--r--y.awk1
-rw-r--r--z.awk1
-rw-r--r--z2.awk8
-rw-r--r--z3.awk19
23 files changed, 2769 insertions, 1559 deletions
diff --git a/ChangeLog b/ChangeLog
index e2d8aaf5..055a0bd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,11 @@
in PROCINFO["argv"][0..argc-1].
(load_procinfo): Call load_procinfo_argv.
+2015-05-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h, awkgram.y, builtin.c, eval.c profile.c, re.c:
+ Change Node_hardregex to Node_typedregex everywhere.
+
2015-05-05 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y (yylex): Yet Another Fix for parsing bracket
@@ -19,6 +24,14 @@
* config.guess, config.sub: Get latest versions.
+ Make profiling for hard regexes work.
+
+ * profile.c (pp_string_or_hard_regex): Renamed from pp_string.
+ Add bool param for hard regex and add @ if so.
+ (pp_string): New function, calls pp_string_or_hard_regex.
+ (pp_hard_regex): New function, calls pp_string_or_hard_regex.
+ (pprint): Adjust to print a hard regex correctly.
+
2015-05-01 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y: Make sure values are not null in param list.
@@ -43,6 +56,11 @@
2015-04-28 Arnold D. Robbins <arnold@skeeve.com>
+ * builtin.c (isarray): Add lint warning that isarray()
+ is deprecated.
+
+2015-04-28 Arnold D. Robbins <arnold@skeeve.com>
+
* awkgram.y (yylex): Rework the bracket handling from zero.
Thanks to Michal Jaegermann for yet another test case.
@@ -129,6 +147,11 @@
* builtin.c (do_sub): Improve some variable names for readability
and add / expand some comments.
+ Unrelated:
+
+ * builtin.c (call_sub, call_match, call_split_func): Allow for
+ regex to be Node_hardregex.
+
2015-04-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
Arnold D. Robbins <arnold@skeeve.com>
@@ -136,6 +159,7 @@
to malloc, test for final amount after all matches done and
need to copy in the final part of the original string.
+
2015-04-13 Arnold D. Robbins <arnold@skeeve.com>
* regcomp.c (analyze): Prevent malloc(0).
@@ -207,6 +231,14 @@
Thanks to Andrew Schorr for finding the problem and supplying
initial code; I did it slightly differently.
+2015-04-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (force_string): If hard_regex, return string text of the regex.
+ (force_string, force_number): If hard_regex, return Nnull_string.
+ * awkgram.y: Fix ~ and !~ with @/.../.
+ * eval.c (setup_frame): Handle a hard regex.
+ * re.c (avoid_dfa): Ditto.
+
2015-04-02 Andrew J. Schorr <aschorr@telemetry-investments.com>
* NEWS: Rename div to intdiv.
@@ -271,6 +303,24 @@
* interpret.h (r_interpret): If calling do_sub, do it through
call_sub_func().
+2015-03-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * re.c (re_update): Handle hard regex - for sub/gsub/gensub.
+ * awkgram.y (grammar): Add support for hard_regex with ~ and !~;
+ allowed only on the right hand side.
+ (mk_rexp): Handle a hard regex.
+
+2015-03-18 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_typeof): Be smarter about checking for uninitialized
+ values; can now detect and return "untyped" for such values.
+ * awkgram.y (yylex): Collect @/.../ entirely in the lexer and return
+ a new terminal (HARD_REGEX).
+ (regexp): Reverted to just a regular awk regexp constant.
+ (hard_regexp): New nonterminal, can be used only in direct
+ assignment and as an argument in function call. New set of nonterminals
+ for function call expression lists. More work still to do.
+
2015-03-18 Arnold D. Robbins <arnold@skeeve.com>
* config.guess, config.sub: Updated, from libtool 2.4.6.
@@ -312,6 +362,20 @@
a long-standing problem where `-lm' was used twice in the final
compilation line.
+2015-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ Start on making regexp a real type.
+
+ * awk.h (Node_hardregex): New node type.
+ (do_typeof): Add declaration.
+ * awkgram.y: Make @/.../ a hard regex.
+ (tokentab): New entry for typeof() function.
+ (snode): Try to handle typeof().
+ (make_regnode): Handle Node_hardregex.
+ * builtin.c (do_typeof): New function.
+ * eval.c (nodetypes): Add Node_hardregex.
+ * re.c (re_update): Check for hardregex too in assert.
+
2015-02-24 Arnold D. Robbins <arnold@skeeve.com>
* POSIX.STD: Update copyright year.
diff --git a/NEWS b/NEWS
index 0b4b34be..da767867 100644
--- a/NEWS
+++ b/NEWS
@@ -48,9 +48,18 @@ Changes from 4.1.x to 4.2.0
11. Gawk now supports retryable I/O via PROCINFO[input-file, "RETRY"]; see
the manual.
-12. The API minor version has been increased to two; the get_file()
+12. The API minor version has been increased to 2; the get_file()
API provides access to open redirections. Also see the manual.
+13. Gawk now supports strongly typed regexp constants. Such constants
+ look like @/.../. You can assign them to variables, pass them to
+ functions, use them in ~, !~ and the case part of a switch statement.
+ More details are provided in the manual.
+
+14. The new typeof() function can be used to indicate if a variable or
+ array element is an array, regexp, string or number. The isarray()
+ function is deprecated in favor of typeof().
+
Changes from 4.1.2 to 4.1.3
---------------------------
diff --git a/a.awk b/a.awk
new file mode 100644
index 00000000..daed9d9f
--- /dev/null
+++ b/a.awk
@@ -0,0 +1,7 @@
+BEGIN {
+ f = "foo"
+ p = "o+"
+ fun = "match"
+ @fun(f, p)
+ print RSTART, RLENGTH
+}
diff --git a/awk.h b/awk.h
index b81a99b9..5acd33d8 100644
--- a/awk.h
+++ b/awk.h
@@ -277,6 +277,7 @@ typedef enum nodevals {
Node_val, /* node is a value - type in flags */
Node_regex, /* a regexp, text, compiled, flags, etc */
Node_dynregex, /* a dynamic regexp */
+ Node_typedregex, /* like Node_regex, but is a real type */
/* symbol table values */
Node_var, /* scalar variable, lnode is value */
@@ -1384,6 +1385,7 @@ extern NODE *do_dcgettext(int nargs);
extern NODE *do_dcngettext(int nargs);
extern NODE *do_bindtextdomain(int nargs);
extern NODE *do_intdiv(int nargs);
+extern NODE *do_typeof(int nargs);
extern int strncasecmpmbs(const unsigned char *,
const unsigned char *, size_t);
/* eval.c */
@@ -1763,6 +1765,9 @@ dupnode(NODE *n)
static inline NODE *
force_string(NODE *s)
{
+ if (s->type == Node_typedregex)
+ return s->re_exp;
+
if ((s->flags & STRCUR) != 0
&& (s->stfmt == -1 || s->stfmt == CONVFMTidx)
)
@@ -1785,6 +1790,9 @@ unref(NODE *r)
static inline NODE *
force_number(NODE *n)
{
+ if (n->type == Node_typedregex)
+ return Nnull_string;
+
return (n->flags & NUMCUR) != 0 ? n : str2number(n);
}
diff --git a/awkgram.c b/awkgram.c
index c7fb30a8..e9577dd6 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.0.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -245,51 +245,52 @@ extern int yydebug;
FILENAME = 261,
YNUMBER = 262,
YSTRING = 263,
- RELOP = 264,
- IO_OUT = 265,
- IO_IN = 266,
- ASSIGNOP = 267,
- ASSIGN = 268,
- MATCHOP = 269,
- CONCAT_OP = 270,
- SUBSCRIPT = 271,
- LEX_BEGIN = 272,
- LEX_END = 273,
- LEX_IF = 274,
- LEX_ELSE = 275,
- LEX_RETURN = 276,
- LEX_DELETE = 277,
- LEX_SWITCH = 278,
- LEX_CASE = 279,
- LEX_DEFAULT = 280,
- LEX_WHILE = 281,
- LEX_DO = 282,
- LEX_FOR = 283,
- LEX_BREAK = 284,
- LEX_CONTINUE = 285,
- LEX_PRINT = 286,
- LEX_PRINTF = 287,
- LEX_NEXT = 288,
- LEX_EXIT = 289,
- LEX_FUNCTION = 290,
- LEX_BEGINFILE = 291,
- LEX_ENDFILE = 292,
- LEX_GETLINE = 293,
- LEX_NEXTFILE = 294,
- LEX_IN = 295,
- LEX_AND = 296,
- LEX_OR = 297,
- INCREMENT = 298,
- DECREMENT = 299,
- LEX_BUILTIN = 300,
- LEX_LENGTH = 301,
- LEX_EOF = 302,
- LEX_INCLUDE = 303,
- LEX_EVAL = 304,
- LEX_LOAD = 305,
- NEWLINE = 306,
- SLASH_BEFORE_EQUAL = 307,
- UNARY = 308
+ HARD_REGEXP = 264,
+ RELOP = 265,
+ IO_OUT = 266,
+ IO_IN = 267,
+ ASSIGNOP = 268,
+ ASSIGN = 269,
+ MATCHOP = 270,
+ CONCAT_OP = 271,
+ SUBSCRIPT = 272,
+ LEX_BEGIN = 273,
+ LEX_END = 274,
+ LEX_IF = 275,
+ LEX_ELSE = 276,
+ LEX_RETURN = 277,
+ LEX_DELETE = 278,
+ LEX_SWITCH = 279,
+ LEX_CASE = 280,
+ LEX_DEFAULT = 281,
+ LEX_WHILE = 282,
+ LEX_DO = 283,
+ LEX_FOR = 284,
+ LEX_BREAK = 285,
+ LEX_CONTINUE = 286,
+ LEX_PRINT = 287,
+ LEX_PRINTF = 288,
+ LEX_NEXT = 289,
+ LEX_EXIT = 290,
+ LEX_FUNCTION = 291,
+ LEX_BEGINFILE = 292,
+ LEX_ENDFILE = 293,
+ LEX_GETLINE = 294,
+ LEX_NEXTFILE = 295,
+ LEX_IN = 296,
+ LEX_AND = 297,
+ LEX_OR = 298,
+ INCREMENT = 299,
+ DECREMENT = 300,
+ LEX_BUILTIN = 301,
+ LEX_LENGTH = 302,
+ LEX_EOF = 303,
+ LEX_INCLUDE = 304,
+ LEX_EVAL = 305,
+ LEX_LOAD = 306,
+ NEWLINE = 307,
+ SLASH_BEFORE_EQUAL = 308,
+ UNARY = 309
};
#endif
/* Tokens. */
@@ -299,51 +300,52 @@ extern int yydebug;
#define FILENAME 261
#define YNUMBER 262
#define YSTRING 263
-#define RELOP 264
-#define IO_OUT 265
-#define IO_IN 266
-#define ASSIGNOP 267
-#define ASSIGN 268
-#define MATCHOP 269
-#define CONCAT_OP 270
-#define SUBSCRIPT 271
-#define LEX_BEGIN 272
-#define LEX_END 273
-#define LEX_IF 274
-#define LEX_ELSE 275
-#define LEX_RETURN 276
-#define LEX_DELETE 277
-#define LEX_SWITCH 278
-#define LEX_CASE 279
-#define LEX_DEFAULT 280
-#define LEX_WHILE 281
-#define LEX_DO 282
-#define LEX_FOR 283
-#define LEX_BREAK 284
-#define LEX_CONTINUE 285
-#define LEX_PRINT 286
-#define LEX_PRINTF 287
-#define LEX_NEXT 288
-#define LEX_EXIT 289
-#define LEX_FUNCTION 290
-#define LEX_BEGINFILE 291
-#define LEX_ENDFILE 292
-#define LEX_GETLINE 293
-#define LEX_NEXTFILE 294
-#define LEX_IN 295
-#define LEX_AND 296
-#define LEX_OR 297
-#define INCREMENT 298
-#define DECREMENT 299
-#define LEX_BUILTIN 300
-#define LEX_LENGTH 301
-#define LEX_EOF 302
-#define LEX_INCLUDE 303
-#define LEX_EVAL 304
-#define LEX_LOAD 305
-#define NEWLINE 306
-#define SLASH_BEFORE_EQUAL 307
-#define UNARY 308
+#define HARD_REGEXP 264
+#define RELOP 265
+#define IO_OUT 266
+#define IO_IN 267
+#define ASSIGNOP 268
+#define ASSIGN 269
+#define MATCHOP 270
+#define CONCAT_OP 271
+#define SUBSCRIPT 272
+#define LEX_BEGIN 273
+#define LEX_END 274
+#define LEX_IF 275
+#define LEX_ELSE 276
+#define LEX_RETURN 277
+#define LEX_DELETE 278
+#define LEX_SWITCH 279
+#define LEX_CASE 280
+#define LEX_DEFAULT 281
+#define LEX_WHILE 282
+#define LEX_DO 283
+#define LEX_FOR 284
+#define LEX_BREAK 285
+#define LEX_CONTINUE 286
+#define LEX_PRINT 287
+#define LEX_PRINTF 288
+#define LEX_NEXT 289
+#define LEX_EXIT 290
+#define LEX_FUNCTION 291
+#define LEX_BEGINFILE 292
+#define LEX_ENDFILE 293
+#define LEX_GETLINE 294
+#define LEX_NEXTFILE 295
+#define LEX_IN 296
+#define LEX_AND 297
+#define LEX_OR 298
+#define INCREMENT 299
+#define DECREMENT 300
+#define LEX_BUILTIN 301
+#define LEX_LENGTH 302
+#define LEX_EOF 303
+#define LEX_INCLUDE 304
+#define LEX_EVAL 305
+#define LEX_LOAD 306
+#define NEWLINE 307
+#define SLASH_BEFORE_EQUAL 308
+#define UNARY 309
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
@@ -361,7 +363,7 @@ int yyparse (void);
/* Copy the second part of user declarations. */
-#line 365 "awkgram.c" /* yacc.c:358 */
+#line 367 "awkgram.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -603,21 +605,21 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1098
+#define YYLAST 1236
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 75
+#define YYNTOKENS 76
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 66
+#define YYNNTS 70
/* YYNRULES -- Number of rules. */
-#define YYNRULES 189
+#define YYNRULES 203
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 336
+#define YYNSTATES 350
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 308
+#define YYMAXUTOK 309
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -629,16 +631,16 @@ static const yytype_uint8 yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 63, 2, 2, 66, 62, 2, 2,
- 67, 68, 60, 58, 55, 59, 2, 61, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 54, 74,
- 56, 2, 57, 53, 69, 2, 2, 2, 2, 2,
+ 2, 2, 2, 64, 2, 2, 67, 63, 2, 2,
+ 68, 69, 61, 59, 56, 60, 2, 62, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 55, 75,
+ 57, 2, 58, 54, 70, 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, 70, 2, 71, 65, 2, 2, 2, 2, 2,
+ 2, 71, 2, 72, 66, 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, 72, 2, 73, 2, 2, 2, 2,
+ 2, 2, 2, 73, 2, 74, 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,
@@ -656,7 +658,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 64
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 65
};
#if YYDEBUG
@@ -666,22 +668,24 @@ static const yytype_uint16 yyrline[] =
0, 210, 210, 212, 217, 218, 222, 234, 239, 250,
257, 263, 272, 280, 282, 287, 295, 297, 303, 311,
321, 351, 365, 379, 387, 398, 410, 412, 414, 420,
- 428, 429, 433, 433, 469, 468, 502, 504, 509, 515,
- 543, 548, 549, 553, 555, 557, 564, 654, 696, 738,
- 851, 858, 865, 875, 884, 893, 902, 913, 929, 928,
- 952, 964, 964, 1062, 1062, 1095, 1125, 1131, 1132, 1138,
- 1139, 1146, 1151, 1163, 1177, 1179, 1187, 1192, 1194, 1202,
- 1204, 1213, 1214, 1222, 1227, 1227, 1238, 1242, 1250, 1251,
- 1254, 1256, 1261, 1262, 1271, 1272, 1277, 1282, 1291, 1293,
- 1295, 1302, 1303, 1309, 1310, 1315, 1317, 1322, 1324, 1332,
- 1337, 1346, 1353, 1355, 1357, 1373, 1383, 1390, 1392, 1397,
- 1399, 1401, 1409, 1411, 1416, 1418, 1423, 1425, 1427, 1477,
- 1479, 1481, 1483, 1485, 1487, 1489, 1491, 1505, 1510, 1515,
- 1540, 1546, 1548, 1550, 1552, 1554, 1556, 1561, 1565, 1597,
- 1599, 1605, 1611, 1624, 1625, 1626, 1631, 1636, 1640, 1644,
- 1659, 1672, 1677, 1714, 1743, 1744, 1750, 1751, 1756, 1758,
- 1765, 1782, 1799, 1801, 1808, 1813, 1821, 1831, 1843, 1852,
- 1856, 1860, 1864, 1868, 1872, 1875, 1877, 1881, 1885, 1889
+ 428, 429, 433, 433, 469, 468, 502, 524, 526, 531,
+ 537, 565, 570, 571, 575, 577, 579, 586, 676, 718,
+ 760, 873, 880, 887, 897, 906, 915, 924, 935, 951,
+ 950, 974, 986, 986, 1084, 1084, 1117, 1147, 1153, 1154,
+ 1160, 1161, 1168, 1173, 1185, 1199, 1201, 1209, 1214, 1216,
+ 1224, 1233, 1235, 1244, 1245, 1253, 1258, 1258, 1269, 1273,
+ 1281, 1282, 1285, 1287, 1292, 1293, 1302, 1303, 1308, 1313,
+ 1322, 1324, 1326, 1333, 1334, 1340, 1341, 1346, 1348, 1353,
+ 1355, 1363, 1368, 1377, 1378, 1383, 1385, 1390, 1392, 1400,
+ 1405, 1413, 1414, 1419, 1426, 1430, 1432, 1434, 1447, 1464,
+ 1474, 1481, 1483, 1488, 1490, 1492, 1500, 1502, 1507, 1509,
+ 1514, 1516, 1518, 1568, 1570, 1572, 1574, 1576, 1578, 1580,
+ 1582, 1596, 1601, 1606, 1631, 1637, 1639, 1641, 1643, 1645,
+ 1647, 1652, 1656, 1688, 1690, 1696, 1702, 1715, 1716, 1717,
+ 1722, 1727, 1731, 1735, 1750, 1763, 1768, 1805, 1834, 1835,
+ 1841, 1842, 1847, 1849, 1856, 1873, 1890, 1892, 1899, 1904,
+ 1912, 1922, 1934, 1943, 1947, 1951, 1955, 1959, 1963, 1966,
+ 1968, 1972, 1976, 1980
};
#endif
@@ -691,30 +695,32 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "FUNC_CALL", "NAME", "REGEXP",
- "FILENAME", "YNUMBER", "YSTRING", "RELOP", "IO_OUT", "IO_IN", "ASSIGNOP",
- "ASSIGN", "MATCHOP", "CONCAT_OP", "SUBSCRIPT", "LEX_BEGIN", "LEX_END",
- "LEX_IF", "LEX_ELSE", "LEX_RETURN", "LEX_DELETE", "LEX_SWITCH",
- "LEX_CASE", "LEX_DEFAULT", "LEX_WHILE", "LEX_DO", "LEX_FOR", "LEX_BREAK",
- "LEX_CONTINUE", "LEX_PRINT", "LEX_PRINTF", "LEX_NEXT", "LEX_EXIT",
- "LEX_FUNCTION", "LEX_BEGINFILE", "LEX_ENDFILE", "LEX_GETLINE",
- "LEX_NEXTFILE", "LEX_IN", "LEX_AND", "LEX_OR", "INCREMENT", "DECREMENT",
- "LEX_BUILTIN", "LEX_LENGTH", "LEX_EOF", "LEX_INCLUDE", "LEX_EVAL",
- "LEX_LOAD", "NEWLINE", "SLASH_BEFORE_EQUAL", "'?'", "':'", "','", "'<'",
- "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "UNARY", "'^'", "'$'",
- "'('", "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept",
- "program", "rule", "source", "library", "pattern", "action", "func_name",
- "lex_builtin", "function_prologue", "$@1", "regexp", "$@2", "a_slash",
- "statements", "statement_term", "statement", "non_compound_stmt", "$@3",
- "simple_stmt", "$@4", "$@5", "opt_simple_stmt", "case_statements",
- "case_statement", "case_value", "print", "print_expression_list",
- "output_redir", "$@6", "if_statement", "nls", "opt_nls", "input_redir",
- "opt_param_list", "param_list", "opt_exp", "opt_expression_list",
- "expression_list", "exp", "assign_operator", "relop_or_less", "a_relop",
- "common_exp", "simp_exp", "simp_exp_nc", "non_post_simp_exp",
- "func_call", "direct_func_call", "opt_variable", "delete_subscript_list",
- "delete_subscript", "delete_exp_list", "bracketed_exp_list", "subscript",
- "subscript_list", "simple_variable", "variable", "opt_incdec", "l_brace",
- "r_brace", "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR
+ "FILENAME", "YNUMBER", "YSTRING", "HARD_REGEXP", "RELOP", "IO_OUT",
+ "IO_IN", "ASSIGNOP", "ASSIGN", "MATCHOP", "CONCAT_OP", "SUBSCRIPT",
+ "LEX_BEGIN", "LEX_END", "LEX_IF", "LEX_ELSE", "LEX_RETURN", "LEX_DELETE",
+ "LEX_SWITCH", "LEX_CASE", "LEX_DEFAULT", "LEX_WHILE", "LEX_DO",
+ "LEX_FOR", "LEX_BREAK", "LEX_CONTINUE", "LEX_PRINT", "LEX_PRINTF",
+ "LEX_NEXT", "LEX_EXIT", "LEX_FUNCTION", "LEX_BEGINFILE", "LEX_ENDFILE",
+ "LEX_GETLINE", "LEX_NEXTFILE", "LEX_IN", "LEX_AND", "LEX_OR",
+ "INCREMENT", "DECREMENT", "LEX_BUILTIN", "LEX_LENGTH", "LEX_EOF",
+ "LEX_INCLUDE", "LEX_EVAL", "LEX_LOAD", "NEWLINE", "SLASH_BEFORE_EQUAL",
+ "'?'", "':'", "','", "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'%'",
+ "'!'", "UNARY", "'^'", "'$'", "'('", "')'", "'@'", "'['", "']'", "'{'",
+ "'}'", "';'", "$accept", "program", "rule", "source", "library",
+ "pattern", "action", "func_name", "lex_builtin", "function_prologue",
+ "$@1", "regexp", "$@2", "hard_regexp", "a_slash", "statements",
+ "statement_term", "statement", "non_compound_stmt", "$@3", "simple_stmt",
+ "$@4", "$@5", "opt_simple_stmt", "case_statements", "case_statement",
+ "case_value", "print", "print_expression_list", "output_redir", "$@6",
+ "if_statement", "nls", "opt_nls", "input_redir", "opt_param_list",
+ "param_list", "opt_exp", "opt_expression_list", "expression_list",
+ "opt_fcall_expression_list", "fcall_expression_list", "fcall_exp", "exp",
+ "assign_operator", "relop_or_less", "a_relop", "common_exp", "simp_exp",
+ "simp_exp_nc", "non_post_simp_exp", "func_call", "direct_func_call",
+ "opt_variable", "delete_subscript_list", "delete_subscript",
+ "delete_exp_list", "bracketed_exp_list", "subscript", "subscript_list",
+ "simple_variable", "variable", "opt_incdec", "l_brace", "r_brace",
+ "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR
};
#endif
@@ -728,60 +734,61 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 63, 58, 44, 60, 62, 43, 45,
- 42, 47, 37, 33, 308, 94, 36, 40, 41, 64,
- 91, 93, 123, 125, 59
+ 305, 306, 307, 308, 63, 58, 44, 60, 62, 43,
+ 45, 42, 47, 37, 33, 309, 94, 36, 40, 41,
+ 64, 91, 93, 123, 125, 59
};
# endif
-#define YYPACT_NINF -271
+#define YYPACT_NINF -275
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-271)))
+ (!!((Yystate) == (-275)))
-#define YYTABLE_NINF -105
+#define YYTABLE_NINF -115
#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-105)))
+ (!!((Yytable_value) == (-115)))
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- -271, 359, -271, -271, -35, 3, -271, -271, -271, -271,
- 241, -271, -271, 42, 42, 42, 9, 50, -271, -271,
- -271, 1002, 1002, -271, 1002, 287, 804, 31, -271, 83,
- 5, -271, -271, 72, 219, 975, 426, 456, -271, -271,
- -271, -271, 162, 772, 804, -271, 14, -271, -271, -271,
- -271, -271, 77, 66, -271, 80, -271, -271, -271, 772,
- 772, 168, 93, -6, 93, 93, 1002, 10, -271, -271,
- 27, 333, 44, 124, -271, 114, -271, -271, -271, 72,
- -271, 114, -271, 173, -271, -271, 1002, 169, 1002, 1002,
- 1002, 114, -271, -271, -271, 1002, 142, 426, 1002, 1002,
- 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002,
- -271, -271, -271, -271, 172, 1002, 119, 158, 741, 15,
- -271, -271, -271, -271, 1002, -271, 119, 119, 333, -271,
- -271, -271, 1002, 114, -271, 151, 850, -271, -271, 4,
- -10, -271, 17, -10, 72, -271, 579, -271, -271, 62,
- -271, 249, 373, 1041, 1002, 104, 42, -13, -13, 93,
- 93, 93, 93, -13, -13, 93, 93, 93, 93, -271,
- 741, -271, -271, 25, 426, -271, -271, 741, -271, 169,
- -271, 741, -271, -271, -271, -271, -271, 125, -271, 23,
- 127, 133, 114, 134, -10, -10, -271, -271, -10, 1002,
- -10, 114, -271, -271, -10, -271, -271, 741, -271, 130,
- 114, 1002, 741, -271, -271, -271, 119, 61, -271, 1002,
- 1002, -271, 189, 1002, 1002, 693, 883, -271, -271, -271,
- -10, 741, -271, -271, -271, 625, 579, 114, -271, -271,
- 741, 114, -271, 35, 333, -10, 3, 148, 333, 333,
- 194, -19, -271, 130, -271, 804, 226, -271, -271, -271,
- -271, -271, -271, 114, -271, -271, 41, -271, -271, -271,
- 114, 114, 175, 169, 114, 27, -271, -271, 693, -271,
- -271, 5, 693, 1002, 119, 726, 151, 1002, 220, -271,
- -271, 333, 114, 155, 114, 975, 114, 126, 114, 693,
- 114, 929, 693, -271, 384, 192, -271, 176, -271, -271,
- 929, 119, -271, -271, -271, 243, 245, -271, 192, -271,
- 114, -271, 119, 114, -271, -271, 114, -271, 114, 693,
- -271, 431, 693, -271, 505, -271
+ -275, 376, -275, -275, -12, -9, -275, -275, -275, -275,
+ 171, -275, -275, 44, 44, 44, 5, 40, -275, -275,
+ -275, 1139, 1139, -275, 1139, 1166, 869, 27, -275, -18,
+ 2, -275, -275, 89, 884, 1065, 192, 214, -275, -275,
+ -275, -275, 248, 795, 869, -275, 10, -275, -275, -275,
+ -275, -275, 116, 82, -275, 115, -275, -275, -275, 795,
+ 795, 166, 107, 104, 107, 107, 1139, 117, -275, -275,
+ 15, 349, 23, 45, -275, 125, -275, -275, -275, 89,
+ -275, 125, -275, 178, -275, -275, 1092, 172, 1139, 1139,
+ 1139, 125, -275, -275, -275, 1139, 146, 192, 1139, 1139,
+ 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139,
+ -275, 181, -275, -275, 173, 1139, -275, -275, -275, 128,
+ 73, -275, 1107, 14, 1107, -275, -275, -275, -275, 1139,
+ -275, 128, 128, 349, -275, -275, -275, 1139, 125, -275,
+ 152, 916, -275, -275, 16, 92, -275, 20, 92, 89,
+ -275, 599, -275, -275, -275, 148, -275, 124, 22, 1048,
+ 1139, 199, 44, 265, 265, 107, 107, 107, 107, 265,
+ 265, 107, 107, 107, 107, -275, -275, 1107, -275, 1092,
+ 842, -275, 43, 192, -275, -275, 1107, -275, 172, -275,
+ 1107, -275, -275, -275, -275, -275, 133, -275, 41, 144,
+ 145, 125, 147, 92, 92, -275, -275, 92, 1139, 92,
+ 125, -275, -275, 92, -275, -275, 1107, -275, 151, 125,
+ 1139, 1107, -275, -275, -275, -275, -275, -275, 128, 76,
+ -275, 1139, 1139, -275, 224, 1139, 1139, 715, 949, -275,
+ -275, -275, 92, 1107, -275, -275, -275, 646, 599, 125,
+ -275, -275, 1107, 125, -275, 49, 349, 92, -9, 160,
+ 349, 349, 206, 113, -275, 151, -275, 869, 225, -275,
+ 169, -275, -275, -275, -275, -275, 125, -275, -275, 11,
+ -275, -275, -275, 125, 125, 179, 172, 125, 15, -275,
+ -275, 715, -275, -275, 2, 715, 1139, 128, 762, 152,
+ 1139, 219, -275, -275, 349, 125, 275, 125, 1065, 125,
+ 112, 125, 715, 125, 997, 715, -275, 261, 205, -275,
+ 191, -275, -275, 997, 128, -275, -275, -275, 271, 272,
+ -275, -275, 205, -275, 125, -275, 128, 125, -275, -275,
+ 125, -275, 125, 715, -275, 449, 715, -275, 524, -275
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -789,64 +796,65 @@ static const yytype_int16 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 6, 0, 175, 157, 158, 21, 22,
- 0, 23, 24, 164, 0, 0, 0, 152, 5, 88,
- 37, 0, 0, 36, 0, 0, 0, 0, 3, 0,
- 0, 147, 34, 4, 19, 118, 126, 127, 129, 153,
- 161, 177, 154, 0, 0, 172, 0, 176, 27, 26,
- 30, 31, 0, 0, 28, 92, 165, 155, 156, 0,
- 0, 0, 160, 154, 159, 148, 0, 181, 154, 107,
- 0, 105, 0, 0, 162, 90, 187, 7, 8, 41,
- 38, 90, 9, 0, 89, 122, 0, 0, 0, 0,
- 0, 90, 123, 125, 124, 0, 0, 128, 0, 0,
+ 2, 0, 1, 6, 0, 189, 171, 172, 21, 22,
+ 0, 23, 24, 178, 0, 0, 0, 166, 5, 90,
+ 38, 0, 0, 37, 0, 0, 0, 0, 3, 0,
+ 0, 161, 34, 4, 19, 132, 140, 141, 143, 167,
+ 175, 191, 168, 0, 0, 186, 0, 190, 27, 26,
+ 30, 31, 0, 0, 28, 94, 179, 169, 170, 0,
+ 0, 0, 174, 168, 173, 162, 0, 195, 168, 109,
+ 0, 107, 0, 0, 176, 92, 201, 7, 8, 42,
+ 39, 92, 9, 0, 91, 136, 0, 0, 0, 0,
+ 0, 92, 137, 139, 138, 0, 0, 142, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 120, 119, 137, 138, 0, 0, 0, 0, 105, 0,
- 174, 173, 29, 32, 0, 136, 0, 0, 0, 179,
- 180, 178, 108, 90, 184, 0, 0, 149, 14, 0,
- 0, 17, 0, 0, 91, 182, 0, 42, 35, 114,
- 115, 112, 113, 0, 0, 116, 164, 134, 135, 131,
- 132, 133, 130, 145, 146, 142, 143, 144, 141, 121,
- 111, 163, 171, 0, 93, 150, 151, 109, 189, 0,
- 110, 106, 13, 10, 16, 11, 40, 0, 58, 0,
- 0, 0, 90, 0, 0, 0, 79, 80, 0, 101,
- 0, 90, 39, 52, 0, 61, 45, 66, 38, 185,
- 90, 0, 20, 140, 98, 96, 0, 0, 139, 0,
- 101, 63, 0, 0, 0, 0, 67, 53, 54, 55,
- 0, 102, 56, 183, 60, 0, 0, 90, 186, 43,
- 117, 90, 99, 0, 0, 0, 166, 0, 0, 0,
- 0, 175, 68, 0, 57, 0, 83, 81, 44, 25,
- 33, 100, 97, 90, 59, 64, 0, 168, 170, 65,
- 90, 90, 0, 0, 90, 0, 84, 62, 0, 167,
- 169, 0, 0, 0, 0, 0, 82, 0, 86, 69,
- 47, 0, 90, 0, 90, 85, 90, 0, 90, 0,
- 90, 67, 0, 71, 0, 0, 70, 0, 48, 49,
- 67, 0, 87, 74, 77, 0, 0, 78, 0, 188,
- 90, 46, 0, 90, 76, 75, 90, 38, 90, 0,
- 38, 0, 0, 51, 0, 50
+ 134, 133, 151, 152, 0, 0, 117, 36, 122, 0,
+ 0, 115, 121, 0, 107, 188, 187, 29, 32, 0,
+ 150, 0, 0, 0, 193, 194, 192, 110, 92, 198,
+ 0, 0, 163, 14, 0, 0, 17, 0, 0, 93,
+ 196, 0, 43, 35, 127, 128, 129, 125, 126, 0,
+ 0, 130, 178, 148, 149, 145, 146, 147, 144, 159,
+ 160, 156, 157, 158, 155, 124, 135, 123, 177, 118,
+ 0, 185, 0, 95, 164, 165, 111, 203, 0, 112,
+ 108, 13, 10, 16, 11, 41, 0, 59, 0, 0,
+ 0, 92, 0, 0, 0, 81, 82, 0, 103, 0,
+ 92, 40, 53, 0, 62, 46, 67, 39, 199, 92,
+ 0, 20, 154, 119, 120, 116, 100, 98, 0, 0,
+ 153, 0, 103, 64, 0, 0, 0, 0, 68, 54,
+ 55, 56, 0, 104, 57, 197, 61, 0, 0, 92,
+ 200, 44, 131, 92, 101, 0, 0, 0, 180, 0,
+ 0, 0, 0, 189, 69, 0, 58, 0, 85, 83,
+ 0, 45, 25, 33, 102, 99, 92, 60, 65, 0,
+ 182, 184, 66, 92, 92, 0, 0, 92, 0, 86,
+ 63, 0, 181, 183, 0, 0, 0, 0, 0, 84,
+ 0, 88, 70, 48, 0, 92, 0, 92, 87, 92,
+ 0, 92, 0, 92, 68, 0, 72, 0, 0, 71,
+ 0, 49, 50, 68, 0, 89, 75, 78, 0, 0,
+ 79, 80, 0, 202, 92, 47, 0, 92, 77, 76,
+ 92, 39, 92, 0, 39, 0, 0, 52, 0, 51
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -271, -271, -271, -271, -271, -271, 218, -271, -271, -271,
- -271, -40, -271, -271, -206, 113, -150, -271, -271, -218,
- -271, -271, -270, -271, -271, -271, -271, -271, -271, -271,
- -271, 43, 29, -271, -271, -271, 47, -45, -20, -1,
- -271, -271, -271, -18, 39, -271, 246, -271, 8, 112,
- -271, -271, 11, -39, -271, -271, -70, -2, -271, -26,
- -227, -60, -271, -28, -38, 64
+ -275, -275, -275, -275, -275, -275, 252, -275, -275, -275,
+ -275, -33, -275, -80, -275, -213, 100, -144, -275, -275,
+ -231, -275, -275, -274, -275, -275, -275, -275, -275, -275,
+ -275, -275, 7, 62, -275, -275, -275, 54, -275, -43,
+ 1, -275, -23, -1, -275, -275, -275, -13, 17, -275,
+ 263, -275, 8, 127, -275, -275, 21, -36, -275, -275,
+ -78, -2, -275, -27, -230, -65, -275, -15, -38, -94
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 28, 140, 143, 29, 77, 53, 54, 30,
- 173, 31, 83, 32, 146, 78, 202, 203, 220, 204,
- 235, 246, 253, 297, 306, 318, 205, 256, 277, 287,
- 206, 144, 145, 125, 216, 217, 230, 116, 117, 207,
- 115, 94, 95, 35, 36, 37, 38, 39, 40, 55,
- 265, 266, 267, 45, 46, 47, 41, 42, 131, 208,
- 209, 137, 237, 210, 320, 136
+ -1, 1, 28, 145, 148, 29, 77, 53, 54, 30,
+ 182, 31, 83, 118, 32, 151, 78, 211, 212, 232,
+ 213, 247, 258, 265, 310, 319, 332, 214, 268, 290,
+ 300, 215, 149, 150, 130, 228, 229, 242, 269, 70,
+ 119, 120, 121, 216, 115, 94, 95, 35, 36, 37,
+ 38, 39, 40, 55, 278, 279, 280, 45, 46, 47,
+ 41, 42, 136, 217, 218, 142, 249, 219, 334, 141
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -854,294 +862,325 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
- 34, 81, 236, 80, 80, 182, 70, 121, 252, 258,
- 135, 56, 57, 58, 126, 127, 132, 150, 184, 63,
- 63, 273, 63, 68, 119, 71, 214, 221, 132, 215,
- 120, 311, 43, 63, 4, 74, 261, 112, 113, 262,
- 322, 19, 118, 118, 33, 138, 5, 100, 101, 102,
- 139, 44, 103, 129, 130, -12, 171, 279, 118, 118,
- 62, 64, 242, 65, 76, 128, 175, 176, -15, 74,
- 133, 85, 79, 44, 97, 250, 59, 75, -12, 72,
- 321, 73, 133, 252, 44, 149, 172, 151, 152, 153,
- 222, -15, 252, -94, 155, 134, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 25, 218,
- 147, 44, 81, -105, 170, 81, 133, 60, 92, 93,
- 154, 331, 63, 84, 334, 141, 122, 303, 288, -95,
- 142, 177, 290, 123, 19, 181, 124, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 309,
- 304, 305, 312, 212, 56, 75, 241, 76, 103, 132,
- -105, -105, 178, 174, 85, 19, 81, 81, -104, 86,
- 81, 4, 81, 5, 110, 111, 81, 19, 148, 333,
- 156, 238, 335, 79, 263, 169, 79, 134, 270, 271,
- 257, 179, 219, 247, 223, 87, 88, 89, 231, -90,
- 224, 226, 81, 284, 76, 112, 113, 268, 90, -104,
- 240, 92, 93, 133, 114, 286, 269, 81, 244, 231,
- 272, 225, 248, 249, 292, 274, -104, 268, 85, 76,
- 233, 298, -104, 86, 118, 275, 276, 79, 79, 239,
- 296, 79, 283, 79, 48, 49, 319, 79, 82, 201,
- 324, 323, 325, 183, 71, 289, 185, 294, 85, 87,
- 88, 89, 328, 86, 317, 300, 259, 245, 213, 295,
- 260, 67, 90, 79, 91, 92, 93, 280, 0, 0,
- 326, 243, 291, 0, 293, 63, 50, 51, 79, 87,
- 4, 5, 278, 63, 6, 7, 0, 0, 0, 281,
- 282, 0, 0, 285, 0, 92, 93, 227, 228, 0,
- 52, 229, 0, 232, 0, 0, 0, 234, 0, 0,
- 0, 299, 0, 301, 0, 302, 307, 308, 0, 310,
- 14, 15, 16, 17, 97, 0, 0, 0, 0, 20,
- 0, 0, 85, 254, 0, 21, 22, 86, 23, 327,
- 24, 0, 329, 25, 66, 330, 61, 332, 264, 2,
- 3, 0, 4, 5, 0, 0, 6, 7, 0, 0,
- 0, 0, 0, 87, 88, 89, 8, 9, 0, 0,
- 0, 0, 85, 0, 0, 0, 90, 86, 0, 92,
- 93, 313, 314, 0, 10, 11, 12, 13, 0, 0,
- 0, 134, 14, 15, 16, 17, 18, 0, 0, 0,
- 19, 20, 0, 87, 88, 0, 0, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 27, 92,
- 93, -18, 186, -18, 4, 5, 20, 0, 6, 7,
- 0, 0, 315, 316, 0, 23, 0, 0, 0, 0,
- 187, 0, 188, 189, 190, -73, -73, 191, 192, 193,
- 194, 195, 196, 197, 198, 199, 0, 0, 0, 13,
- 200, 0, 0, 0, 14, 15, 16, 17, 0, 0,
- 0, 0, -73, 20, 98, 99, 100, 101, 102, 21,
- 22, 103, 23, 0, 24, 0, 0, 25, 26, 0,
- 61, 0, 0, 75, -73, 76, 186, 0, 4, 5,
- 0, 0, 6, 7, 104, 105, 106, 107, 108, 0,
- 0, 109, 0, 0, 187, 0, 188, 189, 190, -72,
- -72, 191, 192, 193, 194, 195, 196, 197, 198, 199,
- 0, 0, 0, 13, 200, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, -72, 20, 0, 0,
+ 34, 123, 80, 80, 248, 140, 154, 264, 33, 156,
+ 126, 56, 57, 58, 81, 137, 137, 191, 271, 63,
+ 63, 193, 63, 68, 143, 71, 180, 125, 292, 144,
+ 4, 175, 85, 63, 19, 74, 79, 86, 62, 64,
+ 324, 65, 122, 124, 226, 233, 146, 227, 5, 336,
+ 274, 147, 97, 275, 178, 75, 43, 76, 122, 122,
+ 131, 132, 44, 87, 88, 133, 184, 185, -12, 74,
+ 138, 138, -15, 59, 179, 75, 72, 254, 73, 92,
+ 93, 44, 44, 264, 139, 155, 181, 157, 158, 159,
+ 335, -12, 264, 262, 161, -15, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 60, 234,
+ 230, 25, -96, 316, 177, 163, 164, 165, 166, 167,
+ 168, 169, 170, 171, 172, 173, 174, 63, 345, 138,
+ 81, 348, 138, 81, 85, 255, 186, 317, 318, 86,
+ 190, 84, -114, 152, 19, -97, 183, 301, 112, 113,
+ 128, 303, 79, 160, 286, 79, 223, 225, 85, 221,
+ 56, 134, 135, 253, 19, 87, 127, 76, 322, 4,
+ 137, 325, 129, 103, 48, 49, 5, 19, 122, 122,
+ -106, 92, 93, 153, 44, 162, -92, 176, 81, 81,
+ 117, 276, 81, 188, 81, 283, 284, 139, 81, 347,
+ 187, 231, 349, 250, 270, 92, 93, 243, 297, -115,
+ 79, 79, 235, 236, 79, 238, 79, 50, 51, 252,
+ 79, -106, 281, 299, 288, 138, 76, 81, 259, 282,
+ 256, 243, 305, 285, 260, 261, 289, 331, -106, 311,
+ 309, 52, 81, 281, -106, 192, 124, 296, 194, 79,
+ 287, 98, 99, 100, 101, 102, -115, -115, 103, 337,
+ 333, 110, 111, 237, 79, 210, 71, 302, 326, 327,
+ 117, 342, 245, 104, 105, 106, 107, 108, 338, 339,
+ 109, 251, 82, 307, 330, 85, 257, 308, 67, 222,
+ 86, 313, 112, 113, 340, 304, 0, 306, 63, 0,
+ 293, 114, 0, 239, 240, 0, 63, 241, 0, 244,
+ 0, 272, 0, 246, 20, 273, 87, 88, 89, 0,
+ 328, 329, 0, 23, 0, 97, 100, 101, 102, 90,
+ 0, 103, 92, 93, 0, 0, 0, 0, 291, 0,
+ 0, 0, 266, 0, 0, 294, 295, 0, 0, 298,
+ 76, 0, 0, 0, 0, 0, 0, 277, 0, 85,
+ 0, 0, 0, 0, 86, 0, 0, 312, 0, 314,
+ 0, 315, 320, 321, 0, 323, 2, 3, 0, 4,
+ 5, 0, 0, 6, 7, 0, 0, 0, 0, 0,
+ 87, 88, 89, 0, 8, 9, 341, 0, 0, 343,
+ 0, 0, 344, 90, 346, 0, 92, 93, 0, 0,
+ 0, 0, 10, 11, 12, 13, 0, 0, 139, 0,
+ 14, 15, 16, 17, 18, 0, 0, 0, 19, 20,
+ 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
+ 24, 0, 0, 25, 26, 0, 27, 0, 0, -18,
+ 195, -18, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 196,
+ 0, 197, 198, 199, -74, -74, 200, 201, 202, 203,
+ 204, 205, 206, 207, 208, 0, 0, 0, 13, 209,
+ 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 0, -74, 20, 0, 0, 0, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 0, 0, 75, -74, 76, 195, 0, 4, 5, 0,
+ 0, 6, 7, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 196, 0, 197, 198, 199, -73,
+ -73, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+ 0, 0, 0, 13, 209, 0, 0, 0, 14, 15,
+ 16, 17, 0, 0, 0, 0, -73, 20, 0, 0,
0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 0, 25, 26, 0, 61, 0, 0, 75, -72, 76,
- 186, 0, 4, 5, 0, 0, 6, 7, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 187, 0,
- 188, 189, 190, 0, 0, 191, 192, 193, 194, 195,
- 196, 197, 198, 199, 0, 0, 0, 13, 200, 0,
- 0, 0, 14, 15, 16, 17, 69, 0, 4, 5,
- 0, 20, 6, 7, 0, -103, 0, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 61, 0,
- 0, 75, 201, 76, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 13, 0, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, -103, 20, 0, 0,
- 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 0, 25, 255, -103, 61, 0, 4, 5, 0, -103,
- 6, 7, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 187, 0, 188, 189, 190, 0, 0, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 0, 4,
- 5, 13, 200, 6, 7, 0, 14, 15, 16, 17,
+ 0, 25, 26, 0, 61, 0, 0, 75, -73, 76,
+ 195, 0, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 196,
+ 0, 197, 198, 199, 0, 0, 200, 201, 202, 203,
+ 204, 205, 206, 207, 208, 0, 0, 0, 13, 209,
+ 0, 0, 0, 14, 15, 16, 17, 69, 0, 4,
+ 5, 0, 20, 6, 7, 0, 0, -105, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 0, 0, 75, 210, 76, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
+ 14, 15, 16, 17, 0, 0, 0, 0, -105, 20,
+ 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
+ 24, 0, 0, 25, 267, -105, 61, 0, 4, 5,
+ 0, -105, 6, 7, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 196, 0, 197, 198, 199,
+ 0, 0, 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 0, 0, 0, 13, 209, 0, 0, 0, 14,
+ 15, 16, 17, 0, 0, 4, 5, 0, 20, 6,
+ 7, 0, 0, 0, 21, 22, 0, 23, 0, 24,
+ 0, 0, 25, 26, 0, 61, 0, 0, 75, 0,
+ 76, 0, 0, 0, 0, 0, 116, 0, 4, 5,
+ 0, 13, 6, 7, 117, 0, 14, 15, 16, 17,
0, 0, 0, 0, 0, 20, 0, 0, 0, 0,
- 85, 21, 22, 0, 23, 86, 24, 0, 0, 25,
- 26, 0, 61, 0, 13, 75, 0, 76, 0, 14,
- 15, 16, 17, 69, 0, 4, 5, 0, 20, 6,
- 7, 87, 88, 89, 21, 22, 0, 23, 0, 24,
- 0, 0, 25, 26, 90, 61, 0, 92, 93, 0,
- 76, 0, 0, 0, 0, 69, 0, 4, 5, 0,
- 13, 6, 7, 0, 0, 14, 15, 16, 17, 0,
- 0, 0, 0, 0, 20, 0, 0, 0, 0, 0,
- 21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
- -103, 61, 13, 0, 0, 0, 0, 14, 15, 16,
- 17, 180, 0, 4, 5, 0, 20, 6, 7, 0,
- 0, 0, 21, 22, 0, 23, 0, 24, 0, 0,
- 25, 26, 0, 61, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 251, 13, 0,
- 6, 7, 0, 14, 15, 16, 17, 0, 0, 0,
- 0, 0, 20, 0, 0, 189, 0, 0, 21, 22,
- 0, 23, 0, 24, 196, 197, 25, 26, 0, 61,
- 0, 13, 0, 0, 0, 0, 14, 15, 16, 17,
- 0, 0, 4, 5, 0, 20, 6, 7, 0, 0,
0, 21, 22, 0, 23, 0, 24, 0, 0, 25,
- 26, 189, 61, 0, 0, 0, 0, 0, 0, 0,
- 196, 197, 0, 0, 0, 0, 0, 13, 0, 0,
- 0, 0, 14, 15, 16, 17, 0, 0, 4, 5,
- 0, 20, 6, 7, 0, 0, 96, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 61, 0,
- 0, 0, 0, 0, 0, 4, 5, 0, 0, 6,
- 7, 0, 0, 13, 0, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, 0, 20, 0, 0,
- 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 13, 25, 26, 0, 61, 14, 15, 16, 17, 0,
- 85, 0, 0, 0, 20, 86, 0, 0, 0, 0,
- 21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
- 0, 61, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 87, 88, 89, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 90, 211, 0, 92, 93
+ 26, 0, 61, 0, 13, 0, 0, 76, 0, 14,
+ 15, 16, 17, 224, 0, 4, 5, 0, 20, 6,
+ 7, 117, 0, 0, 21, 22, 0, 23, 0, 24,
+ 0, 0, 25, 26, -113, 61, 0, 0, 0, 0,
+ 69, 0, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 13, 0, 0, 0, 0, 14, 15, 16, 17,
+ 0, 0, 0, 0, 85, 20, 0, 0, 0, 86,
+ 0, 21, 22, 0, 23, 0, 24, 0, 13, 25,
+ 26, 0, 61, 14, 15, 16, 17, 189, 0, 4,
+ 5, 0, 20, 6, 7, 87, 88, 89, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 90, 61,
+ 91, 92, 93, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 263, 0, 13, 6, 7, 0, 0,
+ 14, 15, 16, 17, 0, 0, 0, 0, 0, 20,
+ 0, 0, 198, 0, 0, 21, 22, 0, 23, 0,
+ 24, 205, 206, 25, 26, 0, 61, 0, 13, 0,
+ 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 4, 5, 20, 0, 6, 7, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 198, 0, 0, 0, 0, 0, 0, 0, 0, 205,
+ 206, 0, 0, 0, 0, 0, 13, 0, 0, 0,
+ 0, 14, 15, 16, 17, 0, 0, 0, 0, 0,
+ 20, 0, 0, 0, 0, 0, 21, 22, 85, 23,
+ 0, 24, 0, 86, 25, 26, 0, 61, 4, 5,
+ 0, 0, 6, 7, 0, 0, 0, 96, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 87,
+ 88, 89, 0, 0, 0, 4, 5, 0, 0, 6,
+ 7, 117, 90, 220, 13, 92, 93, 0, 0, 14,
+ 15, 16, 17, 0, 0, 0, 0, 85, 20, 0,
+ 0, 0, 86, 0, 21, 22, 0, 23, 0, 24,
+ 0, 13, 25, 26, 0, 61, 14, 15, 16, 17,
+ 0, 0, 4, 5, 0, 20, 6, 7, 87, 88,
+ 89, 21, 22, 0, 23, 0, 24, 0, 0, 25,
+ 26, 90, 61, 0, 92, 93, 0, 0, 0, 4,
+ 5, 0, 0, 6, 7, 0, 0, 0, 13, 0,
+ 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 0, 0, 20, 0, 0, 0, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 14, 15, 16, 17, 0, 0, 0, 0, 0, 20,
+ 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
+ 24, 0, 0, 25, 66, 0, 61
};
static const yytype_int16 yycheck[] =
{
- 1, 29, 208, 29, 30, 1, 26, 46, 226, 236,
- 70, 13, 14, 15, 59, 60, 1, 87, 1, 21,
- 22, 40, 24, 25, 44, 26, 1, 4, 1, 4,
- 16, 301, 67, 35, 3, 27, 1, 43, 44, 4,
- 310, 51, 43, 44, 1, 1, 4, 60, 61, 62,
- 6, 70, 65, 43, 44, 51, 116, 16, 59, 60,
- 21, 22, 1, 24, 74, 66, 126, 127, 51, 61,
- 55, 9, 29, 70, 35, 225, 67, 72, 74, 48,
- 307, 50, 55, 301, 70, 86, 71, 88, 89, 90,
- 67, 74, 310, 68, 95, 68, 98, 99, 100, 101,
- 102, 103, 104, 105, 106, 107, 108, 109, 66, 179,
- 81, 70, 140, 9, 115, 143, 55, 67, 56, 57,
- 91, 327, 124, 51, 330, 1, 49, 1, 278, 68,
- 6, 132, 282, 67, 51, 136, 56, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, 109, 299,
- 24, 25, 302, 154, 156, 72, 216, 74, 65, 1,
- 56, 57, 133, 124, 9, 51, 194, 195, 10, 14,
- 198, 3, 200, 4, 12, 13, 204, 51, 5, 329,
- 38, 209, 332, 140, 244, 13, 143, 68, 248, 249,
- 235, 40, 67, 4, 67, 40, 41, 42, 199, 73,
- 67, 67, 230, 273, 74, 43, 44, 246, 53, 51,
- 211, 56, 57, 55, 52, 275, 68, 245, 219, 220,
- 26, 192, 223, 224, 284, 253, 68, 266, 9, 74,
- 201, 291, 74, 14, 235, 255, 10, 194, 195, 210,
- 20, 198, 67, 200, 3, 4, 54, 204, 30, 73,
- 7, 311, 7, 140, 255, 281, 143, 285, 9, 40,
- 41, 42, 322, 14, 304, 293, 237, 220, 156, 287,
- 241, 25, 53, 230, 55, 56, 57, 266, -1, -1,
- 318, 217, 283, -1, 285, 287, 45, 46, 245, 40,
- 3, 4, 263, 295, 7, 8, -1, -1, -1, 270,
- 271, -1, -1, 274, -1, 56, 57, 194, 195, -1,
- 69, 198, -1, 200, -1, -1, -1, 204, -1, -1,
- -1, 292, -1, 294, -1, 296, 297, 298, -1, 300,
- 43, 44, 45, 46, 295, -1, -1, -1, -1, 52,
- -1, -1, 9, 230, -1, 58, 59, 14, 61, 320,
- 63, -1, 323, 66, 67, 326, 69, 328, 245, 0,
+ 1, 44, 29, 30, 217, 70, 86, 238, 1, 87,
+ 46, 13, 14, 15, 29, 1, 1, 1, 248, 21,
+ 22, 1, 24, 25, 1, 26, 120, 17, 17, 6,
+ 3, 111, 10, 35, 52, 27, 29, 15, 21, 22,
+ 314, 24, 43, 44, 1, 4, 1, 4, 4, 323,
+ 1, 6, 35, 4, 119, 73, 68, 75, 59, 60,
+ 59, 60, 71, 41, 42, 66, 131, 132, 52, 61,
+ 56, 56, 52, 68, 1, 73, 49, 1, 51, 57,
+ 58, 71, 71, 314, 69, 86, 72, 88, 89, 90,
+ 320, 75, 323, 237, 95, 75, 98, 99, 100, 101,
+ 102, 103, 104, 105, 106, 107, 108, 109, 68, 68,
+ 188, 67, 69, 1, 115, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 129, 341, 56,
+ 145, 344, 56, 148, 10, 229, 137, 25, 26, 15,
+ 141, 52, 69, 81, 52, 69, 129, 291, 44, 45,
+ 68, 295, 145, 91, 41, 148, 179, 180, 10, 160,
+ 162, 44, 45, 228, 52, 41, 50, 75, 312, 3,
+ 1, 315, 57, 66, 3, 4, 4, 52, 179, 180,
+ 11, 57, 58, 5, 71, 39, 74, 14, 203, 204,
+ 9, 256, 207, 41, 209, 260, 261, 69, 213, 343,
+ 138, 68, 346, 218, 247, 57, 58, 208, 286, 10,
+ 203, 204, 68, 68, 207, 68, 209, 46, 47, 220,
+ 213, 52, 258, 288, 267, 56, 75, 242, 4, 69,
+ 231, 232, 297, 27, 235, 236, 11, 317, 69, 304,
+ 21, 70, 257, 279, 75, 145, 247, 68, 148, 242,
+ 265, 59, 60, 61, 62, 63, 57, 58, 66, 324,
+ 55, 13, 14, 201, 257, 74, 267, 294, 7, 8,
+ 9, 336, 210, 59, 60, 61, 62, 63, 7, 7,
+ 66, 219, 30, 298, 317, 10, 232, 300, 25, 162,
+ 15, 306, 44, 45, 332, 296, -1, 298, 300, -1,
+ 279, 53, -1, 203, 204, -1, 308, 207, -1, 209,
+ -1, 249, -1, 213, 53, 253, 41, 42, 43, -1,
+ 59, 60, -1, 62, -1, 308, 61, 62, 63, 54,
+ -1, 66, 57, 58, -1, -1, -1, -1, 276, -1,
+ -1, -1, 242, -1, -1, 283, 284, -1, -1, 287,
+ 75, -1, -1, -1, -1, -1, -1, 257, -1, 10,
+ -1, -1, -1, -1, 15, -1, -1, 305, -1, 307,
+ -1, 309, 310, 311, -1, 313, 0, 1, -1, 3,
+ 4, -1, -1, 7, 8, -1, -1, -1, -1, -1,
+ 41, 42, 43, -1, 18, 19, 334, -1, -1, 337,
+ -1, -1, 340, 54, 342, -1, 57, 58, -1, -1,
+ -1, -1, 36, 37, 38, 39, -1, -1, 69, -1,
+ 44, 45, 46, 47, 48, -1, -1, -1, 52, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, 62, -1,
+ 64, -1, -1, 67, 68, -1, 70, -1, -1, 73,
+ 1, 75, 3, 4, -1, -1, 7, 8, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 20,
+ -1, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, -1, -1, -1, 39, 40,
+ -1, -1, -1, 44, 45, 46, 47, -1, -1, -1,
+ -1, 52, 53, -1, -1, -1, -1, -1, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ -1, -1, 73, 74, 75, 1, -1, 3, 4, -1,
+ -1, 7, 8, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 20, -1, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ -1, -1, -1, 39, 40, -1, -1, -1, 44, 45,
+ 46, 47, -1, -1, -1, -1, 52, 53, -1, -1,
+ -1, -1, -1, 59, 60, -1, 62, -1, 64, -1,
+ -1, 67, 68, -1, 70, -1, -1, 73, 74, 75,
1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
- -1, -1, -1, 40, 41, 42, 17, 18, -1, -1,
- -1, -1, 9, -1, -1, -1, 53, 14, -1, 56,
- 57, 7, 8, -1, 35, 36, 37, 38, -1, -1,
- -1, 68, 43, 44, 45, 46, 47, -1, -1, -1,
- 51, 52, -1, 40, 41, -1, -1, 58, 59, -1,
- 61, -1, 63, -1, -1, 66, 67, -1, 69, 56,
- 57, 72, 1, 74, 3, 4, 52, -1, 7, 8,
- -1, -1, 58, 59, -1, 61, -1, -1, -1, -1,
- 19, -1, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, -1, -1, -1, 38,
- 39, -1, -1, -1, 43, 44, 45, 46, -1, -1,
- -1, -1, 51, 52, 58, 59, 60, 61, 62, 58,
- 59, 65, 61, -1, 63, -1, -1, 66, 67, -1,
- 69, -1, -1, 72, 73, 74, 1, -1, 3, 4,
- -1, -1, 7, 8, 58, 59, 60, 61, 62, -1,
- -1, 65, -1, -1, 19, -1, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- -1, -1, -1, 38, 39, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, 51, 52, -1, -1,
- -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
- -1, 66, 67, -1, 69, -1, -1, 72, 73, 74,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 20,
+ -1, 22, 23, 24, -1, -1, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, -1, -1, -1, 39, 40,
+ -1, -1, -1, 44, 45, 46, 47, 1, -1, 3,
+ 4, -1, 53, 7, 8, -1, -1, 11, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ -1, -1, 73, 74, 75, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
+ 44, 45, 46, 47, -1, -1, -1, -1, 52, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, 62, -1,
+ 64, -1, -1, 67, 68, 69, 70, -1, 3, 4,
+ -1, 75, 7, 8, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 20, -1, 22, 23, 24,
+ -1, -1, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, -1, -1, -1, 39, 40, -1, -1, -1, 44,
+ 45, 46, 47, -1, -1, 3, 4, -1, 53, 7,
+ 8, -1, -1, -1, 59, 60, -1, 62, -1, 64,
+ -1, -1, 67, 68, -1, 70, -1, -1, 73, -1,
+ 75, -1, -1, -1, -1, -1, 1, -1, 3, 4,
+ -1, 39, 7, 8, 9, -1, 44, 45, 46, 47,
+ -1, -1, -1, -1, -1, 53, -1, -1, -1, -1,
+ -1, 59, 60, -1, 62, -1, 64, -1, -1, 67,
+ 68, -1, 70, -1, 39, -1, -1, 75, -1, 44,
+ 45, 46, 47, 1, -1, 3, 4, -1, 53, 7,
+ 8, 9, -1, -1, 59, 60, -1, 62, -1, 64,
+ -1, -1, 67, 68, 69, 70, -1, -1, -1, -1,
1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 19, -1,
- 21, 22, 23, -1, -1, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, -1, -1, -1, 38, 39, -1,
- -1, -1, 43, 44, 45, 46, 1, -1, 3, 4,
- -1, 52, 7, 8, -1, 10, -1, 58, 59, -1,
- 61, -1, 63, -1, -1, 66, 67, -1, 69, -1,
- -1, 72, 73, 74, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 38, -1, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, 51, 52, -1, -1,
- -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
- -1, 66, 67, 68, 69, -1, 3, 4, -1, 74,
- 7, 8, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 19, -1, 21, 22, 23, -1, -1, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, -1, 3,
- 4, 38, 39, 7, 8, -1, 43, 44, 45, 46,
- -1, -1, -1, -1, -1, 52, -1, -1, -1, -1,
- 9, 58, 59, -1, 61, 14, 63, -1, -1, 66,
- 67, -1, 69, -1, 38, 72, -1, 74, -1, 43,
- 44, 45, 46, 1, -1, 3, 4, -1, 52, 7,
- 8, 40, 41, 42, 58, 59, -1, 61, -1, 63,
- -1, -1, 66, 67, 53, 69, -1, 56, 57, -1,
- 74, -1, -1, -1, -1, 1, -1, 3, 4, -1,
- 38, 7, 8, -1, -1, 43, 44, 45, 46, -1,
- -1, -1, -1, -1, 52, -1, -1, -1, -1, -1,
- 58, 59, -1, 61, -1, 63, -1, -1, 66, 67,
- 68, 69, 38, -1, -1, -1, -1, 43, 44, 45,
- 46, 1, -1, 3, 4, -1, 52, 7, 8, -1,
- -1, -1, 58, 59, -1, 61, -1, 63, -1, -1,
- 66, 67, -1, 69, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 3, 4, 38, -1,
- 7, 8, -1, 43, 44, 45, 46, -1, -1, -1,
- -1, -1, 52, -1, -1, 22, -1, -1, 58, 59,
- -1, 61, -1, 63, 31, 32, 66, 67, -1, 69,
- -1, 38, -1, -1, -1, -1, 43, 44, 45, 46,
- -1, -1, 3, 4, -1, 52, 7, 8, -1, -1,
- -1, 58, 59, -1, 61, -1, 63, -1, -1, 66,
- 67, 22, 69, -1, -1, -1, -1, -1, -1, -1,
- 31, 32, -1, -1, -1, -1, -1, 38, -1, -1,
- -1, -1, 43, 44, 45, 46, -1, -1, 3, 4,
- -1, 52, 7, 8, -1, -1, 11, 58, 59, -1,
- 61, -1, 63, -1, -1, 66, 67, -1, 69, -1,
- -1, -1, -1, -1, -1, 3, 4, -1, -1, 7,
- 8, -1, -1, 38, -1, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, -1, 52, -1, -1,
- -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
- 38, 66, 67, -1, 69, 43, 44, 45, 46, -1,
- 9, -1, -1, -1, 52, 14, -1, -1, -1, -1,
- 58, 59, -1, 61, -1, 63, -1, -1, 66, 67,
- -1, 69, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 40, 41, 42, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 53, 54, -1, 56, 57
+ -1, 39, -1, -1, -1, -1, 44, 45, 46, 47,
+ -1, -1, -1, -1, 10, 53, -1, -1, -1, 15,
+ -1, 59, 60, -1, 62, -1, 64, -1, 39, 67,
+ 68, -1, 70, 44, 45, 46, 47, 1, -1, 3,
+ 4, -1, 53, 7, 8, 41, 42, 43, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, 54, 70,
+ 56, 57, 58, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 3, 4, -1, 39, 7, 8, -1, -1,
+ 44, 45, 46, 47, -1, -1, -1, -1, -1, 53,
+ -1, -1, 23, -1, -1, 59, 60, -1, 62, -1,
+ 64, 32, 33, 67, 68, -1, 70, -1, 39, -1,
+ -1, -1, -1, 44, 45, 46, 47, -1, -1, -1,
+ 3, 4, 53, -1, 7, 8, -1, -1, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ 23, -1, -1, -1, -1, -1, -1, -1, -1, 32,
+ 33, -1, -1, -1, -1, -1, 39, -1, -1, -1,
+ -1, 44, 45, 46, 47, -1, -1, -1, -1, -1,
+ 53, -1, -1, -1, -1, -1, 59, 60, 10, 62,
+ -1, 64, -1, 15, 67, 68, -1, 70, 3, 4,
+ -1, -1, 7, 8, -1, -1, -1, 12, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 41,
+ 42, 43, -1, -1, -1, 3, 4, -1, -1, 7,
+ 8, 9, 54, 55, 39, 57, 58, -1, -1, 44,
+ 45, 46, 47, -1, -1, -1, -1, 10, 53, -1,
+ -1, -1, 15, -1, 59, 60, -1, 62, -1, 64,
+ -1, 39, 67, 68, -1, 70, 44, 45, 46, 47,
+ -1, -1, 3, 4, -1, 53, 7, 8, 41, 42,
+ 43, 59, 60, -1, 62, -1, 64, -1, -1, 67,
+ 68, 54, 70, -1, 57, 58, -1, -1, -1, 3,
+ 4, -1, -1, 7, 8, -1, -1, -1, 39, -1,
+ -1, -1, -1, 44, 45, 46, 47, -1, -1, -1,
+ -1, -1, 53, -1, -1, -1, -1, -1, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ 44, 45, 46, 47, -1, -1, -1, -1, -1, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, 62, -1,
+ 64, -1, -1, 67, 68, -1, 70
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 76, 0, 1, 3, 4, 7, 8, 17, 18,
- 35, 36, 37, 38, 43, 44, 45, 46, 47, 51,
- 52, 58, 59, 61, 63, 66, 67, 69, 77, 80,
- 84, 86, 88, 106, 114, 118, 119, 120, 121, 122,
- 123, 131, 132, 67, 70, 128, 129, 130, 3, 4,
- 45, 46, 69, 82, 83, 124, 132, 132, 132, 67,
- 67, 69, 119, 132, 119, 119, 67, 121, 132, 1,
- 113, 114, 48, 50, 123, 72, 74, 81, 90, 106,
- 134, 138, 81, 87, 51, 9, 14, 40, 41, 42,
- 53, 55, 56, 57, 116, 117, 11, 119, 58, 59,
- 60, 61, 62, 65, 58, 59, 60, 61, 62, 65,
- 12, 13, 43, 44, 52, 115, 112, 113, 114, 113,
- 16, 128, 49, 67, 56, 108, 112, 112, 114, 43,
- 44, 133, 1, 55, 68, 136, 140, 136, 1, 6,
- 78, 1, 6, 79, 106, 107, 89, 107, 5, 114,
- 131, 114, 114, 114, 107, 114, 38, 119, 119, 119,
- 119, 119, 119, 119, 119, 119, 119, 119, 119, 13,
- 114, 136, 71, 85, 119, 136, 136, 114, 107, 40,
- 1, 114, 1, 90, 1, 90, 1, 19, 21, 22,
- 23, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 39, 73, 91, 92, 94, 101, 105, 114, 134, 135,
- 138, 54, 114, 124, 1, 4, 109, 110, 131, 67,
- 93, 4, 67, 67, 67, 107, 67, 90, 90, 90,
- 111, 114, 90, 107, 90, 95, 89, 137, 138, 107,
- 114, 136, 1, 140, 114, 111, 96, 4, 114, 114,
- 91, 4, 94, 97, 90, 67, 102, 112, 135, 107,
- 107, 1, 4, 136, 90, 125, 126, 127, 128, 68,
- 136, 136, 26, 40, 138, 113, 10, 103, 107, 16,
- 127, 107, 107, 67, 131, 107, 136, 104, 91, 134,
- 91, 114, 136, 114, 138, 118, 20, 98, 136, 107,
- 138, 107, 107, 1, 24, 25, 99, 107, 107, 91,
- 107, 97, 91, 7, 8, 58, 59, 86, 100, 54,
- 139, 135, 97, 136, 7, 7, 139, 107, 136, 107,
- 107, 89, 107, 91, 89, 91
+ 0, 77, 0, 1, 3, 4, 7, 8, 18, 19,
+ 36, 37, 38, 39, 44, 45, 46, 47, 48, 52,
+ 53, 59, 60, 62, 64, 67, 68, 70, 78, 81,
+ 85, 87, 90, 108, 119, 123, 124, 125, 126, 127,
+ 128, 136, 137, 68, 71, 133, 134, 135, 3, 4,
+ 46, 47, 70, 83, 84, 129, 137, 137, 137, 68,
+ 68, 70, 124, 137, 124, 124, 68, 126, 137, 1,
+ 115, 119, 49, 51, 128, 73, 75, 82, 92, 108,
+ 139, 143, 82, 88, 52, 10, 15, 41, 42, 43,
+ 54, 56, 57, 58, 121, 122, 12, 124, 59, 60,
+ 61, 62, 63, 66, 59, 60, 61, 62, 63, 66,
+ 13, 14, 44, 45, 53, 120, 1, 9, 89, 116,
+ 117, 118, 119, 115, 119, 17, 133, 50, 68, 57,
+ 110, 116, 116, 119, 44, 45, 138, 1, 56, 69,
+ 141, 145, 141, 1, 6, 79, 1, 6, 80, 108,
+ 109, 91, 109, 5, 89, 119, 136, 119, 119, 119,
+ 109, 119, 39, 124, 124, 124, 124, 124, 124, 124,
+ 124, 124, 124, 124, 124, 89, 14, 119, 141, 1,
+ 145, 72, 86, 124, 141, 141, 119, 109, 41, 1,
+ 119, 1, 92, 1, 92, 1, 20, 22, 23, 24,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 40,
+ 74, 93, 94, 96, 103, 107, 119, 139, 140, 143,
+ 55, 119, 129, 118, 1, 118, 1, 4, 111, 112,
+ 136, 68, 95, 4, 68, 68, 68, 109, 68, 92,
+ 92, 92, 113, 119, 92, 109, 92, 97, 91, 142,
+ 143, 109, 119, 141, 1, 145, 119, 113, 98, 4,
+ 119, 119, 93, 4, 96, 99, 92, 68, 104, 114,
+ 115, 140, 109, 109, 1, 4, 141, 92, 130, 131,
+ 132, 133, 69, 141, 141, 27, 41, 143, 115, 11,
+ 105, 109, 17, 132, 109, 109, 68, 136, 109, 141,
+ 106, 93, 139, 93, 119, 141, 119, 143, 123, 21,
+ 100, 141, 109, 143, 109, 109, 1, 25, 26, 101,
+ 109, 109, 93, 109, 99, 93, 7, 8, 59, 60,
+ 87, 89, 102, 55, 144, 140, 99, 141, 7, 7,
+ 144, 109, 141, 109, 109, 91, 109, 93, 91, 93
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 75, 76, 76, 76, 76, 76, 77, 77, 77,
- 77, 77, 78, 78, 78, 79, 79, 79, 80, 80,
- 80, 80, 80, 80, 80, 81, 82, 82, 82, 82,
- 83, 83, 85, 84, 87, 86, 88, 88, 89, 89,
- 89, 90, 90, 91, 91, 91, 91, 91, 91, 91,
- 91, 91, 91, 92, 92, 92, 92, 92, 93, 92,
- 92, 95, 94, 96, 94, 94, 94, 97, 97, 98,
- 98, 98, 99, 99, 100, 100, 100, 100, 100, 101,
- 101, 102, 102, 103, 104, 103, 105, 105, 106, 106,
- 107, 107, 108, 108, 109, 109, 110, 110, 110, 110,
- 110, 111, 111, 112, 112, 113, 113, 113, 113, 113,
- 113, 114, 114, 114, 114, 114, 114, 114, 114, 115,
- 115, 115, 116, 116, 117, 117, 118, 118, 118, 119,
- 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
- 120, 120, 120, 120, 120, 120, 120, 121, 121, 121,
- 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
- 121, 122, 122, 123, 124, 124, 125, 125, 126, 126,
- 127, 128, 129, 129, 130, 131, 131, 132, 132, 133,
- 133, 133, 134, 135, 136, 137, 137, 138, 139, 140
+ 0, 76, 77, 77, 77, 77, 77, 78, 78, 78,
+ 78, 78, 79, 79, 79, 80, 80, 80, 81, 81,
+ 81, 81, 81, 81, 81, 82, 83, 83, 83, 83,
+ 84, 84, 86, 85, 88, 87, 89, 90, 90, 91,
+ 91, 91, 92, 92, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 94, 94, 94, 94, 94, 95,
+ 94, 94, 97, 96, 98, 96, 96, 96, 99, 99,
+ 100, 100, 100, 101, 101, 102, 102, 102, 102, 102,
+ 102, 103, 103, 104, 104, 105, 106, 105, 107, 107,
+ 108, 108, 109, 109, 110, 110, 111, 111, 112, 112,
+ 112, 112, 112, 113, 113, 114, 114, 115, 115, 115,
+ 115, 115, 115, 116, 116, 117, 117, 117, 117, 117,
+ 117, 118, 118, 119, 119, 119, 119, 119, 119, 119,
+ 119, 119, 119, 120, 120, 120, 121, 121, 122, 122,
+ 123, 123, 123, 124, 124, 124, 124, 124, 124, 124,
+ 124, 124, 124, 124, 125, 125, 125, 125, 125, 125,
+ 125, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 127, 127, 128, 129, 129,
+ 130, 130, 131, 131, 132, 133, 134, 134, 135, 136,
+ 136, 137, 137, 138, 138, 138, 139, 140, 141, 142,
+ 142, 143, 144, 145
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -1150,22 +1189,24 @@ static const yytype_uint8 yyr2[] =
0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
4, 4, 1, 2, 1, 1, 2, 1, 0, 1,
4, 1, 1, 1, 1, 5, 1, 1, 1, 2,
- 1, 1, 0, 7, 0, 3, 1, 1, 0, 2,
- 2, 1, 2, 2, 3, 1, 9, 6, 8, 8,
- 12, 11, 1, 2, 2, 2, 2, 3, 0, 4,
- 2, 0, 4, 0, 4, 4, 1, 0, 1, 0,
- 2, 2, 5, 4, 1, 2, 2, 1, 1, 1,
- 1, 1, 3, 0, 0, 3, 6, 9, 1, 2,
- 0, 1, 0, 2, 0, 1, 1, 3, 1, 2,
- 3, 0, 1, 0, 1, 1, 3, 1, 2, 3,
- 3, 3, 3, 3, 3, 3, 3, 5, 1, 1,
- 1, 2, 1, 1, 1, 1, 1, 1, 2, 1,
- 3, 3, 3, 3, 3, 3, 3, 2, 2, 5,
- 4, 3, 3, 3, 3, 3, 3, 1, 2, 3,
- 4, 4, 1, 1, 1, 2, 2, 1, 1, 2,
- 2, 1, 2, 4, 0, 1, 0, 2, 1, 2,
- 1, 3, 1, 2, 2, 1, 2, 1, 3, 1,
- 1, 0, 2, 2, 1, 0, 1, 1, 1, 2
+ 1, 1, 0, 7, 0, 3, 1, 1, 1, 0,
+ 2, 2, 1, 2, 2, 3, 1, 9, 6, 8,
+ 8, 12, 11, 1, 2, 2, 2, 2, 3, 0,
+ 4, 2, 0, 4, 0, 4, 4, 1, 0, 1,
+ 0, 2, 2, 5, 4, 1, 2, 2, 1, 1,
+ 1, 1, 1, 1, 3, 0, 0, 3, 6, 9,
+ 1, 2, 0, 1, 0, 2, 0, 1, 1, 3,
+ 1, 2, 3, 0, 1, 0, 1, 1, 3, 1,
+ 2, 3, 3, 0, 1, 1, 3, 1, 2, 3,
+ 3, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 5, 1, 1, 1, 2, 1, 1, 1, 1,
+ 1, 1, 2, 1, 3, 3, 3, 3, 3, 3,
+ 3, 2, 2, 5, 4, 3, 3, 3, 3, 3,
+ 3, 1, 2, 3, 4, 4, 1, 1, 1, 2,
+ 2, 1, 1, 2, 2, 1, 2, 4, 0, 1,
+ 0, 2, 1, 2, 1, 3, 1, 2, 2, 1,
+ 2, 1, 3, 1, 1, 0, 2, 2, 1, 0,
+ 1, 1, 1, 2
};
@@ -1847,7 +1888,7 @@ yyreduce:
rule = 0;
yyerrok;
}
-#line 1851 "awkgram.c" /* yacc.c:1646 */
+#line 1892 "awkgram.c" /* yacc.c:1646 */
break;
case 5:
@@ -1855,7 +1896,7 @@ yyreduce:
{
next_sourcefile();
}
-#line 1859 "awkgram.c" /* yacc.c:1646 */
+#line 1900 "awkgram.c" /* yacc.c:1646 */
break;
case 6:
@@ -1868,7 +1909,7 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 1872 "awkgram.c" /* yacc.c:1646 */
+#line 1913 "awkgram.c" /* yacc.c:1646 */
break;
case 7:
@@ -1877,7 +1918,7 @@ yyreduce:
(void) append_rule((yyvsp[-1]), (yyvsp[0]));
first_rule = false;
}
-#line 1881 "awkgram.c" /* yacc.c:1646 */
+#line 1922 "awkgram.c" /* yacc.c:1646 */
break;
case 8:
@@ -1892,7 +1933,7 @@ yyreduce:
} else /* pattern rule with non-empty pattern */
(void) append_rule((yyvsp[-1]), NULL);
}
-#line 1896 "awkgram.c" /* yacc.c:1646 */
+#line 1937 "awkgram.c" /* yacc.c:1646 */
break;
case 9:
@@ -1903,7 +1944,7 @@ yyreduce:
want_param_names = DONT_CHECK;
yyerrok;
}
-#line 1907 "awkgram.c" /* yacc.c:1646 */
+#line 1948 "awkgram.c" /* yacc.c:1646 */
break;
case 10:
@@ -1913,7 +1954,7 @@ yyreduce:
at_seen = false;
yyerrok;
}
-#line 1917 "awkgram.c" /* yacc.c:1646 */
+#line 1958 "awkgram.c" /* yacc.c:1646 */
break;
case 11:
@@ -1923,7 +1964,7 @@ yyreduce:
at_seen = false;
yyerrok;
}
-#line 1927 "awkgram.c" /* yacc.c:1646 */
+#line 1968 "awkgram.c" /* yacc.c:1646 */
break;
case 12:
@@ -1935,19 +1976,19 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1939 "awkgram.c" /* yacc.c:1646 */
+#line 1980 "awkgram.c" /* yacc.c:1646 */
break;
case 13:
#line 281 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1945 "awkgram.c" /* yacc.c:1646 */
+#line 1986 "awkgram.c" /* yacc.c:1646 */
break;
case 14:
#line 283 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1951 "awkgram.c" /* yacc.c:1646 */
+#line 1992 "awkgram.c" /* yacc.c:1646 */
break;
case 15:
@@ -1959,19 +2000,19 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1963 "awkgram.c" /* yacc.c:1646 */
+#line 2004 "awkgram.c" /* yacc.c:1646 */
break;
case 16:
#line 296 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1969 "awkgram.c" /* yacc.c:1646 */
+#line 2010 "awkgram.c" /* yacc.c:1646 */
break;
case 17:
#line 298 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1975 "awkgram.c" /* yacc.c:1646 */
+#line 2016 "awkgram.c" /* yacc.c:1646 */
break;
case 18:
@@ -1984,7 +2025,7 @@ yyreduce:
} else
(yyval) = NULL;
}
-#line 1988 "awkgram.c" /* yacc.c:1646 */
+#line 2029 "awkgram.c" /* yacc.c:1646 */
break;
case 19:
@@ -1997,7 +2038,7 @@ yyreduce:
} else
(yyval) = (yyvsp[0]);
}
-#line 2001 "awkgram.c" /* yacc.c:1646 */
+#line 2042 "awkgram.c" /* yacc.c:1646 */
break;
case 20:
@@ -2031,7 +2072,7 @@ yyreduce:
(yyval) = list_append(list_merge((yyvsp[-3]), (yyvsp[0])), tp);
rule = Rule;
}
-#line 2035 "awkgram.c" /* yacc.c:1646 */
+#line 2076 "awkgram.c" /* yacc.c:1646 */
break;
case 21:
@@ -2049,7 +2090,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2053 "awkgram.c" /* yacc.c:1646 */
+#line 2094 "awkgram.c" /* yacc.c:1646 */
break;
case 22:
@@ -2067,7 +2108,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2071 "awkgram.c" /* yacc.c:1646 */
+#line 2112 "awkgram.c" /* yacc.c:1646 */
break;
case 23:
@@ -2079,7 +2120,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2083 "awkgram.c" /* yacc.c:1646 */
+#line 2124 "awkgram.c" /* yacc.c:1646 */
break;
case 24:
@@ -2091,7 +2132,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2095 "awkgram.c" /* yacc.c:1646 */
+#line 2136 "awkgram.c" /* yacc.c:1646 */
break;
case 25:
@@ -2104,19 +2145,19 @@ yyreduce:
ip = (yyvsp[-3]);
(yyval) = ip;
}
-#line 2108 "awkgram.c" /* yacc.c:1646 */
+#line 2149 "awkgram.c" /* yacc.c:1646 */
break;
case 26:
#line 411 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2114 "awkgram.c" /* yacc.c:1646 */
+#line 2155 "awkgram.c" /* yacc.c:1646 */
break;
case 27:
#line 413 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2120 "awkgram.c" /* yacc.c:1646 */
+#line 2161 "awkgram.c" /* yacc.c:1646 */
break;
case 28:
@@ -2126,7 +2167,7 @@ yyreduce:
tokstart);
YYABORT;
}
-#line 2130 "awkgram.c" /* yacc.c:1646 */
+#line 2171 "awkgram.c" /* yacc.c:1646 */
break;
case 29:
@@ -2135,13 +2176,13 @@ yyreduce:
(yyval) = (yyvsp[0]);
at_seen = false;
}
-#line 2139 "awkgram.c" /* yacc.c:1646 */
+#line 2180 "awkgram.c" /* yacc.c:1646 */
break;
case 32:
#line 433 "awkgram.y" /* yacc.c:1646 */
{ want_param_names = FUNC_HEADER; }
-#line 2145 "awkgram.c" /* yacc.c:1646 */
+#line 2186 "awkgram.c" /* yacc.c:1646 */
break;
case 33:
@@ -2173,13 +2214,13 @@ yyreduce:
(yyval) = (yyvsp[-6]);
want_param_names = FUNC_BODY;
}
-#line 2177 "awkgram.c" /* yacc.c:1646 */
+#line 2218 "awkgram.c" /* yacc.c:1646 */
break;
case 34:
#line 469 "awkgram.y" /* yacc.c:1646 */
{ want_regexp = true; }
-#line 2183 "awkgram.c" /* yacc.c:1646 */
+#line 2224 "awkgram.c" /* yacc.c:1646 */
break;
case 35:
@@ -2212,28 +2253,52 @@ yyreduce:
(yyval)->opcode = Op_match_rec;
(yyval)->memory = n;
}
-#line 2216 "awkgram.c" /* yacc.c:1646 */
+#line 2257 "awkgram.c" /* yacc.c:1646 */
break;
case 36:
#line 503 "awkgram.y" /* yacc.c:1646 */
+ {
+ NODE *n, *exp;
+ char *re;
+ size_t len;
+
+ re = (yyvsp[0])->lextok;
+ (yyvsp[0])->lextok = NULL;
+ len = strlen(re);
+
+ exp = make_str_node(re, len, ALREADY_MALLOCED);
+ n = make_regnode(Node_typedregex, exp);
+ if (n == NULL) {
+ unref(exp);
+ YYABORT;
+ }
+ (yyval) = (yyvsp[0]);
+ (yyval)->opcode = Op_push_re;
+ (yyval)->memory = n;
+ }
+#line 2281 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 37:
+#line 525 "awkgram.y" /* yacc.c:1646 */
{ bcfree((yyvsp[0])); }
-#line 2222 "awkgram.c" /* yacc.c:1646 */
+#line 2287 "awkgram.c" /* yacc.c:1646 */
break;
- case 38:
-#line 509 "awkgram.y" /* yacc.c:1646 */
+ case 39:
+#line 531 "awkgram.y" /* yacc.c:1646 */
{
if (comment != NULL) {
(yyval) = list_create(comment);
comment = NULL;
} else (yyval) = NULL;
}
-#line 2233 "awkgram.c" /* yacc.c:1646 */
+#line 2298 "awkgram.c" /* yacc.c:1646 */
break;
- case 39:
-#line 516 "awkgram.y" /* yacc.c:1646 */
+ case 40:
+#line 538 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0]) == NULL) {
if (comment == NULL)
@@ -2261,40 +2326,40 @@ yyreduce:
}
yyerrok;
}
-#line 2265 "awkgram.c" /* yacc.c:1646 */
+#line 2330 "awkgram.c" /* yacc.c:1646 */
break;
- case 40:
-#line 544 "awkgram.y" /* yacc.c:1646 */
+ case 41:
+#line 566 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2271 "awkgram.c" /* yacc.c:1646 */
+#line 2336 "awkgram.c" /* yacc.c:1646 */
break;
- case 43:
-#line 554 "awkgram.y" /* yacc.c:1646 */
+ case 44:
+#line 576 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2277 "awkgram.c" /* yacc.c:1646 */
+#line 2342 "awkgram.c" /* yacc.c:1646 */
break;
- case 44:
-#line 556 "awkgram.y" /* yacc.c:1646 */
+ case 45:
+#line 578 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 2283 "awkgram.c" /* yacc.c:1646 */
+#line 2348 "awkgram.c" /* yacc.c:1646 */
break;
- case 45:
-#line 558 "awkgram.y" /* yacc.c:1646 */
+ case 46:
+#line 580 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2294 "awkgram.c" /* yacc.c:1646 */
+#line 2359 "awkgram.c" /* yacc.c:1646 */
break;
- case 46:
-#line 565 "awkgram.y" /* yacc.c:1646 */
+ case 47:
+#line 587 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2384,11 +2449,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2388 "awkgram.c" /* yacc.c:1646 */
+#line 2453 "awkgram.c" /* yacc.c:1646 */
break;
- case 47:
-#line 655 "awkgram.y" /* yacc.c:1646 */
+ case 48:
+#line 677 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2430,11 +2495,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2434 "awkgram.c" /* yacc.c:1646 */
+#line 2499 "awkgram.c" /* yacc.c:1646 */
break;
- case 48:
-#line 697 "awkgram.y" /* yacc.c:1646 */
+ case 49:
+#line 719 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2476,11 +2541,11 @@ yyreduce:
} /* else
$1 and $4 are NULLs */
}
-#line 2480 "awkgram.c" /* yacc.c:1646 */
+#line 2545 "awkgram.c" /* yacc.c:1646 */
break;
- case 49:
-#line 739 "awkgram.y" /* yacc.c:1646 */
+ case 50:
+#line 761 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip;
char *var_name = (yyvsp[-5])->lextok;
@@ -2593,44 +2658,44 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2597 "awkgram.c" /* yacc.c:1646 */
+#line 2662 "awkgram.c" /* yacc.c:1646 */
break;
- case 50:
-#line 852 "awkgram.y" /* yacc.c:1646 */
+ case 51:
+#line 874 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]), (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2608 "awkgram.c" /* yacc.c:1646 */
+#line 2673 "awkgram.c" /* yacc.c:1646 */
break;
- case 51:
-#line 859 "awkgram.y" /* yacc.c:1646 */
+ case 52:
+#line 881 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION *) NULL, (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2619 "awkgram.c" /* yacc.c:1646 */
+#line 2684 "awkgram.c" /* yacc.c:1646 */
break;
- case 52:
-#line 866 "awkgram.y" /* yacc.c:1646 */
+ case 53:
+#line 888 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2630 "awkgram.c" /* yacc.c:1646 */
+#line 2695 "awkgram.c" /* yacc.c:1646 */
break;
- case 53:
-#line 876 "awkgram.y" /* yacc.c:1646 */
+ case 54:
+#line 898 "awkgram.y" /* yacc.c:1646 */
{
if (! break_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2639,11 +2704,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
}
-#line 2643 "awkgram.c" /* yacc.c:1646 */
+#line 2708 "awkgram.c" /* yacc.c:1646 */
break;
- case 54:
-#line 885 "awkgram.y" /* yacc.c:1646 */
+ case 55:
+#line 907 "awkgram.y" /* yacc.c:1646 */
{
if (! continue_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2652,11 +2717,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
}
-#line 2656 "awkgram.c" /* yacc.c:1646 */
+#line 2721 "awkgram.c" /* yacc.c:1646 */
break;
- case 55:
-#line 894 "awkgram.y" /* yacc.c:1646 */
+ case 56:
+#line 916 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2665,11 +2730,11 @@ regular_loop:
(yyvsp[-1])->target_jmp = ip_rec;
(yyval) = list_create((yyvsp[-1]));
}
-#line 2669 "awkgram.c" /* yacc.c:1646 */
+#line 2734 "awkgram.c" /* yacc.c:1646 */
break;
- case 56:
-#line 903 "awkgram.y" /* yacc.c:1646 */
+ case 57:
+#line 925 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2680,11 +2745,11 @@ regular_loop:
(yyvsp[-1])->target_endfile = ip_endfile;
(yyval) = list_create((yyvsp[-1]));
}
-#line 2684 "awkgram.c" /* yacc.c:1646 */
+#line 2749 "awkgram.c" /* yacc.c:1646 */
break;
- case 57:
-#line 914 "awkgram.y" /* yacc.c:1646 */
+ case 58:
+#line 936 "awkgram.y" /* yacc.c:1646 */
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2699,20 +2764,20 @@ regular_loop:
} else
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
}
-#line 2703 "awkgram.c" /* yacc.c:1646 */
+#line 2768 "awkgram.c" /* yacc.c:1646 */
break;
- case 58:
-#line 929 "awkgram.y" /* yacc.c:1646 */
+ case 59:
+#line 951 "awkgram.y" /* yacc.c:1646 */
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2712 "awkgram.c" /* yacc.c:1646 */
+#line 2777 "awkgram.c" /* yacc.c:1646 */
break;
- case 59:
-#line 932 "awkgram.y" /* yacc.c:1646 */
+ case 60:
+#line 954 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL) {
(yyval) = list_create((yyvsp[-3]));
@@ -2733,17 +2798,17 @@ regular_loop:
(yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
}
}
-#line 2737 "awkgram.c" /* yacc.c:1646 */
+#line 2802 "awkgram.c" /* yacc.c:1646 */
break;
- case 61:
-#line 964 "awkgram.y" /* yacc.c:1646 */
+ case 62:
+#line 986 "awkgram.y" /* yacc.c:1646 */
{ in_print = true; in_parens = 0; }
-#line 2743 "awkgram.c" /* yacc.c:1646 */
+#line 2808 "awkgram.c" /* yacc.c:1646 */
break;
- case 62:
-#line 965 "awkgram.y" /* yacc.c:1646 */
+ case 63:
+#line 987 "awkgram.y" /* yacc.c:1646 */
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -2840,17 +2905,17 @@ regular_print:
}
}
}
-#line 2844 "awkgram.c" /* yacc.c:1646 */
+#line 2909 "awkgram.c" /* yacc.c:1646 */
break;
- case 63:
-#line 1062 "awkgram.y" /* yacc.c:1646 */
+ case 64:
+#line 1084 "awkgram.y" /* yacc.c:1646 */
{ sub_counter = 0; }
-#line 2850 "awkgram.c" /* yacc.c:1646 */
+#line 2915 "awkgram.c" /* yacc.c:1646 */
break;
- case 64:
-#line 1063 "awkgram.y" /* yacc.c:1646 */
+ case 65:
+#line 1085 "awkgram.y" /* yacc.c:1646 */
{
char *arr = (yyvsp[-2])->lextok;
@@ -2883,11 +2948,11 @@ regular_print:
(yyval) = list_append(list_append((yyvsp[0]), (yyvsp[-2])), (yyvsp[-3]));
}
}
-#line 2887 "awkgram.c" /* yacc.c:1646 */
+#line 2952 "awkgram.c" /* yacc.c:1646 */
break;
- case 65:
-#line 1100 "awkgram.y" /* yacc.c:1646 */
+ case 66:
+#line 1122 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
char *arr = (yyvsp[-1])->lextok;
@@ -2913,52 +2978,52 @@ regular_print:
fatal(_("`delete' is not allowed with FUNCTAB"));
}
}
-#line 2917 "awkgram.c" /* yacc.c:1646 */
+#line 2982 "awkgram.c" /* yacc.c:1646 */
break;
- case 66:
-#line 1126 "awkgram.y" /* yacc.c:1646 */
+ case 67:
+#line 1148 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = optimize_assignment((yyvsp[0])); }
-#line 2923 "awkgram.c" /* yacc.c:1646 */
+#line 2988 "awkgram.c" /* yacc.c:1646 */
break;
- case 67:
-#line 1131 "awkgram.y" /* yacc.c:1646 */
+ case 68:
+#line 1153 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2929 "awkgram.c" /* yacc.c:1646 */
+#line 2994 "awkgram.c" /* yacc.c:1646 */
break;
- case 68:
-#line 1133 "awkgram.y" /* yacc.c:1646 */
+ case 69:
+#line 1155 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2935 "awkgram.c" /* yacc.c:1646 */
+#line 3000 "awkgram.c" /* yacc.c:1646 */
break;
- case 69:
-#line 1138 "awkgram.y" /* yacc.c:1646 */
+ case 70:
+#line 1160 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2941 "awkgram.c" /* yacc.c:1646 */
+#line 3006 "awkgram.c" /* yacc.c:1646 */
break;
- case 70:
-#line 1140 "awkgram.y" /* yacc.c:1646 */
+ case 71:
+#line 1162 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL)
(yyval) = list_create((yyvsp[0]));
else
(yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
}
-#line 2952 "awkgram.c" /* yacc.c:1646 */
+#line 3017 "awkgram.c" /* yacc.c:1646 */
break;
- case 71:
-#line 1147 "awkgram.y" /* yacc.c:1646 */
+ case 72:
+#line 1169 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2958 "awkgram.c" /* yacc.c:1646 */
+#line 3023 "awkgram.c" /* yacc.c:1646 */
break;
- case 72:
-#line 1152 "awkgram.y" /* yacc.c:1646 */
+ case 73:
+#line 1174 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -2970,11 +3035,11 @@ regular_print:
bcfree((yyvsp[-2]));
(yyval) = (yyvsp[-4]);
}
-#line 2974 "awkgram.c" /* yacc.c:1646 */
+#line 3039 "awkgram.c" /* yacc.c:1646 */
break;
- case 73:
-#line 1164 "awkgram.y" /* yacc.c:1646 */
+ case 74:
+#line 1186 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -2985,17 +3050,17 @@ regular_print:
(yyvsp[-3])->case_stmt = casestmt;
(yyval) = (yyvsp[-3]);
}
-#line 2989 "awkgram.c" /* yacc.c:1646 */
+#line 3054 "awkgram.c" /* yacc.c:1646 */
break;
- case 74:
-#line 1178 "awkgram.y" /* yacc.c:1646 */
+ case 75:
+#line 1200 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2995 "awkgram.c" /* yacc.c:1646 */
+#line 3060 "awkgram.c" /* yacc.c:1646 */
break;
- case 75:
-#line 1180 "awkgram.y" /* yacc.c:1646 */
+ case 76:
+#line 1202 "awkgram.y" /* yacc.c:1646 */
{
NODE *n = (yyvsp[0])->memory;
(void) force_number(n);
@@ -3003,71 +3068,84 @@ regular_print:
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3007 "awkgram.c" /* yacc.c:1646 */
+#line 3072 "awkgram.c" /* yacc.c:1646 */
break;
- case 76:
-#line 1188 "awkgram.y" /* yacc.c:1646 */
+ case 77:
+#line 1210 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3016 "awkgram.c" /* yacc.c:1646 */
+#line 3081 "awkgram.c" /* yacc.c:1646 */
break;
- case 77:
-#line 1193 "awkgram.y" /* yacc.c:1646 */
+ case 78:
+#line 1215 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3022 "awkgram.c" /* yacc.c:1646 */
+#line 3087 "awkgram.c" /* yacc.c:1646 */
break;
- case 78:
-#line 1195 "awkgram.y" /* yacc.c:1646 */
+ case 79:
+#line 1217 "awkgram.y" /* yacc.c:1646 */
{
+ if ((yyvsp[0])->memory->type == Node_regex)
+ (yyvsp[0])->opcode = Op_push_re;
+ else
+ (yyvsp[0])->opcode = Op_push;
+ (yyval) = (yyvsp[0]);
+ }
+#line 3099 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 80:
+#line 1225 "awkgram.y" /* yacc.c:1646 */
+ {
+ assert((yyvsp[0])->memory->type == Node_typedregex);
(yyvsp[0])->opcode = Op_push_re;
(yyval) = (yyvsp[0]);
}
-#line 3031 "awkgram.c" /* yacc.c:1646 */
+#line 3109 "awkgram.c" /* yacc.c:1646 */
break;
- case 79:
-#line 1203 "awkgram.y" /* yacc.c:1646 */
+ case 81:
+#line 1234 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3037 "awkgram.c" /* yacc.c:1646 */
+#line 3115 "awkgram.c" /* yacc.c:1646 */
break;
- case 80:
-#line 1205 "awkgram.y" /* yacc.c:1646 */
+ case 82:
+#line 1236 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3043 "awkgram.c" /* yacc.c:1646 */
+#line 3121 "awkgram.c" /* yacc.c:1646 */
break;
- case 82:
-#line 1215 "awkgram.y" /* yacc.c:1646 */
+ case 84:
+#line 1246 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = (yyvsp[-1]);
}
-#line 3051 "awkgram.c" /* yacc.c:1646 */
+#line 3129 "awkgram.c" /* yacc.c:1646 */
break;
- case 83:
-#line 1222 "awkgram.y" /* yacc.c:1646 */
+ case 85:
+#line 1253 "awkgram.y" /* yacc.c:1646 */
{
in_print = false;
in_parens = 0;
(yyval) = NULL;
}
-#line 3061 "awkgram.c" /* yacc.c:1646 */
+#line 3139 "awkgram.c" /* yacc.c:1646 */
break;
- case 84:
-#line 1227 "awkgram.y" /* yacc.c:1646 */
+ case 86:
+#line 1258 "awkgram.y" /* yacc.c:1646 */
{ in_print = false; in_parens = 0; }
-#line 3067 "awkgram.c" /* yacc.c:1646 */
+#line 3145 "awkgram.c" /* yacc.c:1646 */
break;
- case 85:
-#line 1228 "awkgram.y" /* yacc.c:1646 */
+ case 87:
+#line 1259 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->redir_type == redirect_twoway
&& (yyvsp[0])->lasti->opcode == Op_K_getline_redir
@@ -3075,63 +3153,63 @@ regular_print:
yyerror(_("multistage two-way pipelines don't work"));
(yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
}
-#line 3079 "awkgram.c" /* yacc.c:1646 */
+#line 3157 "awkgram.c" /* yacc.c:1646 */
break;
- case 86:
-#line 1239 "awkgram.y" /* yacc.c:1646 */
+ case 88:
+#line 1270 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]), NULL, NULL);
}
-#line 3087 "awkgram.c" /* yacc.c:1646 */
+#line 3165 "awkgram.c" /* yacc.c:1646 */
break;
- case 87:
-#line 1244 "awkgram.y" /* yacc.c:1646 */
+ case 89:
+#line 1275 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[0]));
}
-#line 3095 "awkgram.c" /* yacc.c:1646 */
+#line 3173 "awkgram.c" /* yacc.c:1646 */
break;
- case 92:
-#line 1261 "awkgram.y" /* yacc.c:1646 */
+ case 94:
+#line 1292 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3101 "awkgram.c" /* yacc.c:1646 */
+#line 3179 "awkgram.c" /* yacc.c:1646 */
break;
- case 93:
-#line 1263 "awkgram.y" /* yacc.c:1646 */
+ case 95:
+#line 1294 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3110 "awkgram.c" /* yacc.c:1646 */
+#line 3188 "awkgram.c" /* yacc.c:1646 */
break;
- case 94:
-#line 1271 "awkgram.y" /* yacc.c:1646 */
+ case 96:
+#line 1302 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3116 "awkgram.c" /* yacc.c:1646 */
+#line 3194 "awkgram.c" /* yacc.c:1646 */
break;
- case 95:
-#line 1273 "awkgram.y" /* yacc.c:1646 */
+ case 97:
+#line 1304 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3122 "awkgram.c" /* yacc.c:1646 */
+#line 3200 "awkgram.c" /* yacc.c:1646 */
break;
- case 96:
-#line 1278 "awkgram.y" /* yacc.c:1646 */
+ case 98:
+#line 1309 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->param_count = 0;
(yyval) = list_create((yyvsp[0]));
}
-#line 3131 "awkgram.c" /* yacc.c:1646 */
+#line 3209 "awkgram.c" /* yacc.c:1646 */
break;
- case 97:
-#line 1283 "awkgram.y" /* yacc.c:1646 */
+ case 99:
+#line 1314 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2]) != NULL && (yyvsp[0]) != NULL) {
(yyvsp[0])->param_count = (yyvsp[-2])->lasti->param_count + 1;
@@ -3140,74 +3218,74 @@ regular_print:
} else
(yyval) = NULL;
}
-#line 3144 "awkgram.c" /* yacc.c:1646 */
+#line 3222 "awkgram.c" /* yacc.c:1646 */
break;
- case 98:
-#line 1292 "awkgram.y" /* yacc.c:1646 */
+ case 100:
+#line 1323 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3150 "awkgram.c" /* yacc.c:1646 */
+#line 3228 "awkgram.c" /* yacc.c:1646 */
break;
- case 99:
-#line 1294 "awkgram.y" /* yacc.c:1646 */
+ case 101:
+#line 1325 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3156 "awkgram.c" /* yacc.c:1646 */
+#line 3234 "awkgram.c" /* yacc.c:1646 */
break;
- case 100:
-#line 1296 "awkgram.y" /* yacc.c:1646 */
+ case 102:
+#line 1327 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]); }
-#line 3162 "awkgram.c" /* yacc.c:1646 */
+#line 3240 "awkgram.c" /* yacc.c:1646 */
break;
- case 101:
-#line 1302 "awkgram.y" /* yacc.c:1646 */
+ case 103:
+#line 1333 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3168 "awkgram.c" /* yacc.c:1646 */
+#line 3246 "awkgram.c" /* yacc.c:1646 */
break;
- case 102:
-#line 1304 "awkgram.y" /* yacc.c:1646 */
+ case 104:
+#line 1335 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3174 "awkgram.c" /* yacc.c:1646 */
+#line 3252 "awkgram.c" /* yacc.c:1646 */
break;
- case 103:
-#line 1309 "awkgram.y" /* yacc.c:1646 */
+ case 105:
+#line 1340 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3180 "awkgram.c" /* yacc.c:1646 */
+#line 3258 "awkgram.c" /* yacc.c:1646 */
break;
- case 104:
-#line 1311 "awkgram.y" /* yacc.c:1646 */
+ case 106:
+#line 1342 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3186 "awkgram.c" /* yacc.c:1646 */
+#line 3264 "awkgram.c" /* yacc.c:1646 */
break;
- case 105:
-#line 1316 "awkgram.y" /* yacc.c:1646 */
+ case 107:
+#line 1347 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3192 "awkgram.c" /* yacc.c:1646 */
+#line 3270 "awkgram.c" /* yacc.c:1646 */
break;
- case 106:
-#line 1318 "awkgram.y" /* yacc.c:1646 */
+ case 108:
+#line 1349 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3201 "awkgram.c" /* yacc.c:1646 */
+#line 3279 "awkgram.c" /* yacc.c:1646 */
break;
- case 107:
-#line 1323 "awkgram.y" /* yacc.c:1646 */
+ case 109:
+#line 1354 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3207 "awkgram.c" /* yacc.c:1646 */
+#line 3285 "awkgram.c" /* yacc.c:1646 */
break;
- case 108:
-#line 1325 "awkgram.y" /* yacc.c:1646 */
+ case 110:
+#line 1356 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3215,58 +3293,159 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3219 "awkgram.c" /* yacc.c:1646 */
+#line 3297 "awkgram.c" /* yacc.c:1646 */
break;
- case 109:
-#line 1333 "awkgram.y" /* yacc.c:1646 */
+ case 111:
+#line 1364 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3228 "awkgram.c" /* yacc.c:1646 */
+#line 3306 "awkgram.c" /* yacc.c:1646 */
break;
- case 110:
-#line 1338 "awkgram.y" /* yacc.c:1646 */
+ case 112:
+#line 1369 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3237 "awkgram.c" /* yacc.c:1646 */
+#line 3315 "awkgram.c" /* yacc.c:1646 */
break;
- case 111:
-#line 1347 "awkgram.y" /* yacc.c:1646 */
+ case 113:
+#line 1377 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 3321 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 114:
+#line 1379 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 3327 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 115:
+#line 1384 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
+#line 3333 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 116:
+#line 1386 "awkgram.y" /* yacc.c:1646 */
+ {
+ (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
+ yyerrok;
+ }
+#line 3342 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 117:
+#line 1391 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 3348 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 118:
+#line 1393 "awkgram.y" /* yacc.c:1646 */
+ {
+ /*
+ * Returning the expression list instead of NULL lets
+ * snode get a list of arguments that it can count.
+ */
+ (yyval) = (yyvsp[-1]);
+ }
+#line 3360 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 119:
+#line 1401 "awkgram.y" /* yacc.c:1646 */
+ {
+ /* Ditto */
+ (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
+ }
+#line 3369 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 120:
+#line 1406 "awkgram.y" /* yacc.c:1646 */
+ {
+ /* Ditto */
+ (yyval) = (yyvsp[-2]);
+ }
+#line 3378 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 121:
+#line 1413 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 3384 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 122:
+#line 1414 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = list_create((yyvsp[0])); }
+#line 3390 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 123:
+#line 1420 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint && (yyvsp[0])->lasti->opcode == Op_match_rec)
lintwarn_ln((yyvsp[-1])->source_line,
_("regular expression on right of assignment"));
(yyval) = mk_assignment((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1]));
}
-#line 3248 "awkgram.c" /* yacc.c:1646 */
+#line 3401 "awkgram.c" /* yacc.c:1646 */
break;
- case 112:
-#line 1354 "awkgram.y" /* yacc.c:1646 */
+ case 124:
+#line 1427 "awkgram.y" /* yacc.c:1646 */
+ {
+ (yyval) = mk_assignment((yyvsp[-2]), list_create((yyvsp[0])), (yyvsp[-1]));
+ }
+#line 3409 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 125:
+#line 1431 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3254 "awkgram.c" /* yacc.c:1646 */
+#line 3415 "awkgram.c" /* yacc.c:1646 */
break;
- case 113:
-#line 1356 "awkgram.y" /* yacc.c:1646 */
+ case 126:
+#line 1433 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3260 "awkgram.c" /* yacc.c:1646 */
+#line 3421 "awkgram.c" /* yacc.c:1646 */
break;
- case 114:
-#line 1358 "awkgram.y" /* yacc.c:1646 */
+ case 127:
+#line 1435 "awkgram.y" /* yacc.c:1646 */
+ {
+ if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
+ warning_ln((yyvsp[-1])->source_line,
+ _("regular expression on left of `~' or `!~' operator"));
+
+ assert((yyvsp[0])->opcode == Op_push_re
+ && (yyvsp[0])->memory->type == Node_typedregex);
+ /* RHS is @/.../ */
+ (yyvsp[-1])->memory = (yyvsp[0])->memory;
+ bcfree((yyvsp[0]));
+ (yyval) = list_append((yyvsp[-2]), (yyvsp[-1]));
+ }
+#line 3438 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 128:
+#line 1448 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
_("regular expression on left of `~' or `!~' operator"));
if ((yyvsp[0])->lasti == (yyvsp[0])->nexti && (yyvsp[0])->nexti->opcode == Op_match_rec) {
+ /* RHS is /.../ */
(yyvsp[-1])->memory = (yyvsp[0])->nexti->memory;
bcfree((yyvsp[0])->nexti); /* Op_match_rec */
bcfree((yyvsp[0])); /* Op_list */
@@ -3276,11 +3455,11 @@ regular_print:
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3280 "awkgram.c" /* yacc.c:1646 */
+#line 3459 "awkgram.c" /* yacc.c:1646 */
break;
- case 115:
-#line 1374 "awkgram.y" /* yacc.c:1646 */
+ case 129:
+#line 1465 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old)
warning_ln((yyvsp[-1])->source_line,
@@ -3290,91 +3469,91 @@ regular_print:
(yyvsp[-1])->expr_count = 1;
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
-#line 3294 "awkgram.c" /* yacc.c:1646 */
+#line 3473 "awkgram.c" /* yacc.c:1646 */
break;
- case 116:
-#line 1384 "awkgram.y" /* yacc.c:1646 */
+ case 130:
+#line 1475 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint && (yyvsp[0])->lasti->opcode == Op_match_rec)
lintwarn_ln((yyvsp[-1])->source_line,
_("regular expression on right of comparison"));
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
-#line 3305 "awkgram.c" /* yacc.c:1646 */
+#line 3484 "awkgram.c" /* yacc.c:1646 */
break;
- case 117:
-#line 1391 "awkgram.y" /* yacc.c:1646 */
+ case 131:
+#line 1482 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[-1]), (yyvsp[0])); }
-#line 3311 "awkgram.c" /* yacc.c:1646 */
+#line 3490 "awkgram.c" /* yacc.c:1646 */
break;
- case 118:
-#line 1393 "awkgram.y" /* yacc.c:1646 */
+ case 132:
+#line 1484 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3317 "awkgram.c" /* yacc.c:1646 */
+#line 3496 "awkgram.c" /* yacc.c:1646 */
break;
- case 119:
-#line 1398 "awkgram.y" /* yacc.c:1646 */
+ case 133:
+#line 1489 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3323 "awkgram.c" /* yacc.c:1646 */
+#line 3502 "awkgram.c" /* yacc.c:1646 */
break;
- case 120:
-#line 1400 "awkgram.y" /* yacc.c:1646 */
+ case 134:
+#line 1491 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3329 "awkgram.c" /* yacc.c:1646 */
+#line 3508 "awkgram.c" /* yacc.c:1646 */
break;
- case 121:
-#line 1402 "awkgram.y" /* yacc.c:1646 */
+ case 135:
+#line 1493 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[0]);
}
-#line 3338 "awkgram.c" /* yacc.c:1646 */
+#line 3517 "awkgram.c" /* yacc.c:1646 */
break;
- case 122:
-#line 1410 "awkgram.y" /* yacc.c:1646 */
+ case 136:
+#line 1501 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3344 "awkgram.c" /* yacc.c:1646 */
+#line 3523 "awkgram.c" /* yacc.c:1646 */
break;
- case 123:
-#line 1412 "awkgram.y" /* yacc.c:1646 */
+ case 137:
+#line 1503 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3350 "awkgram.c" /* yacc.c:1646 */
+#line 3529 "awkgram.c" /* yacc.c:1646 */
break;
- case 124:
-#line 1417 "awkgram.y" /* yacc.c:1646 */
+ case 138:
+#line 1508 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3356 "awkgram.c" /* yacc.c:1646 */
+#line 3535 "awkgram.c" /* yacc.c:1646 */
break;
- case 125:
-#line 1419 "awkgram.y" /* yacc.c:1646 */
+ case 139:
+#line 1510 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3362 "awkgram.c" /* yacc.c:1646 */
+#line 3541 "awkgram.c" /* yacc.c:1646 */
break;
- case 126:
-#line 1424 "awkgram.y" /* yacc.c:1646 */
+ case 140:
+#line 1515 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3368 "awkgram.c" /* yacc.c:1646 */
+#line 3547 "awkgram.c" /* yacc.c:1646 */
break;
- case 127:
-#line 1426 "awkgram.y" /* yacc.c:1646 */
+ case 141:
+#line 1517 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3374 "awkgram.c" /* yacc.c:1646 */
+#line 3553 "awkgram.c" /* yacc.c:1646 */
break;
- case 128:
-#line 1428 "awkgram.y" /* yacc.c:1646 */
+ case 142:
+#line 1519 "awkgram.y" /* yacc.c:1646 */
{
int count = 2;
bool is_simple_var = false;
@@ -3421,47 +3600,47 @@ regular_print:
max_args = count;
}
}
-#line 3425 "awkgram.c" /* yacc.c:1646 */
+#line 3604 "awkgram.c" /* yacc.c:1646 */
break;
- case 130:
-#line 1480 "awkgram.y" /* yacc.c:1646 */
+ case 144:
+#line 1571 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3431 "awkgram.c" /* yacc.c:1646 */
+#line 3610 "awkgram.c" /* yacc.c:1646 */
break;
- case 131:
-#line 1482 "awkgram.y" /* yacc.c:1646 */
+ case 145:
+#line 1573 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3437 "awkgram.c" /* yacc.c:1646 */
+#line 3616 "awkgram.c" /* yacc.c:1646 */
break;
- case 132:
-#line 1484 "awkgram.y" /* yacc.c:1646 */
+ case 146:
+#line 1575 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3443 "awkgram.c" /* yacc.c:1646 */
+#line 3622 "awkgram.c" /* yacc.c:1646 */
break;
- case 133:
-#line 1486 "awkgram.y" /* yacc.c:1646 */
+ case 147:
+#line 1577 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3449 "awkgram.c" /* yacc.c:1646 */
+#line 3628 "awkgram.c" /* yacc.c:1646 */
break;
- case 134:
-#line 1488 "awkgram.y" /* yacc.c:1646 */
+ case 148:
+#line 1579 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3455 "awkgram.c" /* yacc.c:1646 */
+#line 3634 "awkgram.c" /* yacc.c:1646 */
break;
- case 135:
-#line 1490 "awkgram.y" /* yacc.c:1646 */
+ case 149:
+#line 1581 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3461 "awkgram.c" /* yacc.c:1646 */
+#line 3640 "awkgram.c" /* yacc.c:1646 */
break;
- case 136:
-#line 1492 "awkgram.y" /* yacc.c:1646 */
+ case 150:
+#line 1583 "awkgram.y" /* yacc.c:1646 */
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3475,29 +3654,29 @@ regular_print:
_("non-redirected `getline' undefined inside END action"));
(yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), redirect_input);
}
-#line 3479 "awkgram.c" /* yacc.c:1646 */
+#line 3658 "awkgram.c" /* yacc.c:1646 */
break;
- case 137:
-#line 1506 "awkgram.y" /* yacc.c:1646 */
+ case 151:
+#line 1597 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3488 "awkgram.c" /* yacc.c:1646 */
+#line 3667 "awkgram.c" /* yacc.c:1646 */
break;
- case 138:
-#line 1511 "awkgram.y" /* yacc.c:1646 */
+ case 152:
+#line 1602 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3497 "awkgram.c" /* yacc.c:1646 */
+#line 3676 "awkgram.c" /* yacc.c:1646 */
break;
- case 139:
-#line 1516 "awkgram.y" /* yacc.c:1646 */
+ case 153:
+#line 1607 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old) {
warning_ln((yyvsp[-1])->source_line,
@@ -3517,64 +3696,64 @@ regular_print:
(yyval) = list_append(list_merge(t, (yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3521 "awkgram.c" /* yacc.c:1646 */
+#line 3700 "awkgram.c" /* yacc.c:1646 */
break;
- case 140:
-#line 1541 "awkgram.y" /* yacc.c:1646 */
+ case 154:
+#line 1632 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), (yyvsp[-2])->redir_type);
bcfree((yyvsp[-2]));
}
-#line 3530 "awkgram.c" /* yacc.c:1646 */
+#line 3709 "awkgram.c" /* yacc.c:1646 */
break;
- case 141:
-#line 1547 "awkgram.y" /* yacc.c:1646 */
+ case 155:
+#line 1638 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3536 "awkgram.c" /* yacc.c:1646 */
+#line 3715 "awkgram.c" /* yacc.c:1646 */
break;
- case 142:
-#line 1549 "awkgram.y" /* yacc.c:1646 */
+ case 156:
+#line 1640 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3542 "awkgram.c" /* yacc.c:1646 */
+#line 3721 "awkgram.c" /* yacc.c:1646 */
break;
- case 143:
-#line 1551 "awkgram.y" /* yacc.c:1646 */
+ case 157:
+#line 1642 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3548 "awkgram.c" /* yacc.c:1646 */
+#line 3727 "awkgram.c" /* yacc.c:1646 */
break;
- case 144:
-#line 1553 "awkgram.y" /* yacc.c:1646 */
+ case 158:
+#line 1644 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3554 "awkgram.c" /* yacc.c:1646 */
+#line 3733 "awkgram.c" /* yacc.c:1646 */
break;
- case 145:
-#line 1555 "awkgram.y" /* yacc.c:1646 */
+ case 159:
+#line 1646 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3560 "awkgram.c" /* yacc.c:1646 */
+#line 3739 "awkgram.c" /* yacc.c:1646 */
break;
- case 146:
-#line 1557 "awkgram.y" /* yacc.c:1646 */
+ case 160:
+#line 1648 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3566 "awkgram.c" /* yacc.c:1646 */
+#line 3745 "awkgram.c" /* yacc.c:1646 */
break;
- case 147:
-#line 1562 "awkgram.y" /* yacc.c:1646 */
+ case 161:
+#line 1653 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3574 "awkgram.c" /* yacc.c:1646 */
+#line 3753 "awkgram.c" /* yacc.c:1646 */
break;
- case 148:
-#line 1566 "awkgram.y" /* yacc.c:1646 */
+ case 162:
+#line 1657 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->opcode == Op_match_rec) {
(yyvsp[0])->opcode = Op_nomatch;
@@ -3606,37 +3785,37 @@ regular_print:
}
}
}
-#line 3610 "awkgram.c" /* yacc.c:1646 */
+#line 3789 "awkgram.c" /* yacc.c:1646 */
break;
- case 149:
-#line 1598 "awkgram.y" /* yacc.c:1646 */
+ case 163:
+#line 1689 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3616 "awkgram.c" /* yacc.c:1646 */
+#line 3795 "awkgram.c" /* yacc.c:1646 */
break;
- case 150:
-#line 1600 "awkgram.y" /* yacc.c:1646 */
+ case 164:
+#line 1691 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3626 "awkgram.c" /* yacc.c:1646 */
+#line 3805 "awkgram.c" /* yacc.c:1646 */
break;
- case 151:
-#line 1606 "awkgram.y" /* yacc.c:1646 */
+ case 165:
+#line 1697 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3636 "awkgram.c" /* yacc.c:1646 */
+#line 3815 "awkgram.c" /* yacc.c:1646 */
break;
- case 152:
-#line 1612 "awkgram.y" /* yacc.c:1646 */
+ case 166:
+#line 1703 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
@@ -3649,45 +3828,45 @@ regular_print:
if ((yyval) == NULL)
YYABORT;
}
-#line 3653 "awkgram.c" /* yacc.c:1646 */
+#line 3832 "awkgram.c" /* yacc.c:1646 */
break;
- case 155:
-#line 1627 "awkgram.y" /* yacc.c:1646 */
+ case 169:
+#line 1718 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3662 "awkgram.c" /* yacc.c:1646 */
+#line 3841 "awkgram.c" /* yacc.c:1646 */
break;
- case 156:
-#line 1632 "awkgram.y" /* yacc.c:1646 */
+ case 170:
+#line 1723 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3671 "awkgram.c" /* yacc.c:1646 */
+#line 3850 "awkgram.c" /* yacc.c:1646 */
break;
- case 157:
-#line 1637 "awkgram.y" /* yacc.c:1646 */
+ case 171:
+#line 1728 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3679 "awkgram.c" /* yacc.c:1646 */
+#line 3858 "awkgram.c" /* yacc.c:1646 */
break;
- case 158:
-#line 1641 "awkgram.y" /* yacc.c:1646 */
+ case 172:
+#line 1732 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3687 "awkgram.c" /* yacc.c:1646 */
+#line 3866 "awkgram.c" /* yacc.c:1646 */
break;
- case 159:
-#line 1645 "awkgram.y" /* yacc.c:1646 */
+ case 173:
+#line 1736 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->lasti->opcode == Op_push_i
&& ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) == 0
@@ -3702,11 +3881,11 @@ regular_print:
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
}
-#line 3706 "awkgram.c" /* yacc.c:1646 */
+#line 3885 "awkgram.c" /* yacc.c:1646 */
break;
- case 160:
-#line 1660 "awkgram.y" /* yacc.c:1646 */
+ case 174:
+#line 1751 "awkgram.y" /* yacc.c:1646 */
{
/*
* was: $$ = $2
@@ -3716,20 +3895,20 @@ regular_print:
(yyvsp[-1])->memory = make_number(0.0);
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
-#line 3720 "awkgram.c" /* yacc.c:1646 */
+#line 3899 "awkgram.c" /* yacc.c:1646 */
break;
- case 161:
-#line 1673 "awkgram.y" /* yacc.c:1646 */
+ case 175:
+#line 1764 "awkgram.y" /* yacc.c:1646 */
{
func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[0]);
}
-#line 3729 "awkgram.c" /* yacc.c:1646 */
+#line 3908 "awkgram.c" /* yacc.c:1646 */
break;
- case 162:
-#line 1678 "awkgram.y" /* yacc.c:1646 */
+ case 176:
+#line 1769 "awkgram.y" /* yacc.c:1646 */
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -3763,11 +3942,11 @@ regular_print:
(yyval) = list_prepend((yyvsp[0]), t);
at_seen = false;
}
-#line 3767 "awkgram.c" /* yacc.c:1646 */
+#line 3946 "awkgram.c" /* yacc.c:1646 */
break;
- case 163:
-#line 1715 "awkgram.y" /* yacc.c:1646 */
+ case 177:
+#line 1806 "awkgram.y" /* yacc.c:1646 */
{
NODE *n;
@@ -3792,49 +3971,49 @@ regular_print:
(yyval) = list_append(t, (yyvsp[-3]));
}
}
-#line 3796 "awkgram.c" /* yacc.c:1646 */
+#line 3975 "awkgram.c" /* yacc.c:1646 */
break;
- case 164:
-#line 1743 "awkgram.y" /* yacc.c:1646 */
+ case 178:
+#line 1834 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3802 "awkgram.c" /* yacc.c:1646 */
+#line 3981 "awkgram.c" /* yacc.c:1646 */
break;
- case 165:
-#line 1745 "awkgram.y" /* yacc.c:1646 */
+ case 179:
+#line 1836 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3808 "awkgram.c" /* yacc.c:1646 */
+#line 3987 "awkgram.c" /* yacc.c:1646 */
break;
- case 166:
-#line 1750 "awkgram.y" /* yacc.c:1646 */
+ case 180:
+#line 1841 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3814 "awkgram.c" /* yacc.c:1646 */
+#line 3993 "awkgram.c" /* yacc.c:1646 */
break;
- case 167:
-#line 1752 "awkgram.y" /* yacc.c:1646 */
+ case 181:
+#line 1843 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3820 "awkgram.c" /* yacc.c:1646 */
+#line 3999 "awkgram.c" /* yacc.c:1646 */
break;
- case 168:
-#line 1757 "awkgram.y" /* yacc.c:1646 */
+ case 182:
+#line 1848 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3826 "awkgram.c" /* yacc.c:1646 */
+#line 4005 "awkgram.c" /* yacc.c:1646 */
break;
- case 169:
-#line 1759 "awkgram.y" /* yacc.c:1646 */
+ case 183:
+#line 1850 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 3834 "awkgram.c" /* yacc.c:1646 */
+#line 4013 "awkgram.c" /* yacc.c:1646 */
break;
- case 170:
-#line 1766 "awkgram.y" /* yacc.c:1646 */
+ case 184:
+#line 1857 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
@@ -3848,11 +4027,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
(yyval) = (yyvsp[0]);
}
-#line 3852 "awkgram.c" /* yacc.c:1646 */
+#line 4031 "awkgram.c" /* yacc.c:1646 */
break;
- case 171:
-#line 1783 "awkgram.y" /* yacc.c:1646 */
+ case 185:
+#line 1874 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *t = (yyvsp[-1]);
if ((yyvsp[-1]) == NULL) {
@@ -3866,31 +4045,31 @@ regular_print:
(yyvsp[0])->sub_count = count_expressions(&t, false);
(yyval) = list_append(t, (yyvsp[0]));
}
-#line 3870 "awkgram.c" /* yacc.c:1646 */
+#line 4049 "awkgram.c" /* yacc.c:1646 */
break;
- case 172:
-#line 1800 "awkgram.y" /* yacc.c:1646 */
+ case 186:
+#line 1891 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3876 "awkgram.c" /* yacc.c:1646 */
+#line 4055 "awkgram.c" /* yacc.c:1646 */
break;
- case 173:
-#line 1802 "awkgram.y" /* yacc.c:1646 */
+ case 187:
+#line 1893 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 3884 "awkgram.c" /* yacc.c:1646 */
+#line 4063 "awkgram.c" /* yacc.c:1646 */
break;
- case 174:
-#line 1809 "awkgram.y" /* yacc.c:1646 */
+ case 188:
+#line 1900 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3890 "awkgram.c" /* yacc.c:1646 */
+#line 4069 "awkgram.c" /* yacc.c:1646 */
break;
- case 175:
-#line 1814 "awkgram.y" /* yacc.c:1646 */
+ case 189:
+#line 1905 "awkgram.y" /* yacc.c:1646 */
{
char *var_name = (yyvsp[0])->lextok;
@@ -3898,22 +4077,22 @@ regular_print:
(yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new);
(yyval) = list_create((yyvsp[0]));
}
-#line 3902 "awkgram.c" /* yacc.c:1646 */
+#line 4081 "awkgram.c" /* yacc.c:1646 */
break;
- case 176:
-#line 1822 "awkgram.y" /* yacc.c:1646 */
+ case 190:
+#line 1913 "awkgram.y" /* yacc.c:1646 */
{
char *arr = (yyvsp[-1])->lextok;
(yyvsp[-1])->memory = variable((yyvsp[-1])->source_line, arr, Node_var_new);
(yyvsp[-1])->opcode = Op_push_array;
(yyval) = list_prepend((yyvsp[0]), (yyvsp[-1]));
}
-#line 3913 "awkgram.c" /* yacc.c:1646 */
+#line 4092 "awkgram.c" /* yacc.c:1646 */
break;
- case 177:
-#line 1832 "awkgram.y" /* yacc.c:1646 */
+ case 191:
+#line 1923 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->nexti;
if (ip->opcode == Op_push
@@ -3925,73 +4104,73 @@ regular_print:
} else
(yyval) = (yyvsp[0]);
}
-#line 3929 "awkgram.c" /* yacc.c:1646 */
+#line 4108 "awkgram.c" /* yacc.c:1646 */
break;
- case 178:
-#line 1844 "awkgram.y" /* yacc.c:1646 */
+ case 192:
+#line 1935 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
if ((yyvsp[0]) != NULL)
mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3939 "awkgram.c" /* yacc.c:1646 */
+#line 4118 "awkgram.c" /* yacc.c:1646 */
break;
- case 179:
-#line 1853 "awkgram.y" /* yacc.c:1646 */
+ case 193:
+#line 1944 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
}
-#line 3947 "awkgram.c" /* yacc.c:1646 */
+#line 4126 "awkgram.c" /* yacc.c:1646 */
break;
- case 180:
-#line 1857 "awkgram.y" /* yacc.c:1646 */
+ case 194:
+#line 1948 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
}
-#line 3955 "awkgram.c" /* yacc.c:1646 */
+#line 4134 "awkgram.c" /* yacc.c:1646 */
break;
- case 181:
-#line 1860 "awkgram.y" /* yacc.c:1646 */
+ case 195:
+#line 1951 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3961 "awkgram.c" /* yacc.c:1646 */
+#line 4140 "awkgram.c" /* yacc.c:1646 */
break;
- case 183:
-#line 1868 "awkgram.y" /* yacc.c:1646 */
+ case 197:
+#line 1959 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3967 "awkgram.c" /* yacc.c:1646 */
+#line 4146 "awkgram.c" /* yacc.c:1646 */
break;
- case 184:
-#line 1872 "awkgram.y" /* yacc.c:1646 */
+ case 198:
+#line 1963 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3973 "awkgram.c" /* yacc.c:1646 */
+#line 4152 "awkgram.c" /* yacc.c:1646 */
break;
- case 187:
-#line 1881 "awkgram.y" /* yacc.c:1646 */
+ case 201:
+#line 1972 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3979 "awkgram.c" /* yacc.c:1646 */
+#line 4158 "awkgram.c" /* yacc.c:1646 */
break;
- case 188:
-#line 1885 "awkgram.y" /* yacc.c:1646 */
+ case 202:
+#line 1976 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); yyerrok; }
-#line 3985 "awkgram.c" /* yacc.c:1646 */
+#line 4164 "awkgram.c" /* yacc.c:1646 */
break;
- case 189:
-#line 1889 "awkgram.y" /* yacc.c:1646 */
+ case 203:
+#line 1980 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3991 "awkgram.c" /* yacc.c:1646 */
+#line 4170 "awkgram.c" /* yacc.c:1646 */
break;
-#line 3995 "awkgram.c" /* yacc.c:1646 */
+#line 4174 "awkgram.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4219,7 +4398,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1891 "awkgram.y" /* yacc.c:1906 */
+#line 1982 "awkgram.y" /* yacc.c:1906 */
struct token {
@@ -4345,6 +4524,7 @@ static const struct token tokentab[] = {
{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime, 0},
{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower, 0},
{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper, 0},
+{"typeof", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_typeof, 0},
{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0, 0},
{"xor", Op_builtin, LEX_BUILTIN, GAWKX, do_xor, MPF(xor)},
};
@@ -5515,6 +5695,7 @@ yylex(void)
bool inhex = false;
bool intlstr = false;
AWKNUM d;
+ bool collecting_hard_regexp = false;
#define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline)
@@ -5549,6 +5730,7 @@ yylex(void)
lexeme = lexptr;
thisline = NULL;
+collect_regexp:
if (want_regexp) {
int in_brack = 0; /* count brackets, [[:alnum:]] allowed */
int b_index = -1;
@@ -5635,7 +5817,13 @@ end_regexp:
peek);
}
}
- return lasttok = REGEXP;
+ if (collecting_hard_regexp) {
+ collecting_hard_regexp = false;
+ lasttok = HARD_REGEXP;
+ } else
+ lasttok = REGEXP;
+
+ return lasttok;
case '\n':
pushback();
yyerror(_("unterminated regexp"));
@@ -5693,6 +5881,13 @@ retry:
return lasttok = NEWLINE;
case '@':
+ c = nextc(true);
+ if (c == '/') {
+ want_regexp = true;
+ collecting_hard_regexp = true;
+ goto collect_regexp;
+ }
+ pushback();
at_seen = true;
return lasttok = '@';
@@ -6502,7 +6697,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
}
- } else if (r->builtin == do_isarray) {
+ } else if (r->builtin == do_isarray || r->builtin == do_typeof) {
arg = subn->nexti;
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
@@ -7084,7 +7279,7 @@ make_regnode(int type, NODE *exp)
n->type = type;
n->re_cnt = 1;
- if (type == Node_regex) {
+ if (type == Node_regex || type == Node_typedregex) {
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false);
if (n->re_reg == NULL) {
freenode(n);
@@ -7107,6 +7302,8 @@ mk_rexp(INSTRUCTION *list)
ip = list->nexti;
if (ip == list->lasti && ip->opcode == Op_match_rec)
ip->opcode = Op_push_re;
+ else if (ip == list->lasti && ip->opcode == Op_push_re)
+ ; /* do nothing --- @/.../ */
else {
ip = instruction(Op_push_re);
ip->memory = make_regnode(Node_dynregex, NULL);
diff --git a/awkgram.y b/awkgram.y
index 71646008..a6cade2e 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -169,7 +169,7 @@ extern double fmod(double x, double y);
%}
%token FUNC_CALL NAME REGEXP FILENAME
-%token YNUMBER YSTRING
+%token YNUMBER YSTRING HARD_REGEXP
%token RELOP IO_OUT IO_IN
%token ASSIGNOP ASSIGN MATCHOP CONCAT_OP
%token SUBSCRIPT
@@ -197,7 +197,7 @@ extern double fmod(double x, double y);
%left MATCHOP
%nonassoc RELOP '<' '>' IO_IN IO_OUT
%left CONCAT_OP
-%left YSTRING YNUMBER
+%left YSTRING YNUMBER HARD_REGEXP
%left '+' '-'
%left '*' '/' '%'
%right '!' UNARY
@@ -498,6 +498,28 @@ regexp
}
;
+hard_regexp
+ : HARD_REGEXP
+ {
+ NODE *n, *exp;
+ char *re;
+ size_t len;
+
+ re = $1->lextok;
+ $1->lextok = NULL;
+ len = strlen(re);
+
+ exp = make_str_node(re, len, ALREADY_MALLOCED);
+ n = make_regnode(Node_typedregex, exp);
+ if (n == NULL) {
+ unref(exp);
+ YYABORT;
+ }
+ $$ = $1;
+ $$->opcode = Op_push_re;
+ $$->memory = n;
+ }
+
a_slash
: '/'
{ bcfree($1); }
@@ -1193,6 +1215,15 @@ case_value
{ $$ = $1; }
| regexp
{
+ if ($1->memory->type == Node_regex)
+ $1->opcode = Op_push_re;
+ else
+ $1->opcode = Op_push;
+ $$ = $1;
+ }
+ | hard_regexp
+ {
+ assert($1->memory->type == Node_typedregex);
$1->opcode = Op_push_re;
$$ = $1;
}
@@ -1341,6 +1372,48 @@ expression_list
}
;
+opt_fcall_expression_list
+ : /* empty */
+ { $$ = NULL; }
+ | fcall_expression_list
+ { $$ = $1; }
+ ;
+
+fcall_expression_list
+ : fcall_exp
+ { $$ = mk_expression_list(NULL, $1); }
+ | fcall_expression_list comma fcall_exp
+ {
+ $$ = mk_expression_list($1, $3);
+ yyerrok;
+ }
+ | error
+ { $$ = NULL; }
+ | fcall_expression_list error
+ {
+ /*
+ * Returning the expression list instead of NULL lets
+ * snode get a list of arguments that it can count.
+ */
+ $$ = $1;
+ }
+ | fcall_expression_list error fcall_exp
+ {
+ /* Ditto */
+ $$ = mk_expression_list($1, $3);
+ }
+ | fcall_expression_list comma error
+ {
+ /* Ditto */
+ $$ = $1;
+ }
+ ;
+
+fcall_exp
+ : exp { $$ = $1; }
+ | hard_regexp { $$ = list_create($1); }
+ ;
+
/* Expressions, not including the comma operator. */
exp
: variable assign_operator exp %prec ASSIGNOP
@@ -1350,10 +1423,27 @@ exp
_("regular expression on right of assignment"));
$$ = mk_assignment($1, $3, $2);
}
+ | variable ASSIGN hard_regexp %prec ASSIGNOP
+ {
+ $$ = mk_assignment($1, list_create($3), $2);
+ }
| exp LEX_AND exp
{ $$ = mk_boolean($1, $3, $2); }
| exp LEX_OR exp
{ $$ = mk_boolean($1, $3, $2); }
+ | exp MATCHOP hard_regexp
+ {
+ if ($1->lasti->opcode == Op_match_rec)
+ warning_ln($2->source_line,
+ _("regular expression on left of `~' or `!~' operator"));
+
+ assert($3->opcode == Op_push_re
+ && $3->memory->type == Node_typedregex);
+ /* RHS is @/.../ */
+ $2->memory = $3->memory;
+ bcfree($3);
+ $$ = list_append($1, $2);
+ }
| exp MATCHOP exp
{
if ($1->lasti->opcode == Op_match_rec)
@@ -1361,6 +1451,7 @@ exp
_("regular expression on left of `~' or `!~' operator"));
if ($3->lasti == $3->nexti && $3->nexti->opcode == Op_match_rec) {
+ /* RHS is /.../ */
$2->memory = $3->nexti->memory;
bcfree($3->nexti); /* Op_match_rec */
bcfree($3); /* Op_list */
@@ -1596,13 +1687,13 @@ non_post_simp_exp
}
| '(' exp r_paren
{ $$ = $2; }
- | LEX_BUILTIN '(' opt_expression_list r_paren
+ | LEX_BUILTIN '(' opt_fcall_expression_list r_paren
{
$$ = snode($3, $1);
if ($$ == NULL)
YYABORT;
}
- | LEX_LENGTH '(' opt_expression_list r_paren
+ | LEX_LENGTH '(' opt_fcall_expression_list r_paren
{
$$ = snode($3, $1);
if ($$ == NULL)
@@ -1711,7 +1802,7 @@ func_call
;
direct_func_call
- : FUNC_CALL '(' opt_expression_list r_paren
+ : FUNC_CALL '(' opt_fcall_expression_list r_paren
{
NODE *n;
@@ -2013,6 +2104,7 @@ static const struct token tokentab[] = {
{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime, 0},
{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower, 0},
{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper, 0},
+{"typeof", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_typeof, 0},
{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0, 0},
{"xor", Op_builtin, LEX_BUILTIN, GAWKX, do_xor, MPF(xor)},
};
@@ -3183,6 +3275,7 @@ yylex(void)
bool inhex = false;
bool intlstr = false;
AWKNUM d;
+ bool collecting_hard_regexp = false;
#define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline)
@@ -3217,6 +3310,7 @@ yylex(void)
lexeme = lexptr;
thisline = NULL;
+collect_regexp:
if (want_regexp) {
int in_brack = 0; /* count brackets, [[:alnum:]] allowed */
int b_index = -1;
@@ -3303,7 +3397,13 @@ end_regexp:
peek);
}
}
- return lasttok = REGEXP;
+ if (collecting_hard_regexp) {
+ collecting_hard_regexp = false;
+ lasttok = HARD_REGEXP;
+ } else
+ lasttok = REGEXP;
+
+ return lasttok;
case '\n':
pushback();
yyerror(_("unterminated regexp"));
@@ -3361,6 +3461,13 @@ retry:
return lasttok = NEWLINE;
case '@':
+ c = nextc(true);
+ if (c == '/') {
+ want_regexp = true;
+ collecting_hard_regexp = true;
+ goto collect_regexp;
+ }
+ pushback();
at_seen = true;
return lasttok = '@';
@@ -4170,7 +4277,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
}
- } else if (r->builtin == do_isarray) {
+ } else if (r->builtin == do_isarray || r->builtin == do_typeof) {
arg = subn->nexti;
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
@@ -4752,7 +4859,7 @@ make_regnode(int type, NODE *exp)
n->type = type;
n->re_cnt = 1;
- if (type == Node_regex) {
+ if (type == Node_regex || type == Node_typedregex) {
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false);
if (n->re_reg == NULL) {
freenode(n);
@@ -4775,6 +4882,8 @@ mk_rexp(INSTRUCTION *list)
ip = list->nexti;
if (ip == list->lasti && ip->opcode == Op_match_rec)
ip->opcode = Op_push_re;
+ else if (ip == list->lasti && ip->opcode == Op_push_re)
+ ; /* do nothing --- @/.../ */
else {
ip = instruction(Op_push_re);
ip->memory = make_regnode(Node_dynregex, NULL);
diff --git a/builtin.c b/builtin.c
index a9733597..02b94ed8 100644
--- a/builtin.c
+++ b/builtin.c
@@ -481,6 +481,12 @@ do_isarray(int nargs)
{
NODE *tmp;
int ret = 1;
+ static bool warned = false;
+
+ if (do_lint && ! warned) {
+ warned = true;
+ lintwarn(_("isarray is deprecated. Use typeof() instead"));
+ }
tmp = POP();
if (tmp->type != Node_var_array) {
@@ -3139,7 +3145,8 @@ call_sub(const char *name, int nargs)
* push replace
* push $0
*/
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
lhs = r_get_field(zero, (Func_ptr *) 0, true);
@@ -3163,7 +3170,8 @@ call_sub(const char *name, int nargs)
* nargs++
* }
*/
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
PUSH(glob_flag);
@@ -3200,7 +3208,8 @@ call_match(int nargs)
/* Don't need to pop the string just to push it back ... */
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
PUSH(regex);
if (array)
@@ -3228,7 +3237,8 @@ call_split_func(const char *name, int nargs)
if (nargs >= 3) {
regex = POP_STRING();
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
} else {
if (name[0] == 's') {
regex = make_regnode(Node_regex, FS_node->var_value);
@@ -3855,6 +3865,44 @@ do_intdiv(int nargs)
return make_number((AWKNUM) 0.0);
}
+/* do_typeof --- return a string with the type of the arg */
+
+NODE *
+do_typeof(int nargs)
+{
+ NODE *arg;
+ char *res = "unknown";
+ int null_str_flags = (STRCUR|STRING|NUMCUR|NUMBER);
+
+ arg = POP();
+ switch (arg->type) {
+ case Node_var_array:
+ res = "array";
+ break;
+ case Node_typedregex:
+ res = "regexp";
+ break;
+ case Node_val:
+ case Node_var:
+ if ((arg->flags & null_str_flags) == null_str_flags)
+ res = "untyped";
+ else if ((arg->flags & STRING) != 0)
+ res = "scalar_s";
+ else if ((arg->flags & NUMBER) != 0)
+ res = "scalar_n";
+ break;
+ case Node_var_new:
+ res = "untyped";
+ break;
+ default:
+ fatal(_("typeof: unknown argument type `%s'"),
+ nodetype2str(arg->type));
+ break;
+ }
+
+ DEREF(arg);
+ return make_string(res, strlen(res));
+}
/* mbc_byte_count --- return number of bytes for corresponding numchars multibyte characters */
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 662b5b37..cb5b0cd2 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -11,6 +11,16 @@
* gawktexi.in (Bugs): Add that email should be in plain
text and not in HTML. Sigh.
+2015-05-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Add doc on conversions for strongly typed
+ regexp variables.
+
+2015-05-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Add initial documentation for strongly typed
+ regexps and for `typeof'.
+
2015-04-29 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.2: Release tar ball made.
diff --git a/doc/gawk.info b/doc/gawk.info
index 11cbac55..6a2db963 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -175,6 +175,7 @@ in (a) below. A copy of the license is included in the section entitled
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
* Records:: Controlling how data is split into
records.
@@ -3314,6 +3315,7 @@ you specify more complicated classes of strings.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.

@@ -4016,7 +4018,7 @@ No options
default.

-File: gawk.info, Node: Case-sensitivity, Next: Regexp Summary, Prev: GNU Regexp Operators, Up: Regexp
+File: gawk.info, Node: Case-sensitivity, Next: Strong Regexp Constants, Prev: GNU Regexp Operators, Up: Regexp
3.8 Case Sensitivity in Matching
================================
@@ -4090,10 +4092,77 @@ and we don't recommend it.
that 'gawk' does the right thing.

-File: gawk.info, Node: Regexp Summary, Prev: Case-sensitivity, Up: Regexp
+File: gawk.info, Node: Strong Regexp Constants, Next: Regexp Summary, Prev: Case-sensitivity, Up: Regexp
-3.9 Summary
-===========
+3.9 Strongly Typed Regexp Constants
+===================================
+
+This minor node describes a 'gawk'-specific feature.
+
+ Regexp constants ('/.../') hold a strange position in the 'awk'
+language. In most contexts, they act like an expression: '$0 ~ /.../'.
+In other contexts, they denote only a regexp to be matched. In no case
+are they really a "first class citizen" of the language. That is, you
+cannot define a scalar variable whose type is "regexp" in the same sense
+that you can define a variable to be a number or a string:
+
+ num = 42 Numeric variable
+ str = "hi" String variable
+ re = /foo/ Wrong! re is the result of $0 ~ /foo/
+
+ For a number of more advanced use cases (described later on in this
+Info file), it would be nice to have regexp constants that are "strongly
+typed"; in other words, that denote a regexp useful for matching, and
+not an expression.
+
+ 'gawk' provides this feature. A strongly typed regexp constant looks
+almost like a regular regexp constant, except that it is preceded by an
+'@' sign:
+
+ re = @/foo/ Regexp variable
+
+ Strongly typed regexp constants _cannot_ be used eveywhere that a
+regular regexp constant can, because this would make the language even
+more confusing. Instead, you may use them only in certain contexts:
+
+ * On the righthand side of the '~' and '!~' operators: 'some_var ~
+ @/foo/' (*note Regexp Usage::).
+
+ * In the 'case' part of a 'switch' statement (*note Switch
+ Statement::).
+
+ * As an argument to one of the built-in functions that accept regexp
+ constants: 'gensub()', 'gsub()', 'match()', 'patsplit()',
+ 'split()', and 'sub()' (*note String Functions::).
+
+ * As a parameter in a call to a user-defined function (*note
+ User-defined::).
+
+ * On the righthand side of an assignment to a variable: 'some_var =
+ @/foo/'. In this case, the type of 'some_var' is regexp.
+ Additionally, 'some_var' can be used with '~' and '!~', passed to
+ one of the built-in functions listed above, or passed as a
+ parameter to a user-defined function.
+
+ You may use the 'typeof()' built-in function (*note Type Functions::)
+to determine if a variable or function parameter is a regexp variable.
+
+ The true power of this feature comes from the ability to create
+variables that have regexp type. Such variables can be passed on to
+user-defined functions, without the confusing aspects of computed
+regular expressions created from strings or string constants. They may
+also be passed through indirect function calls (*note Indirect Calls::)
+onto the built-in functions that accept regexp constants.
+
+ When used in numeric conversions, strongly typed regexp variables
+convert to zero. When used in string conversions, they convert to the
+string value of the original regexp text.
+
+
+File: gawk.info, Node: Regexp Summary, Prev: Strong Regexp Constants, Up: Regexp
+
+3.10 Summary
+============
* Regular expressions describe sets of strings to be matched. In
'awk', regular expression constants are written enclosed between
@@ -4126,6 +4195,9 @@ File: gawk.info, Node: Regexp Summary, Prev: Case-sensitivity, Up: Regexp
sensitivity of regexp matching. In other 'awk' versions, use
'tolower()' or 'toupper()'.
+ * Strongly typed regexp constants ('@/.../') enable certain advanced
+ use cases to be described later on in the Info file.
+

File: gawk.info, Node: Reading Files, Next: Printing, Prev: Regexp, Up: Top
@@ -13438,14 +13510,33 @@ File: gawk.info, Node: Type Functions, Next: I18N Functions, Prev: Bitwise Fu
9.1.7 Getting Type Information
------------------------------
-'gawk' provides a single function that lets you distinguish an array
-from a scalar variable. This is necessary for writing code that
-traverses every element of an array of arrays (*note Arrays of
-Arrays::).
+'gawk' provides two functions that lets you distinguish the type of a
+variable. This is necessary for writing code that traverses every
+element of an array of arrays (*note Arrays of Arrays::), and in other
+contexts.
'isarray(X)'
Return a true value if X is an array. Otherwise, return false.
+'typeof(X)'
+ Return one of the following strings, depending upon the type of X:
+
+ '"array"'
+ X is an array.
+
+ '"regexp"'
+ X is a strongly typed regexp (*note Strong Regexp
+ Constants::).
+
+ '"scalar_n"'
+ X is a number.
+
+ '"scalar_s"'
+ X is a string.
+
+ '"untyped"'
+ X has not yet been given a type.
+
'isarray()' is meant for use in two circumstances. The first is when
traversing a multidimensional array: you can test if an element is
itself an array or not. The second is inside the body of a user-defined
@@ -13459,6 +13550,14 @@ parameter is an array or not.
that has not been previously used to 'isarray()', 'gawk' ends up
turning it into a scalar.
+ The 'typeof()' function is general; it allows you to determine if a
+variable or function parameter is a scalar, an array, or a strongly
+typed regexp.
+
+ 'isarray()' is deprecated; you should use 'typeof()' instead. You
+should replace any existing uses of 'isarray(var)' in your code with
+'typeof(var) == "array"'.
+

File: gawk.info, Node: I18N Functions, Prev: Type Functions, Up: Built-in
@@ -34743,6 +34842,8 @@ Index
* trunc-mod operation: Arithmetic Ops. (line 66)
* truth values: Truth Values. (line 6)
* type conversion: Strings And Numbers. (line 21)
+* type, of variable: Type Functions. (line 14)
+* 'typeof': Type Functions. (line 14)
* 'u' debugger command (alias for 'until'): Debugger Execution Control.
(line 82)
* unassigned array elements: Reference to Elements.
@@ -34789,6 +34890,7 @@ Index
* values, numeric: Basic Data Typing. (line 13)
* values, string: Basic Data Typing. (line 13)
* variable assignments and input files: Other Arguments. (line 26)
+* variable type: Type Functions. (line 14)
* variable typing: Typing and Comparison.
(line 9)
* variables: Other Features. (line 6)
@@ -34889,563 +34991,564 @@ Index

Tag Table:
Node: Top1200
-Node: Foreword342435
-Node: Foreword446877
-Node: Preface48409
-Ref: Preface-Footnote-151281
-Ref: Preface-Footnote-251388
-Ref: Preface-Footnote-351622
-Node: History51764
-Node: Names54117
-Ref: Names-Footnote-155211
-Node: This Manual55358
-Ref: This Manual-Footnote-161840
-Node: Conventions61940
-Node: Manual History64295
-Ref: Manual History-Footnote-167291
-Ref: Manual History-Footnote-267332
-Node: How To Contribute67406
-Node: Acknowledgments68535
-Node: Getting Started73403
-Node: Running gawk75842
-Node: One-shot77032
-Node: Read Terminal78295
-Node: Long80327
-Node: Executable Scripts81840
-Ref: Executable Scripts-Footnote-184635
-Node: Comments84738
-Node: Quoting87222
-Node: DOS Quoting92740
-Node: Sample Data Files93415
-Node: Very Simple96010
-Node: Two Rules100912
-Node: More Complex102798
-Node: Statements/Lines105661
-Ref: Statements/Lines-Footnote-1110120
-Node: Other Features110385
-Node: When111322
-Ref: When-Footnote-1113076
-Node: Intro Summary113141
-Node: Invoking Gawk114025
-Node: Command Line115539
-Node: Options116337
-Ref: Options-Footnote-1132117
-Ref: Options-Footnote-2132347
-Node: Other Arguments132372
-Node: Naming Standard Input135319
-Node: Environment Variables136412
-Node: AWKPATH Variable136970
-Ref: AWKPATH Variable-Footnote-1140381
-Ref: AWKPATH Variable-Footnote-2140426
-Node: AWKLIBPATH Variable140687
-Node: Other Environment Variables141944
-Node: Exit Status145582
-Node: Include Files146259
-Node: Loading Shared Libraries149854
-Node: Obsolete151282
-Node: Undocumented151974
-Node: Invoking Summary152271
-Node: Regexp153931
-Node: Regexp Usage155385
-Node: Escape Sequences157422
-Node: Regexp Operators163655
-Ref: Regexp Operators-Footnote-1171072
-Ref: Regexp Operators-Footnote-2171219
-Node: Bracket Expressions171317
-Ref: table-char-classes173340
-Node: Leftmost Longest176286
-Node: Computed Regexps177589
-Node: GNU Regexp Operators181016
-Node: Case-sensitivity184695
-Ref: Case-sensitivity-Footnote-1187582
-Ref: Case-sensitivity-Footnote-2187817
-Node: Regexp Summary187925
-Node: Reading Files189391
-Node: Records191554
-Node: awk split records192287
-Node: gawk split records197219
-Ref: gawk split records-Footnote-1201763
-Node: Fields201800
-Ref: Fields-Footnote-1204580
-Node: Nonconstant Fields204666
-Ref: Nonconstant Fields-Footnote-1206902
-Node: Changing Fields207106
-Node: Field Separators213036
-Node: Default Field Splitting215734
-Node: Regexp Field Splitting216852
-Node: Single Character Fields220205
-Node: Command Line Field Separator221265
-Node: Full Line Fields224483
-Ref: Full Line Fields-Footnote-1226005
-Ref: Full Line Fields-Footnote-2226051
-Node: Field Splitting Summary226152
-Node: Constant Size228226
-Node: Splitting By Content232805
-Ref: Splitting By Content-Footnote-1236776
-Node: Multiple Line236939
-Ref: Multiple Line-Footnote-1242822
-Node: Getline243001
-Node: Plain Getline245468
-Node: Getline/Variable248107
-Node: Getline/File249256
-Node: Getline/Variable/File250642
-Ref: Getline/Variable/File-Footnote-1252246
-Node: Getline/Pipe252334
-Node: Getline/Variable/Pipe255039
-Node: Getline/Coprocess256172
-Node: Getline/Variable/Coprocess257437
-Node: Getline Notes258177
-Node: Getline Summary260972
-Ref: table-getline-variants261394
-Node: Read Timeout262142
-Ref: Read Timeout-Footnote-1266049
-Node: Retrying Input266107
-Node: Command-line directories267306
-Node: Input Summary268213
-Node: Input Exercises271385
-Node: Printing272113
-Node: Print273948
-Node: Print Examples275405
-Node: Output Separators278185
-Node: OFMT280202
-Node: Printf281558
-Node: Basic Printf282343
-Node: Control Letters283917
-Node: Format Modifiers287905
-Node: Printf Examples293920
-Node: Redirection296406
-Node: Special FD303249
-Ref: Special FD-Footnote-1306417
-Node: Special Files306491
-Node: Other Inherited Files307108
-Node: Special Network308109
-Node: Special Caveats308969
-Node: Close Files And Pipes309918
-Ref: Close Files And Pipes-Footnote-1317105
-Ref: Close Files And Pipes-Footnote-2317253
-Node: Nonfatal317404
-Node: Output Summary319729
-Node: Output Exercises320951
-Node: Expressions321630
-Node: Values322818
-Node: Constants323496
-Node: Scalar Constants324187
-Ref: Scalar Constants-Footnote-1325051
-Node: Nondecimal-numbers325301
-Node: Regexp Constants328315
-Node: Using Constant Regexps328841
-Node: Variables332004
-Node: Using Variables332661
-Node: Assignment Options334572
-Node: Conversion336446
-Node: Strings And Numbers336970
-Ref: Strings And Numbers-Footnote-1340034
-Node: Locale influences conversions340143
-Ref: table-locale-affects342901
-Node: All Operators343519
-Node: Arithmetic Ops344148
-Node: Concatenation346654
-Ref: Concatenation-Footnote-1349501
-Node: Assignment Ops349608
-Ref: table-assign-ops354600
-Node: Increment Ops355913
-Node: Truth Values and Conditions359373
-Node: Truth Values360447
-Node: Typing and Comparison361495
-Node: Variable Typing362315
-Node: Comparison Operators365939
-Ref: table-relational-ops366358
-Node: POSIX String Comparison369853
-Ref: POSIX String Comparison-Footnote-1370927
-Node: Boolean Ops371066
-Ref: Boolean Ops-Footnote-1375548
-Node: Conditional Exp375640
-Node: Function Calls377376
-Node: Precedence381256
-Node: Locales384915
-Node: Expressions Summary386547
-Node: Patterns and Actions389120
-Node: Pattern Overview390240
-Node: Regexp Patterns391917
-Node: Expression Patterns392459
-Node: Ranges396240
-Node: BEGIN/END399348
-Node: Using BEGIN/END400109
-Ref: Using BEGIN/END-Footnote-1402846
-Node: I/O And BEGIN/END402952
-Node: BEGINFILE/ENDFILE405268
-Node: Empty408175
-Node: Using Shell Variables408492
-Node: Action Overview410766
-Node: Statements413091
-Node: If Statement414939
-Node: While Statement416434
-Node: Do Statement418462
-Node: For Statement419610
-Node: Switch Statement422769
-Node: Break Statement425155
-Node: Continue Statement427247
-Node: Next Statement429074
-Node: Nextfile Statement431457
-Node: Exit Statement434109
-Node: Built-in Variables436514
-Node: User-modified437647
-Ref: User-modified-Footnote-1445274
-Node: Auto-set445336
-Ref: Auto-set-Footnote-1459585
-Ref: Auto-set-Footnote-2459791
-Node: ARGC and ARGV459847
-Node: Pattern Action Summary464066
-Node: Arrays466496
-Node: Array Basics467825
-Node: Array Intro468669
-Ref: figure-array-elements470644
-Ref: Array Intro-Footnote-1473356
-Node: Reference to Elements473484
-Node: Assigning Elements475948
-Node: Array Example476439
-Node: Scanning an Array478198
-Node: Controlling Scanning481222
-Ref: Controlling Scanning-Footnote-1486621
-Node: Numeric Array Subscripts486937
-Node: Uninitialized Subscripts489121
-Node: Delete490740
-Ref: Delete-Footnote-1493492
-Node: Multidimensional493549
-Node: Multiscanning496644
-Node: Arrays of Arrays498235
-Node: Arrays Summary503003
-Node: Functions505096
-Node: Built-in506134
-Node: Calling Built-in507212
-Node: Numeric Functions509208
-Ref: Numeric Functions-Footnote-1514041
-Ref: Numeric Functions-Footnote-2514398
-Ref: Numeric Functions-Footnote-3514446
-Node: String Functions514718
-Ref: String Functions-Footnote-1538226
-Ref: String Functions-Footnote-2538355
-Ref: String Functions-Footnote-3538603
-Node: Gory Details538690
-Ref: table-sub-escapes540481
-Ref: table-sub-proposed542000
-Ref: table-posix-sub543363
-Ref: table-gensub-escapes544904
-Ref: Gory Details-Footnote-1545727
-Node: I/O Functions545878
-Ref: I/O Functions-Footnote-1553099
-Node: Time Functions553247
-Ref: Time Functions-Footnote-1563752
-Ref: Time Functions-Footnote-2563820
-Ref: Time Functions-Footnote-3563978
-Ref: Time Functions-Footnote-4564089
-Ref: Time Functions-Footnote-5564201
-Ref: Time Functions-Footnote-6564428
-Node: Bitwise Functions564694
-Ref: table-bitwise-ops565288
-Ref: Bitwise Functions-Footnote-1569596
-Node: Type Functions569769
-Node: I18N Functions570925
-Node: User-defined572576
-Node: Definition Syntax573381
-Ref: Definition Syntax-Footnote-1579068
-Node: Function Example579139
-Ref: Function Example-Footnote-1582061
-Node: Function Caveats582083
-Node: Calling A Function582601
-Node: Variable Scope583559
-Node: Pass By Value/Reference586553
-Node: Return Statement590052
-Node: Dynamic Typing593031
-Node: Indirect Calls593961
-Ref: Indirect Calls-Footnote-1604212
-Node: Functions Summary604340
-Node: Library Functions607045
-Ref: Library Functions-Footnote-1610654
-Ref: Library Functions-Footnote-2610797
-Node: Library Names610968
-Ref: Library Names-Footnote-1614429
-Ref: Library Names-Footnote-2614652
-Node: General Functions614738
-Node: Strtonum Function615841
-Node: Assert Function618863
-Node: Round Function622189
-Node: Cliff Random Function623730
-Node: Ordinal Functions624746
-Ref: Ordinal Functions-Footnote-1627809
-Ref: Ordinal Functions-Footnote-2628061
-Node: Join Function628271
-Ref: Join Function-Footnote-1630041
-Node: Getlocaltime Function630241
-Node: Readfile Function633985
-Node: Shell Quoting635959
-Node: Data File Management637360
-Node: Filetrans Function637992
-Node: Rewind Function642089
-Node: File Checking643475
-Ref: File Checking-Footnote-1644809
-Node: Empty Files645010
-Node: Ignoring Assigns646989
-Node: Getopt Function648539
-Ref: Getopt Function-Footnote-1660009
-Node: Passwd Functions660209
-Ref: Passwd Functions-Footnote-1669050
-Node: Group Functions669138
-Ref: Group Functions-Footnote-1677037
-Node: Walking Arrays677244
-Node: Library Functions Summary680254
-Node: Library Exercises681660
-Node: Sample Programs682939
-Node: Running Examples683709
-Node: Clones684437
-Node: Cut Program685661
-Node: Egrep Program695382
-Ref: Egrep Program-Footnote-1702894
-Node: Id Program703004
-Node: Split Program706684
-Ref: Split Program-Footnote-1710143
-Node: Tee Program710272
-Node: Uniq Program713062
-Node: Wc Program720488
-Ref: Wc Program-Footnote-1724743
-Node: Miscellaneous Programs724837
-Node: Dupword Program726050
-Node: Alarm Program728080
-Node: Translate Program732935
-Ref: Translate Program-Footnote-1737500
-Node: Labels Program737770
-Ref: Labels Program-Footnote-1741121
-Node: Word Sorting741205
-Node: History Sorting745277
-Node: Extract Program747112
-Node: Simple Sed754643
-Node: Igawk Program757717
-Ref: Igawk Program-Footnote-1772048
-Ref: Igawk Program-Footnote-2772250
-Ref: Igawk Program-Footnote-3772372
-Node: Anagram Program772487
-Node: Signature Program775549
-Node: Programs Summary776796
-Node: Programs Exercises778011
-Ref: Programs Exercises-Footnote-1782140
-Node: Advanced Features782231
-Node: Nondecimal Data784221
-Node: Array Sorting785812
-Node: Controlling Array Traversal786512
-Ref: Controlling Array Traversal-Footnote-1794881
-Node: Array Sorting Functions794999
-Ref: Array Sorting Functions-Footnote-1798886
-Node: Two-way I/O799082
-Ref: Two-way I/O-Footnote-1804033
-Ref: Two-way I/O-Footnote-2804220
-Node: TCP/IP Networking804302
-Node: Profiling807209
-Node: Advanced Features Summary815480
-Node: Internationalization817416
-Node: I18N and L10N818896
-Node: Explaining gettext819583
-Ref: Explaining gettext-Footnote-1824606
-Ref: Explaining gettext-Footnote-2824791
-Node: Programmer i18n824956
-Ref: Programmer i18n-Footnote-1829812
-Node: Translator i18n829861
-Node: String Extraction830655
-Ref: String Extraction-Footnote-1831788
-Node: Printf Ordering831874
-Ref: Printf Ordering-Footnote-1834660
-Node: I18N Portability834724
-Ref: I18N Portability-Footnote-1837180
-Node: I18N Example837243
-Ref: I18N Example-Footnote-1840049
-Node: Gawk I18N840122
-Node: I18N Summary840767
-Node: Debugger842108
-Node: Debugging843130
-Node: Debugging Concepts843571
-Node: Debugging Terms845380
-Node: Awk Debugging847955
-Node: Sample Debugging Session848861
-Node: Debugger Invocation849395
-Node: Finding The Bug850781
-Node: List of Debugger Commands857259
-Node: Breakpoint Control858592
-Node: Debugger Execution Control862286
-Node: Viewing And Changing Data865648
-Node: Execution Stack869022
-Node: Debugger Info870659
-Node: Miscellaneous Debugger Commands874730
-Node: Readline Support879739
-Node: Limitations880635
-Node: Debugging Summary882744
-Node: Arbitrary Precision Arithmetic883917
-Node: Computer Arithmetic885333
-Ref: table-numeric-ranges888924
-Ref: Computer Arithmetic-Footnote-1889646
-Node: Math Definitions889703
-Ref: table-ieee-formats893017
-Ref: Math Definitions-Footnote-1893620
-Node: MPFR features893725
-Node: FP Math Caution895398
-Ref: FP Math Caution-Footnote-1896470
-Node: Inexactness of computations896839
-Node: Inexact representation897799
-Node: Comparing FP Values899159
-Node: Errors accumulate900241
-Node: Getting Accuracy901674
-Node: Try To Round904384
-Node: Setting precision905283
-Ref: table-predefined-precision-strings905980
-Node: Setting the rounding mode907810
-Ref: table-gawk-rounding-modes908184
-Ref: Setting the rounding mode-Footnote-1911592
-Node: Arbitrary Precision Integers911771
-Ref: Arbitrary Precision Integers-Footnote-1916688
-Node: POSIX Floating Point Problems916837
-Ref: POSIX Floating Point Problems-Footnote-1920719
-Node: Floating point summary920757
-Node: Dynamic Extensions922947
-Node: Extension Intro924500
-Node: Plugin License925766
-Node: Extension Mechanism Outline926563
-Ref: figure-load-extension927002
-Ref: figure-register-new-function928567
-Ref: figure-call-new-function929659
-Node: Extension API Description931722
-Node: Extension API Functions Introduction933256
-Node: General Data Types938115
-Ref: General Data Types-Footnote-1944070
-Node: Memory Allocation Functions944369
-Ref: Memory Allocation Functions-Footnote-1947214
-Node: Constructor Functions947313
-Node: Registration Functions949058
-Node: Extension Functions949743
-Node: Exit Callback Functions952042
-Node: Extension Version String953292
-Node: Input Parsers953955
-Node: Output Wrappers963840
-Node: Two-way processors968352
-Node: Printing Messages970616
-Ref: Printing Messages-Footnote-1971692
-Node: Updating 'ERRNO'971845
-Node: Requesting Values972586
-Ref: table-value-types-returned973325
-Node: Accessing Parameters974208
-Node: Symbol Table Access975444
-Node: Symbol table by name975956
-Node: Symbol table by cookie977977
-Ref: Symbol table by cookie-Footnote-1982126
-Node: Cached values982190
-Ref: Cached values-Footnote-1985691
-Node: Array Manipulation985782
-Ref: Array Manipulation-Footnote-1986873
-Node: Array Data Types986910
-Ref: Array Data Types-Footnote-1989568
-Node: Array Functions989660
-Node: Flattening Arrays993519
-Node: Creating Arrays1000427
-Node: Redirection API1005199
-Node: Extension API Variables1008030
-Node: Extension Versioning1008663
-Node: Extension API Informational Variables1010554
-Node: Extension API Boilerplate1011618
-Node: Finding Extensions1015432
-Node: Extension Example1015992
-Node: Internal File Description1016790
-Node: Internal File Ops1020870
-Ref: Internal File Ops-Footnote-11032632
-Node: Using Internal File Ops1032772
-Ref: Using Internal File Ops-Footnote-11035155
-Node: Extension Samples1035430
-Node: Extension Sample File Functions1036959
-Node: Extension Sample Fnmatch1044608
-Node: Extension Sample Fork1046095
-Node: Extension Sample Inplace1047313
-Node: Extension Sample Ord1049399
-Node: Extension Sample Readdir1050235
-Ref: table-readdir-file-types1051124
-Node: Extension Sample Revout1051929
-Node: Extension Sample Rev2way1052518
-Node: Extension Sample Read write array1053258
-Node: Extension Sample Readfile1055200
-Node: Extension Sample Time1056295
-Node: Extension Sample API Tests1057643
-Node: gawkextlib1058135
-Node: Extension summary1060582
-Node: Extension Exercises1064274
-Node: Language History1065771
-Node: V7/SVR3.11067427
-Node: SVR41069580
-Node: POSIX1071014
-Node: BTL1072394
-Node: POSIX/GNU1073124
-Node: Feature History1078963
-Node: Common Extensions1092954
-Node: Ranges and Locales1094237
-Ref: Ranges and Locales-Footnote-11098853
-Ref: Ranges and Locales-Footnote-21098880
-Ref: Ranges and Locales-Footnote-31099115
-Node: Contributors1099336
-Node: History summary1104905
-Node: Installation1106285
-Node: Gawk Distribution1107230
-Node: Getting1107714
-Node: Extracting1108537
-Node: Distribution contents1110175
-Node: Unix Installation1116271
-Node: Quick Installation1116953
-Node: Shell Startup Files1119367
-Node: Additional Configuration Options1120445
-Node: Configuration Philosophy1122250
-Node: Non-Unix Installation1124620
-Node: PC Installation1125078
-Node: PC Binary Installation1126398
-Node: PC Compiling1128250
-Ref: PC Compiling-Footnote-11131274
-Node: PC Testing1131383
-Node: PC Using1132563
-Node: Cygwin1136677
-Node: MSYS1137447
-Node: VMS Installation1137948
-Node: VMS Compilation1138739
-Ref: VMS Compilation-Footnote-11139969
-Node: VMS Dynamic Extensions1140027
-Node: VMS Installation Details1141712
-Node: VMS Running1143965
-Node: VMS GNV1146806
-Node: VMS Old Gawk1147541
-Node: Bugs1148012
-Node: Other Versions1152126
-Node: Installation summary1158600
-Node: Notes1159658
-Node: Compatibility Mode1160523
-Node: Additions1161305
-Node: Accessing The Source1162230
-Node: Adding Code1163666
-Node: New Ports1169821
-Node: Derived Files1174309
-Ref: Derived Files-Footnote-11179794
-Ref: Derived Files-Footnote-21179829
-Ref: Derived Files-Footnote-31180427
-Node: Future Extensions1180541
-Node: Implementation Limitations1181199
-Node: Extension Design1182382
-Node: Old Extension Problems1183536
-Ref: Old Extension Problems-Footnote-11185054
-Node: Extension New Mechanism Goals1185111
-Ref: Extension New Mechanism Goals-Footnote-11188475
-Node: Extension Other Design Decisions1188664
-Node: Extension Future Growth1190777
-Node: Old Extension Mechanism1191613
-Node: Notes summary1193376
-Node: Basic Concepts1194558
-Node: Basic High Level1195239
-Ref: figure-general-flow1195521
-Ref: figure-process-flow1196206
-Ref: Basic High Level-Footnote-11199507
-Node: Basic Data Typing1199692
-Node: Glossary1203020
-Node: Copying1234966
-Node: GNU Free Documentation License1272505
-Node: Index1297623
+Node: Foreword342508
+Node: Foreword446950
+Node: Preface48482
+Ref: Preface-Footnote-151354
+Ref: Preface-Footnote-251461
+Ref: Preface-Footnote-351695
+Node: History51837
+Node: Names54190
+Ref: Names-Footnote-155284
+Node: This Manual55431
+Ref: This Manual-Footnote-161913
+Node: Conventions62013
+Node: Manual History64368
+Ref: Manual History-Footnote-167364
+Ref: Manual History-Footnote-267405
+Node: How To Contribute67479
+Node: Acknowledgments68608
+Node: Getting Started73476
+Node: Running gawk75915
+Node: One-shot77105
+Node: Read Terminal78368
+Node: Long80400
+Node: Executable Scripts81913
+Ref: Executable Scripts-Footnote-184708
+Node: Comments84811
+Node: Quoting87295
+Node: DOS Quoting92813
+Node: Sample Data Files93488
+Node: Very Simple96083
+Node: Two Rules100985
+Node: More Complex102871
+Node: Statements/Lines105734
+Ref: Statements/Lines-Footnote-1110193
+Node: Other Features110458
+Node: When111395
+Ref: When-Footnote-1113149
+Node: Intro Summary113214
+Node: Invoking Gawk114098
+Node: Command Line115612
+Node: Options116410
+Ref: Options-Footnote-1132190
+Ref: Options-Footnote-2132420
+Node: Other Arguments132445
+Node: Naming Standard Input135392
+Node: Environment Variables136485
+Node: AWKPATH Variable137043
+Ref: AWKPATH Variable-Footnote-1140454
+Ref: AWKPATH Variable-Footnote-2140499
+Node: AWKLIBPATH Variable140760
+Node: Other Environment Variables142017
+Node: Exit Status145655
+Node: Include Files146332
+Node: Loading Shared Libraries149927
+Node: Obsolete151355
+Node: Undocumented152047
+Node: Invoking Summary152344
+Node: Regexp154004
+Node: Regexp Usage155523
+Node: Escape Sequences157560
+Node: Regexp Operators163793
+Ref: Regexp Operators-Footnote-1171210
+Ref: Regexp Operators-Footnote-2171357
+Node: Bracket Expressions171455
+Ref: table-char-classes173478
+Node: Leftmost Longest176424
+Node: Computed Regexps177727
+Node: GNU Regexp Operators181154
+Node: Case-sensitivity184833
+Ref: Case-sensitivity-Footnote-1187729
+Ref: Case-sensitivity-Footnote-2187964
+Node: Strong Regexp Constants188072
+Node: Regexp Summary191014
+Node: Reading Files192620
+Node: Records194783
+Node: awk split records195516
+Node: gawk split records200448
+Ref: gawk split records-Footnote-1204992
+Node: Fields205029
+Ref: Fields-Footnote-1207809
+Node: Nonconstant Fields207895
+Ref: Nonconstant Fields-Footnote-1210131
+Node: Changing Fields210335
+Node: Field Separators216265
+Node: Default Field Splitting218963
+Node: Regexp Field Splitting220081
+Node: Single Character Fields223434
+Node: Command Line Field Separator224494
+Node: Full Line Fields227712
+Ref: Full Line Fields-Footnote-1229234
+Ref: Full Line Fields-Footnote-2229280
+Node: Field Splitting Summary229381
+Node: Constant Size231455
+Node: Splitting By Content236034
+Ref: Splitting By Content-Footnote-1240005
+Node: Multiple Line240168
+Ref: Multiple Line-Footnote-1246051
+Node: Getline246230
+Node: Plain Getline248697
+Node: Getline/Variable251336
+Node: Getline/File252485
+Node: Getline/Variable/File253871
+Ref: Getline/Variable/File-Footnote-1255475
+Node: Getline/Pipe255563
+Node: Getline/Variable/Pipe258268
+Node: Getline/Coprocess259401
+Node: Getline/Variable/Coprocess260666
+Node: Getline Notes261406
+Node: Getline Summary264201
+Ref: table-getline-variants264623
+Node: Read Timeout265371
+Ref: Read Timeout-Footnote-1269278
+Node: Retrying Input269336
+Node: Command-line directories270535
+Node: Input Summary271442
+Node: Input Exercises274614
+Node: Printing275342
+Node: Print277177
+Node: Print Examples278634
+Node: Output Separators281414
+Node: OFMT283431
+Node: Printf284787
+Node: Basic Printf285572
+Node: Control Letters287146
+Node: Format Modifiers291134
+Node: Printf Examples297149
+Node: Redirection299635
+Node: Special FD306478
+Ref: Special FD-Footnote-1309646
+Node: Special Files309720
+Node: Other Inherited Files310337
+Node: Special Network311338
+Node: Special Caveats312198
+Node: Close Files And Pipes313147
+Ref: Close Files And Pipes-Footnote-1320334
+Ref: Close Files And Pipes-Footnote-2320482
+Node: Nonfatal320633
+Node: Output Summary322958
+Node: Output Exercises324180
+Node: Expressions324859
+Node: Values326047
+Node: Constants326725
+Node: Scalar Constants327416
+Ref: Scalar Constants-Footnote-1328280
+Node: Nondecimal-numbers328530
+Node: Regexp Constants331544
+Node: Using Constant Regexps332070
+Node: Variables335233
+Node: Using Variables335890
+Node: Assignment Options337801
+Node: Conversion339675
+Node: Strings And Numbers340199
+Ref: Strings And Numbers-Footnote-1343263
+Node: Locale influences conversions343372
+Ref: table-locale-affects346130
+Node: All Operators346748
+Node: Arithmetic Ops347377
+Node: Concatenation349883
+Ref: Concatenation-Footnote-1352730
+Node: Assignment Ops352837
+Ref: table-assign-ops357829
+Node: Increment Ops359142
+Node: Truth Values and Conditions362602
+Node: Truth Values363676
+Node: Typing and Comparison364724
+Node: Variable Typing365544
+Node: Comparison Operators369168
+Ref: table-relational-ops369587
+Node: POSIX String Comparison373082
+Ref: POSIX String Comparison-Footnote-1374156
+Node: Boolean Ops374295
+Ref: Boolean Ops-Footnote-1378777
+Node: Conditional Exp378869
+Node: Function Calls380605
+Node: Precedence384485
+Node: Locales388144
+Node: Expressions Summary389776
+Node: Patterns and Actions392349
+Node: Pattern Overview393469
+Node: Regexp Patterns395146
+Node: Expression Patterns395688
+Node: Ranges399469
+Node: BEGIN/END402577
+Node: Using BEGIN/END403338
+Ref: Using BEGIN/END-Footnote-1406075
+Node: I/O And BEGIN/END406181
+Node: BEGINFILE/ENDFILE408497
+Node: Empty411404
+Node: Using Shell Variables411721
+Node: Action Overview413995
+Node: Statements416320
+Node: If Statement418168
+Node: While Statement419663
+Node: Do Statement421691
+Node: For Statement422839
+Node: Switch Statement425998
+Node: Break Statement428384
+Node: Continue Statement430476
+Node: Next Statement432303
+Node: Nextfile Statement434686
+Node: Exit Statement437338
+Node: Built-in Variables439743
+Node: User-modified440876
+Ref: User-modified-Footnote-1448503
+Node: Auto-set448565
+Ref: Auto-set-Footnote-1462814
+Ref: Auto-set-Footnote-2463020
+Node: ARGC and ARGV463076
+Node: Pattern Action Summary467295
+Node: Arrays469725
+Node: Array Basics471054
+Node: Array Intro471898
+Ref: figure-array-elements473873
+Ref: Array Intro-Footnote-1476585
+Node: Reference to Elements476713
+Node: Assigning Elements479177
+Node: Array Example479668
+Node: Scanning an Array481427
+Node: Controlling Scanning484451
+Ref: Controlling Scanning-Footnote-1489850
+Node: Numeric Array Subscripts490166
+Node: Uninitialized Subscripts492350
+Node: Delete493969
+Ref: Delete-Footnote-1496721
+Node: Multidimensional496778
+Node: Multiscanning499873
+Node: Arrays of Arrays501464
+Node: Arrays Summary506232
+Node: Functions508325
+Node: Built-in509363
+Node: Calling Built-in510441
+Node: Numeric Functions512437
+Ref: Numeric Functions-Footnote-1517270
+Ref: Numeric Functions-Footnote-2517627
+Ref: Numeric Functions-Footnote-3517675
+Node: String Functions517947
+Ref: String Functions-Footnote-1541455
+Ref: String Functions-Footnote-2541584
+Ref: String Functions-Footnote-3541832
+Node: Gory Details541919
+Ref: table-sub-escapes543710
+Ref: table-sub-proposed545229
+Ref: table-posix-sub546592
+Ref: table-gensub-escapes548133
+Ref: Gory Details-Footnote-1548956
+Node: I/O Functions549107
+Ref: I/O Functions-Footnote-1556328
+Node: Time Functions556476
+Ref: Time Functions-Footnote-1566981
+Ref: Time Functions-Footnote-2567049
+Ref: Time Functions-Footnote-3567207
+Ref: Time Functions-Footnote-4567318
+Ref: Time Functions-Footnote-5567430
+Ref: Time Functions-Footnote-6567657
+Node: Bitwise Functions567923
+Ref: table-bitwise-ops568517
+Ref: Bitwise Functions-Footnote-1572825
+Node: Type Functions572998
+Node: I18N Functions574860
+Node: User-defined576511
+Node: Definition Syntax577316
+Ref: Definition Syntax-Footnote-1583003
+Node: Function Example583074
+Ref: Function Example-Footnote-1585996
+Node: Function Caveats586018
+Node: Calling A Function586536
+Node: Variable Scope587494
+Node: Pass By Value/Reference590488
+Node: Return Statement593987
+Node: Dynamic Typing596966
+Node: Indirect Calls597896
+Ref: Indirect Calls-Footnote-1608147
+Node: Functions Summary608275
+Node: Library Functions610980
+Ref: Library Functions-Footnote-1614589
+Ref: Library Functions-Footnote-2614732
+Node: Library Names614903
+Ref: Library Names-Footnote-1618364
+Ref: Library Names-Footnote-2618587
+Node: General Functions618673
+Node: Strtonum Function619776
+Node: Assert Function622798
+Node: Round Function626124
+Node: Cliff Random Function627665
+Node: Ordinal Functions628681
+Ref: Ordinal Functions-Footnote-1631744
+Ref: Ordinal Functions-Footnote-2631996
+Node: Join Function632206
+Ref: Join Function-Footnote-1633976
+Node: Getlocaltime Function634176
+Node: Readfile Function637920
+Node: Shell Quoting639894
+Node: Data File Management641295
+Node: Filetrans Function641927
+Node: Rewind Function646024
+Node: File Checking647410
+Ref: File Checking-Footnote-1648744
+Node: Empty Files648945
+Node: Ignoring Assigns650924
+Node: Getopt Function652474
+Ref: Getopt Function-Footnote-1663944
+Node: Passwd Functions664144
+Ref: Passwd Functions-Footnote-1672985
+Node: Group Functions673073
+Ref: Group Functions-Footnote-1680972
+Node: Walking Arrays681179
+Node: Library Functions Summary684189
+Node: Library Exercises685595
+Node: Sample Programs686874
+Node: Running Examples687644
+Node: Clones688372
+Node: Cut Program689596
+Node: Egrep Program699317
+Ref: Egrep Program-Footnote-1706829
+Node: Id Program706939
+Node: Split Program710619
+Ref: Split Program-Footnote-1714078
+Node: Tee Program714207
+Node: Uniq Program716997
+Node: Wc Program724423
+Ref: Wc Program-Footnote-1728678
+Node: Miscellaneous Programs728772
+Node: Dupword Program729985
+Node: Alarm Program732015
+Node: Translate Program736870
+Ref: Translate Program-Footnote-1741435
+Node: Labels Program741705
+Ref: Labels Program-Footnote-1745056
+Node: Word Sorting745140
+Node: History Sorting749212
+Node: Extract Program751047
+Node: Simple Sed758578
+Node: Igawk Program761652
+Ref: Igawk Program-Footnote-1775983
+Ref: Igawk Program-Footnote-2776185
+Ref: Igawk Program-Footnote-3776307
+Node: Anagram Program776422
+Node: Signature Program779484
+Node: Programs Summary780731
+Node: Programs Exercises781946
+Ref: Programs Exercises-Footnote-1786075
+Node: Advanced Features786166
+Node: Nondecimal Data788156
+Node: Array Sorting789747
+Node: Controlling Array Traversal790447
+Ref: Controlling Array Traversal-Footnote-1798816
+Node: Array Sorting Functions798934
+Ref: Array Sorting Functions-Footnote-1802821
+Node: Two-way I/O803017
+Ref: Two-way I/O-Footnote-1807968
+Ref: Two-way I/O-Footnote-2808155
+Node: TCP/IP Networking808237
+Node: Profiling811144
+Node: Advanced Features Summary819415
+Node: Internationalization821351
+Node: I18N and L10N822831
+Node: Explaining gettext823518
+Ref: Explaining gettext-Footnote-1828541
+Ref: Explaining gettext-Footnote-2828726
+Node: Programmer i18n828891
+Ref: Programmer i18n-Footnote-1833747
+Node: Translator i18n833796
+Node: String Extraction834590
+Ref: String Extraction-Footnote-1835723
+Node: Printf Ordering835809
+Ref: Printf Ordering-Footnote-1838595
+Node: I18N Portability838659
+Ref: I18N Portability-Footnote-1841115
+Node: I18N Example841178
+Ref: I18N Example-Footnote-1843984
+Node: Gawk I18N844057
+Node: I18N Summary844702
+Node: Debugger846043
+Node: Debugging847065
+Node: Debugging Concepts847506
+Node: Debugging Terms849315
+Node: Awk Debugging851890
+Node: Sample Debugging Session852796
+Node: Debugger Invocation853330
+Node: Finding The Bug854716
+Node: List of Debugger Commands861194
+Node: Breakpoint Control862527
+Node: Debugger Execution Control866221
+Node: Viewing And Changing Data869583
+Node: Execution Stack872957
+Node: Debugger Info874594
+Node: Miscellaneous Debugger Commands878665
+Node: Readline Support883674
+Node: Limitations884570
+Node: Debugging Summary886679
+Node: Arbitrary Precision Arithmetic887852
+Node: Computer Arithmetic889268
+Ref: table-numeric-ranges892859
+Ref: Computer Arithmetic-Footnote-1893581
+Node: Math Definitions893638
+Ref: table-ieee-formats896952
+Ref: Math Definitions-Footnote-1897555
+Node: MPFR features897660
+Node: FP Math Caution899333
+Ref: FP Math Caution-Footnote-1900405
+Node: Inexactness of computations900774
+Node: Inexact representation901734
+Node: Comparing FP Values903094
+Node: Errors accumulate904176
+Node: Getting Accuracy905609
+Node: Try To Round908319
+Node: Setting precision909218
+Ref: table-predefined-precision-strings909915
+Node: Setting the rounding mode911745
+Ref: table-gawk-rounding-modes912119
+Ref: Setting the rounding mode-Footnote-1915527
+Node: Arbitrary Precision Integers915706
+Ref: Arbitrary Precision Integers-Footnote-1920623
+Node: POSIX Floating Point Problems920772
+Ref: POSIX Floating Point Problems-Footnote-1924654
+Node: Floating point summary924692
+Node: Dynamic Extensions926882
+Node: Extension Intro928435
+Node: Plugin License929701
+Node: Extension Mechanism Outline930498
+Ref: figure-load-extension930937
+Ref: figure-register-new-function932502
+Ref: figure-call-new-function933594
+Node: Extension API Description935657
+Node: Extension API Functions Introduction937191
+Node: General Data Types942050
+Ref: General Data Types-Footnote-1948005
+Node: Memory Allocation Functions948304
+Ref: Memory Allocation Functions-Footnote-1951149
+Node: Constructor Functions951248
+Node: Registration Functions952993
+Node: Extension Functions953678
+Node: Exit Callback Functions955977
+Node: Extension Version String957227
+Node: Input Parsers957890
+Node: Output Wrappers967775
+Node: Two-way processors972287
+Node: Printing Messages974551
+Ref: Printing Messages-Footnote-1975627
+Node: Updating 'ERRNO'975780
+Node: Requesting Values976521
+Ref: table-value-types-returned977260
+Node: Accessing Parameters978143
+Node: Symbol Table Access979379
+Node: Symbol table by name979891
+Node: Symbol table by cookie981912
+Ref: Symbol table by cookie-Footnote-1986061
+Node: Cached values986125
+Ref: Cached values-Footnote-1989626
+Node: Array Manipulation989717
+Ref: Array Manipulation-Footnote-1990808
+Node: Array Data Types990845
+Ref: Array Data Types-Footnote-1993503
+Node: Array Functions993595
+Node: Flattening Arrays997454
+Node: Creating Arrays1004362
+Node: Redirection API1009134
+Node: Extension API Variables1011965
+Node: Extension Versioning1012598
+Node: Extension API Informational Variables1014489
+Node: Extension API Boilerplate1015553
+Node: Finding Extensions1019367
+Node: Extension Example1019927
+Node: Internal File Description1020725
+Node: Internal File Ops1024805
+Ref: Internal File Ops-Footnote-11036567
+Node: Using Internal File Ops1036707
+Ref: Using Internal File Ops-Footnote-11039090
+Node: Extension Samples1039365
+Node: Extension Sample File Functions1040894
+Node: Extension Sample Fnmatch1048543
+Node: Extension Sample Fork1050030
+Node: Extension Sample Inplace1051248
+Node: Extension Sample Ord1053334
+Node: Extension Sample Readdir1054170
+Ref: table-readdir-file-types1055059
+Node: Extension Sample Revout1055864
+Node: Extension Sample Rev2way1056453
+Node: Extension Sample Read write array1057193
+Node: Extension Sample Readfile1059135
+Node: Extension Sample Time1060230
+Node: Extension Sample API Tests1061578
+Node: gawkextlib1062070
+Node: Extension summary1064517
+Node: Extension Exercises1068209
+Node: Language History1069706
+Node: V7/SVR3.11071362
+Node: SVR41073515
+Node: POSIX1074949
+Node: BTL1076329
+Node: POSIX/GNU1077059
+Node: Feature History1082898
+Node: Common Extensions1096889
+Node: Ranges and Locales1098172
+Ref: Ranges and Locales-Footnote-11102788
+Ref: Ranges and Locales-Footnote-21102815
+Ref: Ranges and Locales-Footnote-31103050
+Node: Contributors1103271
+Node: History summary1108840
+Node: Installation1110220
+Node: Gawk Distribution1111165
+Node: Getting1111649
+Node: Extracting1112472
+Node: Distribution contents1114110
+Node: Unix Installation1120206
+Node: Quick Installation1120888
+Node: Shell Startup Files1123302
+Node: Additional Configuration Options1124380
+Node: Configuration Philosophy1126185
+Node: Non-Unix Installation1128555
+Node: PC Installation1129013
+Node: PC Binary Installation1130333
+Node: PC Compiling1132185
+Ref: PC Compiling-Footnote-11135209
+Node: PC Testing1135318
+Node: PC Using1136498
+Node: Cygwin1140612
+Node: MSYS1141382
+Node: VMS Installation1141883
+Node: VMS Compilation1142674
+Ref: VMS Compilation-Footnote-11143904
+Node: VMS Dynamic Extensions1143962
+Node: VMS Installation Details1145647
+Node: VMS Running1147900
+Node: VMS GNV1150741
+Node: VMS Old Gawk1151476
+Node: Bugs1151947
+Node: Other Versions1156061
+Node: Installation summary1162535
+Node: Notes1163593
+Node: Compatibility Mode1164458
+Node: Additions1165240
+Node: Accessing The Source1166165
+Node: Adding Code1167601
+Node: New Ports1173756
+Node: Derived Files1178244
+Ref: Derived Files-Footnote-11183729
+Ref: Derived Files-Footnote-21183764
+Ref: Derived Files-Footnote-31184362
+Node: Future Extensions1184476
+Node: Implementation Limitations1185134
+Node: Extension Design1186317
+Node: Old Extension Problems1187471
+Ref: Old Extension Problems-Footnote-11188989
+Node: Extension New Mechanism Goals1189046
+Ref: Extension New Mechanism Goals-Footnote-11192410
+Node: Extension Other Design Decisions1192599
+Node: Extension Future Growth1194712
+Node: Old Extension Mechanism1195548
+Node: Notes summary1197311
+Node: Basic Concepts1198493
+Node: Basic High Level1199174
+Ref: figure-general-flow1199456
+Ref: figure-process-flow1200141
+Ref: Basic High Level-Footnote-11203442
+Node: Basic Data Typing1203627
+Node: Glossary1206955
+Node: Copying1238901
+Node: GNU Free Documentation License1276440
+Node: Index1301558

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 55a8fc0e..825c97b0 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -562,6 +562,7 @@ particular records in a file and perform operations upon them.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
* Records:: Controlling how data is split into
records.
@@ -5018,6 +5019,7 @@ regular expressions work, we present more complicated instances.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
@end menu
@@ -6265,6 +6267,89 @@ The value of @code{IGNORECASE} has no effect if @command{gawk} is in
compatibility mode (@pxref{Options}).
Case is always significant in compatibility mode.
+@node Strong Regexp Constants
+@section Strongly Typed Regexp Constants
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+Regexp constants (@code{/@dots{}/}) hold a strange position in the
+@command{awk} language. In most contexts, they act like an expression:
+@samp{$0 ~ /@dots{}/}. In other contexts, they denote only a regexp to
+be matched. In no case are they really a ``first class citizen'' of the
+language. That is, you cannot define a scalar variable whose type is
+``regexp'' in the same sense that you can define a variable to be a
+number or a string:
+
+@example
+num = 42 @ii{Numeric variable}
+str = "hi" @ii{String variable}
+re = /foo/ @ii{Wrong!} re @ii{is the result of} $0 ~ /foo/
+@end example
+
+For a number of more advanced use cases (described later on in this
+@value{DOCUMENT}), it would be nice to have regexp constants that
+are @dfn{strongly typed}; in other words, that denote a regexp useful
+for matching, and not an expression.
+
+@command{gawk} provides this feature. A strongly typed regexp constant
+looks almost like a regular regexp constant, except that it is preceded
+by an @samp{@@} sign:
+
+@example
+re = @@/foo/ @ii{Regexp variable}
+@end example
+
+Strongly typed regexp constants @emph{cannot} be used eveywhere that a
+regular regexp constant can, because this would make the language even more
+confusing. Instead, you may use them only in certain contexts:
+
+@itemize @bullet
+@item
+On the righthand side of the @samp{~} and @samp{!~} operators: @samp{some_var ~ @@/foo/}
+(@pxref{Regexp Usage}).
+
+@item
+In the @code{case} part of a @code{switch} statement
+(@pxref{Switch Statement}).
+
+@item
+As an argument to one of the built-in functions that accept regexp constants:
+@code{gensub()},
+@code{gsub()},
+@code{match()},
+@code{patsplit()},
+@code{split()},
+and
+@code{sub()}
+(@pxref{String Functions}).
+
+@item
+As a parameter in a call to a user-defined function
+(@pxref{User-defined}).
+
+@item
+On the righthand side of an assignment to a variable: @samp{some_var = @@/foo/}.
+In this case, the type of @code{some_var} is regexp. Additionally, @code{some_var}
+can be used with @samp{~} and @samp{!~}, passed to one of the built-in functions
+listed above, or passed as a parameter to a user-defined function.
+@end itemize
+
+You may use the @code{typeof()} built-in function
+(@pxref{Type Functions})
+to determine if a variable or function parameter is
+a regexp variable.
+
+The true power of this feature comes from the ability to create variables that
+have regexp type. Such variables can be passed on to user-defined functions,
+without the confusing aspects of computed regular expressions created from
+strings or string constants. They may also be passed through indirect function
+calls (@pxref{Indirect Calls})
+onto the built-in functions that accept regexp constants.
+
+When used in numeric conversions, strongly typed regexp variables convert
+to zero. When used in string conversions, they convert to the string
+value of the original regexp text.
+
@node Regexp Summary
@section Summary
@@ -6308,6 +6393,11 @@ treated as regular expressions).
case sensitivity of regexp matching. In other @command{awk}
versions, use @code{tolower()} or @code{toupper()}.
+@item
+Strongly typed regexp constants (@code{@@/.../}) enable
+certain advanced use cases to be described later on in the
+@value{DOCUMENT}.
+
@end itemize
@@ -19403,16 +19493,41 @@ results of the @code{compl()}, @code{lshift()}, and @code{rshift()} functions.
@node Type Functions
@subsection Getting Type Information
-@command{gawk} provides a single function that lets you distinguish
-an array from a scalar variable. This is necessary for writing code
+@command{gawk} provides two functions that lets you distinguish
+the type of a variable.
+This is necessary for writing code
that traverses every element of an array of arrays
-(@pxref{Arrays of Arrays}).
+(@pxref{Arrays of Arrays}), and in other contexts.
@table @code
@cindexgawkfunc{isarray}
@cindex scalar or array
@item isarray(@var{x})
Return a true value if @var{x} is an array. Otherwise, return false.
+
+@cindexgawkfunc{typeof}
+@cindex variable type
+@cindex type, of variable
+@item typeof(@var{x})
+Return one of the following strings, depending upon the type of @var{x}:
+
+@c nested table
+@table @code
+@item "array"
+@var{x} is an array.
+
+@item "regexp"
+@var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}).
+
+@item "scalar_n"
+@var{x} is a number.
+
+@item "scalar_s"
+@var{x} is a string.
+
+@item "untyped"
+@var{x} has not yet been given a type.
+@end table
@end table
@code{isarray()} is meant for use in two circumstances. The first is when
@@ -19430,6 +19545,14 @@ that has not been previously used to @code{isarray()}, @command{gawk}
ends up turning it into a scalar.
@end quotation
+The @code{typeof()} function is general; it allows you to determine
+if a variable or function parameter is a scalar, an array, or a strongly
+typed regexp.
+
+@code{isarray()} is deprecated; you should use @code{typeof()} instead.
+You should replace any existing uses of @samp{isarray(var)} in your
+code with @samp{typeof(var) == "array"}.
+
@node I18N Functions
@subsection String-Translation Functions
@cindex @command{gawk}, string-translation functions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 903152d9..a8af903e 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -557,6 +557,7 @@ particular records in a file and perform operations upon them.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
* Records:: Controlling how data is split into
records.
@@ -4929,6 +4930,7 @@ regular expressions work, we present more complicated instances.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
@end menu
@@ -6049,6 +6051,89 @@ The value of @code{IGNORECASE} has no effect if @command{gawk} is in
compatibility mode (@pxref{Options}).
Case is always significant in compatibility mode.
+@node Strong Regexp Constants
+@section Strongly Typed Regexp Constants
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+Regexp constants (@code{/@dots{}/}) hold a strange position in the
+@command{awk} language. In most contexts, they act like an expression:
+@samp{$0 ~ /@dots{}/}. In other contexts, they denote only a regexp to
+be matched. In no case are they really a ``first class citizen'' of the
+language. That is, you cannot define a scalar variable whose type is
+``regexp'' in the same sense that you can define a variable to be a
+number or a string:
+
+@example
+num = 42 @ii{Numeric variable}
+str = "hi" @ii{String variable}
+re = /foo/ @ii{Wrong!} re @ii{is the result of} $0 ~ /foo/
+@end example
+
+For a number of more advanced use cases (described later on in this
+@value{DOCUMENT}), it would be nice to have regexp constants that
+are @dfn{strongly typed}; in other words, that denote a regexp useful
+for matching, and not an expression.
+
+@command{gawk} provides this feature. A strongly typed regexp constant
+looks almost like a regular regexp constant, except that it is preceded
+by an @samp{@@} sign:
+
+@example
+re = @@/foo/ @ii{Regexp variable}
+@end example
+
+Strongly typed regexp constants @emph{cannot} be used eveywhere that a
+regular regexp constant can, because this would make the language even more
+confusing. Instead, you may use them only in certain contexts:
+
+@itemize @bullet
+@item
+On the righthand side of the @samp{~} and @samp{!~} operators: @samp{some_var ~ @@/foo/}
+(@pxref{Regexp Usage}).
+
+@item
+In the @code{case} part of a @code{switch} statement
+(@pxref{Switch Statement}).
+
+@item
+As an argument to one of the built-in functions that accept regexp constants:
+@code{gensub()},
+@code{gsub()},
+@code{match()},
+@code{patsplit()},
+@code{split()},
+and
+@code{sub()}
+(@pxref{String Functions}).
+
+@item
+As a parameter in a call to a user-defined function
+(@pxref{User-defined}).
+
+@item
+On the righthand side of an assignment to a variable: @samp{some_var = @@/foo/}.
+In this case, the type of @code{some_var} is regexp. Additionally, @code{some_var}
+can be used with @samp{~} and @samp{!~}, passed to one of the built-in functions
+listed above, or passed as a parameter to a user-defined function.
+@end itemize
+
+You may use the @code{typeof()} built-in function
+(@pxref{Type Functions})
+to determine if a variable or function parameter is
+a regexp variable.
+
+The true power of this feature comes from the ability to create variables that
+have regexp type. Such variables can be passed on to user-defined functions,
+without the confusing aspects of computed regular expressions created from
+strings or string constants. They may also be passed through indirect function
+calls (@pxref{Indirect Calls})
+onto the built-in functions that accept regexp constants.
+
+When used in numeric conversions, strongly typed regexp variables convert
+to zero. When used in string conversions, they convert to the string
+value of the original regexp text.
+
@node Regexp Summary
@section Summary
@@ -6092,6 +6177,11 @@ treated as regular expressions).
case sensitivity of regexp matching. In other @command{awk}
versions, use @code{tolower()} or @code{toupper()}.
+@item
+Strongly typed regexp constants (@code{@@/.../}) enable
+certain advanced use cases to be described later on in the
+@value{DOCUMENT}.
+
@end itemize
@@ -18524,16 +18614,41 @@ results of the @code{compl()}, @code{lshift()}, and @code{rshift()} functions.
@node Type Functions
@subsection Getting Type Information
-@command{gawk} provides a single function that lets you distinguish
-an array from a scalar variable. This is necessary for writing code
+@command{gawk} provides two functions that lets you distinguish
+the type of a variable.
+This is necessary for writing code
that traverses every element of an array of arrays
-(@pxref{Arrays of Arrays}).
+(@pxref{Arrays of Arrays}), and in other contexts.
@table @code
@cindexgawkfunc{isarray}
@cindex scalar or array
@item isarray(@var{x})
Return a true value if @var{x} is an array. Otherwise, return false.
+
+@cindexgawkfunc{typeof}
+@cindex variable type
+@cindex type, of variable
+@item typeof(@var{x})
+Return one of the following strings, depending upon the type of @var{x}:
+
+@c nested table
+@table @code
+@item "array"
+@var{x} is an array.
+
+@item "regexp"
+@var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}).
+
+@item "scalar_n"
+@var{x} is a number.
+
+@item "scalar_s"
+@var{x} is a string.
+
+@item "untyped"
+@var{x} has not yet been given a type.
+@end table
@end table
@code{isarray()} is meant for use in two circumstances. The first is when
@@ -18551,6 +18666,14 @@ that has not been previously used to @code{isarray()}, @command{gawk}
ends up turning it into a scalar.
@end quotation
+The @code{typeof()} function is general; it allows you to determine
+if a variable or function parameter is a scalar, an array, or a strongly
+typed regexp.
+
+@code{isarray()} is deprecated; you should use @code{typeof()} instead.
+You should replace any existing uses of @samp{isarray(var)} in your
+code with @samp{typeof(var) == "array"}.
+
@node I18N Functions
@subsection String-Translation Functions
@cindex @command{gawk}, string-translation functions
diff --git a/eval.c b/eval.c
index b50bcea8..73bd56cb 100644
--- a/eval.c
+++ b/eval.c
@@ -234,6 +234,7 @@ static const char *const nodetypes[] = {
"Node_val",
"Node_regex",
"Node_dynregex",
+ "Node_typedregex",
"Node_var",
"Node_var_array",
"Node_var_new",
@@ -1362,6 +1363,11 @@ setup_frame(INSTRUCTION *pc)
r->var_value = m;
break;
+ case Node_typedregex:
+ r->type = Node_var;
+ r->var_value = m;
+ break;
+
default:
cant_happen();
}
diff --git a/hardregex-semantics.awk b/hardregex-semantics.awk
new file mode 100644
index 00000000..fc8ba805
--- /dev/null
+++ b/hardregex-semantics.awk
@@ -0,0 +1,296 @@
+# This file describes the semantics for hard regex constants
+# As much as possible it's executable code so that it can be used
+# (or split into) test cases for development and regression testing.
+
+function simple_tests( fbre, numresult, strresult)
+{
+ # usable as case value
+ switch ("foobaaar") {
+ case @/fo+ba+r/:
+ print "switch-case: ok"
+ break
+ default:
+ print "switch-case: fail"
+ break
+ }
+
+ # usable with ~ and !~
+ if ("foobaaar" ~ @/fo+ba+r/)
+ print "match ~: ok"
+ else
+ print "match ~: fail"
+
+ if ("quasimoto" !~ @/fo+ba+r/)
+ print "match !~: ok"
+ else
+ print "match !~: fail"
+
+ # assign to variable, use in match
+ fbre = @/fo+ba+r/
+ if ("foobaaar" ~ fbre)
+ print "variable match ~: ok"
+ else
+ print "variable match ~: fail"
+
+ if ("quasimoto" !~ fbre)
+ print "variable match !~: ok"
+ else
+ print "variable match !~: fail"
+
+ # Use as numeric value, should be zero
+ numresult = fbre + 42
+ if (numresult == 42)
+ print "variable as numeric value: ok"
+ else
+ print "variable as numeric value: fail"
+
+ # Use as string value, should be string value of regexp text
+ strresult = "<" fbre ">"
+ if (strresult == "<fo+ba+r>")
+ print "variable as string value: ok"
+ else
+ print "variable as string value: fail", strresult
+
+ # typeof should work
+ if (typeof(@/fo+ba+r/) == "regexp")
+ print "typeof constant: ok"
+ else
+ print "typeof constant: fail"
+
+ if (typeof(fbre) == "regexp")
+ print "typeof variable: ok"
+ else
+ print "typeof variable: fail"
+
+ # conversion to number, works. should it be fatal?
+ fbre++
+ if (fbre == 1)
+ print "conversion to number: ok"
+ else
+ print "conversion to number: fail"
+
+ if (typeof(fbre) == "scalar_n")
+ print "typeof variable after conversion: ok"
+ else
+ print "typeof variable after conversion: fail"
+}
+
+function match_tests( fbre, fun)
+{
+ if (match("foobaaar", @/fo+ba+r/))
+ print "match(constant): ok"
+ else
+ print "match(constant): fail"
+
+ fbre = @/fo+ba+r/
+ if (match("foobaaar", fbre))
+ print "match(variable): ok"
+ else
+ print "match(variable): fail"
+
+ fun = "match"
+ if (@fun("foobaaar", @/fo+ba+r/))
+ print "match(constant) indirect: ok"
+ else
+ print "match(constant) indirect: fail"
+
+ if (@fun("foobaaar", fbre))
+ print "match(variable) indirect: ok"
+ else
+ print "match(variable) indirect: fail"
+}
+
+function sub_tests( fbre, count, target, fun)
+{
+ target = "abc foobaar def foobar ghi"
+ count = sub(@/fo+ba+r/, "XX", target)
+ if (count == 1 && target == "abc XX def foobar ghi")
+ print "sub(constant): ok"
+ else
+ print "sub(constant): fail"
+
+ fbre = @/fo+ba+r/
+ target = "abc foobaar def foobar ghi"
+ count = sub(fbre, "XX", target)
+ if (count == 1 && target == "abc XX def foobar ghi")
+ print "sub(variable): ok"
+ else
+ print "sub(variable): fail"
+
+ fun = "sub"
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(@/fo+ba+r/, "XX")
+ if (count == 1 && $0 == "abc XX def foobar ghi")
+ print "sub(constant) indirect: ok"
+ else
+ print "sub(constant) indirect: fail"
+
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(fbre, "XX")
+ if (count == 1 && $0 == "abc XX def foobar ghi")
+ print "sub(variable) indirect: ok"
+ else
+ print "sub(variable) indirect: fail"
+}
+
+function gsub_tests( fbre, count, target, fun)
+{
+ target = "abc foobaar def foobar ghi"
+ count = gsub(@/fo+ba+r/, "XX", target)
+ if (count == 2 && target == "abc XX def XX ghi")
+ print "gsub(constant): ok"
+ else
+ print "gsub(constant): fail"
+
+ fbre = @/fo+ba+r/
+ target = "abc foobaar def foobar ghi"
+ count = gsub(fbre, "XX", target)
+ if (count == 2 && target == "abc XX def XX ghi")
+ print "gsub(variable): ok"
+ else
+ print "gsub(variable): fail"
+
+ fun = "gsub"
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(@/fo+ba+r/, "XX")
+ if (count == 2 && $0 == "abc XX def XX ghi")
+ print "gsub(constant) indirect: ok"
+ else
+ print "gsub(constant) indirect: fail"
+
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(fbre, "XX")
+ if (count == 2 && $0 == "abc XX def XX ghi")
+ print "gsub(variable) indirect: ok"
+ else
+ print "gsub(variable) indirect: fail"
+}
+
+function gensub_tests( fbre, result, target, fun)
+{
+ target = "abc foobaar def foobar ghi"
+ result = gensub(@/fo+ba+r/, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(constant): ok"
+ else
+ print "gensub(constant): fail"
+
+ fbre = @/fo+ba+r/
+ target = "abc foobaar def foobar ghi"
+ result = gensub(fbre, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(variable): ok"
+ else
+ print "gensub(variable): fail"
+
+ fun = "gensub"
+ $0 = "abc foobaar def foobar ghi"
+ result = @fun(@/fo+ba+r/, "XX", "g")
+ if (result == "abc XX def XX ghi")
+ print "gensub(constant) indirect: ok"
+ else
+ print "gensub(constant) indirect: fail"
+
+ $0 = "abc foobaar def foobar ghi"
+ result = @fun(fbre, "XX", "g")
+ if (result == "abc XX def XX ghi")
+ print "gensub(variable) indirect: ok"
+ else
+ print "gensub(variable) indirect: fail"
+
+ result = @fun(@/fo+ba+r/, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(constant) indirect 2: ok"
+ else
+ print "gensub(constant) indirect 2: fail"
+
+ result = @fun(fbre, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(variable) indirect 2: ok"
+ else
+ print "gensub(variable) indirect 2: fail"
+}
+
+function split_tests( fbre, data, seps, fun, b1)
+{
+ delete data
+ delete seps
+ b1 = split("a:b:c:d", data, @/:/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(constant): ok"
+ else
+ print "split(constant): fail"
+
+ delete data
+ delete seps
+ fbre = @/:/
+ b1 = split("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(variable): ok"
+ else
+ print "split(variable): fail"
+
+ fun = "split"
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, @/:/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(constant) indirect: ok"
+ else
+ print "split(constant) indirect: fail"
+
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(variable) indirect: ok"
+ else
+ print "split(variable) indirect: fail"
+}
+
+function patsplit_tests( fbre, data, seps, fun, b1)
+{
+ delete data
+ delete seps
+ b1 = patsplit("a:b:c:d", data, @/[a-z]+/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(constant): ok"
+ else
+ print "patsplit(constant): fail"
+
+ delete data
+ delete seps
+ fbre = @/[a-z]+/
+ b1 = patsplit("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(variable): ok"
+ else
+ print "patsplit(variable): fail"
+
+ fun = "patsplit"
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, @/[a-z]+/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(constant) indirect: ok"
+ else
+ print "patsplit(constant) indirect: fail"
+
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(variable) indirect: ok"
+ else
+ print "patsplit(variable) indirect: fail"
+}
+
+BEGIN {
+ simple_tests()
+ match_tests()
+ sub_tests()
+ gsub_tests()
+ gensub_tests()
+ split_tests()
+ patsplit_tests()
+}
diff --git a/hardregex.txt b/hardregex.txt
new file mode 100644
index 00000000..557548c8
--- /dev/null
+++ b/hardregex.txt
@@ -0,0 +1,24 @@
+New variable type: "regexp", --> Node_hardregexp. (Need a better name).
+
+Syntax: @/.../
+
+Use:
+ a = @/.../ # a now has type regexp
+ a = foo(1, "bar", @/.../) # pass a regex to user defined function
+
+New function:
+ t = typeof(exp) # "array", "regexp", "scalar"
+ # Open: "scalar" vs. "scalar_s" / "scalar_n"
+
+Obsolete function:
+ isarray(exp)
+
+Conversions:
+ r = @/.../
+ s = r "" # what happens? becomes regex string?
+ s = r + 0 # what happens? treat as numeric 0?
+
+Why?
+ Allows passing regexes through user defined functions
+ Allows passing regexes through indirect funtion calls
+ In general, this is a gap in the language
diff --git a/profile.c b/profile.c
index dcc2946c..0f686768 100644
--- a/profile.c
+++ b/profile.c
@@ -32,6 +32,8 @@ static void parenthesize(int type, NODE *left, NODE *right);
static char *pp_list(int nargs, const char *paren, const char *delim);
static char *pp_group3(const char *s1, const char *s2, const char *s3);
static char *pp_concat(int nargs);
+static char *pp_string_or_strong_regex(const char *in_str, size_t len, int delim, bool strong_regex);
+static char *pp_strong_regex(const char *in_str, size_t len, int delim);
static bool is_binary(int type);
static bool is_scalar(int type);
static int prec_level(int type);
@@ -624,14 +626,17 @@ cleanup:
break;
case Op_push_re:
- if (pc->memory->type != Node_regex)
+ if (pc->memory->type != Node_regex && pc->memory->type != Node_typedregex)
break;
/* else
fall through */
case Op_match_rec:
{
NODE *re = pc->memory->re_exp;
- str = pp_string(re->stptr, re->stlen, '/');
+ if (pc->memory->type == Node_regex)
+ str = pp_string(re->stptr, re->stlen, '/');
+ else
+ str = pp_strong_regex(re->stptr, re->stlen, '/');
pp_push(pc->opcode, str, CAN_FREE);
}
break;
@@ -653,6 +658,11 @@ cleanup:
txt = t2->pp_str;
str = pp_group3(txt, op2str(pc->opcode), restr);
pp_free(t2);
+ } else if (m->type == Node_typedregex) {
+ NODE *re = m->re_exp;
+ restr = pp_strong_regex(re->stptr, re->stlen, '/');
+ str = pp_group3(txt, op2str(pc->opcode), restr);
+ efree(restr);
} else {
NODE *re = m->re_exp;
restr = pp_string(re->stptr, re->stlen, '/');
@@ -1323,11 +1333,27 @@ parenthesize(int type, NODE *left, NODE *right)
pp_parenthesize(right);
}
-/* pp_string --- pretty format a string or regex constant */
+/* pp_string --- pretty format a string or regular regex constant */
char *
pp_string(const char *in_str, size_t len, int delim)
{
+ return pp_string_or_strong_regex(in_str, len, delim, false);
+}
+
+/* pp_strong_regex --- pretty format a hard regex constant */
+
+static char *
+pp_strong_regex(const char *in_str, size_t len, int delim)
+{
+ return pp_string_or_strong_regex(in_str, len, delim, true);
+}
+
+/* pp_string_or_strong_regex --- pretty format a string, regex, or hard regex constant */
+
+char *
+pp_string_or_strong_regex(const char *in_str, size_t len, int delim, bool strong_regex)
+{
static char str_escapes[] = "\a\b\f\n\r\t\v\\";
static char str_printables[] = "abfnrtv\\";
static char re_escapes[] = "\a\b\f\n\r\t\v";
@@ -1359,11 +1385,15 @@ pp_string(const char *in_str, size_t len, int delim)
osiz *= 2; \
} ofre -= (l)
- osiz = len + 3 + 1; /* initial size; 3 for delim + terminating null */
+ /* initial size; 3 for delim + terminating null, 1 for @ */
+ osiz = len + 3 + 1 + (strong_regex == true);
emalloc(obuf, char *, osiz, "pp_string");
obufout = obuf;
ofre = osiz - 1;
+ if (strong_regex)
+ *obufout++ = '@';
+
*obufout++ = delim;
for (; len > 0; len--, str++) {
chksize(2); /* make space for 2 chars */
diff --git a/re.c b/re.c
index 39453b1c..b67a02fa 100644
--- a/re.c
+++ b/re.c
@@ -351,10 +351,14 @@ re_update(NODE *t)
/* regex was compiled with settings matching IGNORECASE */
if ((t->re_flags & CONSTANT) != 0) {
/* it's a constant, so just return it as is */
- assert(t->type == Node_regex);
+ assert(t->type == Node_regex || t->type == Node_typedregex);
return t->re_reg;
}
t1 = t->re_exp;
+ if (t1->type == Node_typedregex) {
+ assert((t1->re_flags & CONSTANT) != 0);
+ return t1->re_reg;
+ }
if (t->re_text != NULL) {
/* if contents haven't changed, just return it */
if (cmp_nodes(t->re_text, t1) == 0)
@@ -429,6 +433,15 @@ avoid_dfa(NODE *re, char *str, size_t len)
{
char *end;
+ /*
+ * f = @/.../
+ * if ("foo" ~ f) ...
+ *
+ * This creates a Node_dynregex with NULL re_reg.
+ */
+ if (re->re_reg == NULL)
+ return false;
+
if (! re->re_reg->has_anchor)
return false;
diff --git a/test/ChangeLog b/test/ChangeLog
index 4d2d0098..e1430d70 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -124,6 +124,7 @@
2015-02-27 Arnold D. Robbins <arnold@skeeve.com>
* nonfatal1.ok: Update after code changes.
+ * id.ok: Updated after code change.
2015-02-26 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/test/id.ok b/test/id.ok
index bd26b473..145869f1 100644
--- a/test/id.ok
+++ b/test/id.ok
@@ -45,6 +45,7 @@ BINMODE -> scalar
sin -> builtin
asorti -> builtin
FIELDWIDTHS -> scalar
+typeof -> builtin
function1 -> user
FILENAME -> scalar
close -> builtin
diff --git a/x.awk b/x.awk
new file mode 100644
index 00000000..c301030e
--- /dev/null
+++ b/x.awk
@@ -0,0 +1,9 @@
+BEGIN {
+ a = 5 ; print typeof(a)
+ print typeof(b)
+ print typeof(@/foo/)
+ c = "foo" ; print typeof(c)
+ d[1] = 1 ; print typeof(d), typeof(d[1])
+ e = @/foo/ ; print typeof(e)
+ print typeof(@/bar/)
+}
diff --git a/y.awk b/y.awk
new file mode 100644
index 00000000..820e321e
--- /dev/null
+++ b/y.awk
@@ -0,0 +1 @@
+BEGIN { f = "foo" ; sub(@/f/, "q", f); print f }
diff --git a/z.awk b/z.awk
new file mode 100644
index 00000000..5df943c8
--- /dev/null
+++ b/z.awk
@@ -0,0 +1 @@
+BEGIN { f = "foo" ; p = @/o/ ; gsub(p, "q", f); print f }
diff --git a/z2.awk b/z2.awk
new file mode 100644
index 00000000..0a597b22
--- /dev/null
+++ b/z2.awk
@@ -0,0 +1,8 @@
+BEGIN {
+ f = "foo"
+ p = @/o/
+// gsub(p, "q", f)
+ fun = "gsub"
+ @fun(p, "q", f)
+ print f
+}
diff --git a/z3.awk b/z3.awk
new file mode 100644
index 00000000..408f5259
--- /dev/null
+++ b/z3.awk
@@ -0,0 +1,19 @@
+function testit(count, re, repl, fun, bi, n1, n2)
+{
+ $0 = "foo"
+ n1 = gsub(re, repl)
+ bi = $0
+
+ $0 = "foo"
+ fun = "gsub"
+ n2 = @fun(re, repl)
+ printf("%d: n1 = %d, bi -> %s, n2 = %d, indirect -> %s\n",
+ count, n1, bi, n2, $0)
+}
+
+BEGIN {
+ testit(1, @/o/, "q")
+ p = @/o/
+stopme()
+ testit(2, p, "q")
+}