aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-01-05 21:39:18 +0200
committerArnold D. Robbins <arnold@skeeve.com>2022-01-05 21:39:18 +0200
commit8cde2e44a252ac2d80ec3f539d9c2157e8aea33e (patch)
tree66f4829c40c7b5bce3c530e9b91e9985afcc898b
parentb52237743955ece2c890aeb0959c03e70e3175e3 (diff)
parent7388d79e02299193e991b6714c3b3c5314191154 (diff)
downloadegawk-8cde2e44a252ac2d80ec3f539d9c2157e8aea33e.tar.gz
egawk-8cde2e44a252ac2d80ec3f539d9c2157e8aea33e.tar.bz2
egawk-8cde2e44a252ac2d80ec3f539d9c2157e8aea33e.zip
Merge branch 'master' into feature/readall
-rw-r--r--ChangeLog13
-rw-r--r--awkgram.c904
-rw-r--r--awkgram.y60
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.info644
-rw-r--r--doc/gawk.texi6
-rw-r--r--doc/gawktexi.in6
-rw-r--r--pc/ChangeLog2
-rw-r--r--pc/Makefile.tst7
-rw-r--r--symbol.c5
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/nsidentifier.awk36
-rw-r--r--test/nsidentifier.ok118
16 files changed, 1054 insertions, 775 deletions
diff --git a/ChangeLog b/ChangeLog
index 06e1eb42..ebc22d9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (change_namespace): New function. Extracted from
+ set_namespace.
+ (want_namespace): New variable.
+ [grammar]: Add explanatory comment about the change.
+ (yylex): Change the namespace immediately from the lexer.
+ (set_namespace): Adjust code.
+ * symbol.c (load_symbols): Strip off leading awk:: so that
+ PROCINFO["identifiers"] is like SYMTAB and FUNCTAB. This makes
+ the code match the documentation. Thanks to John Naman
+ <gawker@703n.com> for the bug report.
+
2021-12-17 Yuri Gribov <tetra2005@gmail.com>
Make a number of functions and variables static.
diff --git a/awkgram.c b/awkgram.c
index 7bd2f18b..9507bb8a 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -102,6 +102,7 @@ static void dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t
static bool include_source(INSTRUCTION *file, void **srcfile_p);
static bool load_library(INSTRUCTION *file, void **srcfile_p);
static void set_namespace(INSTRUCTION *ns, INSTRUCTION *comment);
+static void change_namespace(const char *new_namespace);
static void next_sourcefile(void);
static char *tokexpand(void);
static NODE *set_profile_text(NODE *n, const char *str, size_t len);
@@ -157,6 +158,7 @@ static void add_sign_to_num(NODE *n, char sign);
static bool at_seen = false;
static bool want_source = false;
+static bool want_namespace = false;
static bool want_regexp = false; /* lexical scanning kludge */
static enum {
FUNC_HEADER,
@@ -233,7 +235,7 @@ extern double fmod(double x, double y);
#define YYSTYPE INSTRUCTION *
-#line 237 "awkgram.c"
+#line 239 "awkgram.c"
# ifndef YY_CAST
# ifdef __cplusplus
@@ -954,27 +956,27 @@ static const yytype_int8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
- 0, 233, 233, 234, 239, 249, 253, 265, 273, 287,
- 298, 308, 318, 331, 341, 343, 348, 358, 360, 365,
- 367, 369, 375, 379, 384, 414, 426, 438, 444, 453,
- 471, 472, 483, 489, 497, 498, 502, 502, 536, 535,
- 569, 584, 586, 591, 592, 612, 617, 618, 622, 633,
- 638, 645, 753, 804, 854, 980, 1002, 1023, 1033, 1043,
- 1053, 1064, 1077, 1095, 1094, 1111, 1129, 1129, 1231, 1231,
- 1264, 1294, 1302, 1303, 1309, 1310, 1317, 1322, 1335, 1350,
- 1352, 1360, 1367, 1369, 1377, 1386, 1388, 1397, 1398, 1406,
- 1411, 1411, 1424, 1431, 1444, 1448, 1470, 1471, 1477, 1478,
- 1487, 1488, 1493, 1498, 1515, 1517, 1519, 1526, 1527, 1533,
- 1534, 1539, 1541, 1548, 1550, 1558, 1563, 1574, 1575, 1580,
- 1582, 1589, 1591, 1599, 1604, 1614, 1615, 1620, 1621, 1626,
- 1633, 1637, 1639, 1641, 1654, 1671, 1681, 1688, 1690, 1695,
- 1697, 1699, 1707, 1709, 1714, 1716, 1721, 1723, 1725, 1782,
- 1784, 1786, 1788, 1790, 1792, 1794, 1796, 1810, 1815, 1820,
- 1846, 1852, 1854, 1856, 1858, 1860, 1862, 1867, 1871, 1903,
- 1911, 1917, 1923, 1936, 1937, 1938, 1943, 1948, 1952, 1956,
- 1971, 1992, 1997, 2034, 2071, 2072, 2078, 2079, 2084, 2086,
- 2093, 2110, 2127, 2129, 2136, 2141, 2147, 2158, 2170, 2179,
- 2183, 2188, 2192, 2196, 2200, 2205, 2206, 2210, 2214, 2218
+ 0, 235, 235, 236, 241, 251, 255, 267, 275, 289,
+ 300, 310, 320, 346, 356, 358, 363, 373, 375, 380,
+ 382, 384, 390, 394, 399, 429, 441, 453, 459, 468,
+ 486, 487, 498, 504, 512, 513, 517, 517, 551, 550,
+ 584, 599, 601, 606, 607, 627, 632, 633, 637, 648,
+ 653, 660, 768, 819, 869, 995, 1017, 1038, 1048, 1058,
+ 1068, 1079, 1092, 1110, 1109, 1126, 1144, 1144, 1246, 1246,
+ 1279, 1309, 1317, 1318, 1324, 1325, 1332, 1337, 1350, 1365,
+ 1367, 1375, 1382, 1384, 1392, 1401, 1403, 1412, 1413, 1421,
+ 1426, 1426, 1439, 1446, 1459, 1463, 1485, 1486, 1492, 1493,
+ 1502, 1503, 1508, 1513, 1530, 1532, 1534, 1541, 1542, 1548,
+ 1549, 1554, 1556, 1563, 1565, 1573, 1578, 1589, 1590, 1595,
+ 1597, 1604, 1606, 1614, 1619, 1629, 1630, 1635, 1636, 1641,
+ 1648, 1652, 1654, 1656, 1669, 1686, 1696, 1703, 1705, 1710,
+ 1712, 1714, 1722, 1724, 1729, 1731, 1736, 1738, 1740, 1797,
+ 1799, 1801, 1803, 1805, 1807, 1809, 1811, 1825, 1830, 1835,
+ 1861, 1867, 1869, 1871, 1873, 1875, 1877, 1882, 1886, 1918,
+ 1926, 1932, 1938, 1951, 1952, 1953, 1958, 1963, 1967, 1971,
+ 1986, 2007, 2012, 2049, 2086, 2087, 2093, 2094, 2099, 2101,
+ 2108, 2125, 2142, 2144, 2151, 2156, 2162, 2173, 2185, 2194,
+ 2198, 2203, 2207, 2211, 2215, 2220, 2221, 2225, 2229, 2233
};
#endif
@@ -1956,22 +1958,22 @@ yyreduce:
switch (yyn)
{
case 2: /* program: %empty */
-#line 233 "awkgram.y"
+#line 235 "awkgram.y"
{ yyval = NULL; }
-#line 1962 "awkgram.c"
+#line 1964 "awkgram.c"
break;
case 3: /* program: program rule */
-#line 235 "awkgram.y"
+#line 237 "awkgram.y"
{
rule = 0;
yyerrok;
}
-#line 1971 "awkgram.c"
+#line 1973 "awkgram.c"
break;
case 4: /* program: program nls */
-#line 240 "awkgram.y"
+#line 242 "awkgram.y"
{
if (yyvsp[0] != NULL) {
if (yyvsp[-1] == NULL)
@@ -1981,19 +1983,19 @@ yyreduce:
}
yyval = yyvsp[-1];
}
-#line 1985 "awkgram.c"
+#line 1987 "awkgram.c"
break;
case 5: /* program: program LEX_EOF */
-#line 250 "awkgram.y"
+#line 252 "awkgram.y"
{
next_sourcefile();
}
-#line 1993 "awkgram.c"
+#line 1995 "awkgram.c"
break;
case 6: /* program: program error */
-#line 254 "awkgram.y"
+#line 256 "awkgram.y"
{
rule = 0;
/*
@@ -2002,11 +2004,11 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 2006 "awkgram.c"
+#line 2008 "awkgram.c"
break;
case 7: /* rule: pattern action */
-#line 266 "awkgram.y"
+#line 268 "awkgram.y"
{
(void) append_rule(yyvsp[-1], yyvsp[0]);
if (pending_comment != NULL) {
@@ -2014,11 +2016,11 @@ yyreduce:
pending_comment = NULL;
}
}
-#line 2018 "awkgram.c"
+#line 2020 "awkgram.c"
break;
case 8: /* rule: pattern statement_term */
-#line 274 "awkgram.y"
+#line 276 "awkgram.y"
{
if (rule != Rule) {
msg(_("%s blocks must have an action part"), ruletab[rule]);
@@ -2032,11 +2034,11 @@ yyreduce:
(void) append_rule(yyvsp[-1], NULL);
}
}
-#line 2036 "awkgram.c"
+#line 2038 "awkgram.c"
break;
case 9: /* rule: function_prologue action */
-#line 288 "awkgram.y"
+#line 290 "awkgram.y"
{
in_function = false;
(void) mk_function(yyvsp[-1], yyvsp[0]);
@@ -2047,11 +2049,11 @@ yyreduce:
}
yyerrok;
}
-#line 2051 "awkgram.c"
+#line 2053 "awkgram.c"
break;
case 10: /* rule: '@' LEX_INCLUDE source statement_term */
-#line 299 "awkgram.y"
+#line 301 "awkgram.y"
{
want_source = false;
at_seen = false;
@@ -2061,11 +2063,11 @@ yyreduce:
}
yyerrok;
}
-#line 2065 "awkgram.c"
+#line 2067 "awkgram.c"
break;
case 11: /* rule: '@' LEX_LOAD library statement_term */
-#line 309 "awkgram.y"
+#line 311 "awkgram.y"
{
want_source = false;
at_seen = false;
@@ -2075,13 +2077,26 @@ yyreduce:
}
yyerrok;
}
-#line 2079 "awkgram.c"
+#line 2081 "awkgram.c"
break;
case 12: /* rule: '@' LEX_NAMESPACE namespace statement_term */
-#line 319 "awkgram.y"
+#line 321 "awkgram.y"
{
+ /*
+ * 1/2022:
+ * We have an interesting isssue here. This production isn't
+ * reduced until after the token following the statement_term
+ * is seen. As a result, the change in namespace doesn't take
+ * effect until then. That's fine if the first token is 'function'
+ * or BEGIN or some such, but it's a disaster if it's an identifer;
+ * that identifier will be in the previous namespace.
+ * Therefore, the actual setting of the namespace is done immediately
+ * down in the scanner.
+ */
+
want_source = false;
+ want_namespace = false;
at_seen = false;
// this frees $3 storage in all cases
@@ -2089,11 +2104,11 @@ yyreduce:
yyerrok;
}
-#line 2093 "awkgram.c"
+#line 2108 "awkgram.c"
break;
case 13: /* source: FILENAME */
-#line 332 "awkgram.y"
+#line 347 "awkgram.y"
{
void *srcfile = NULL;
@@ -2103,23 +2118,23 @@ yyreduce:
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
-#line 2107 "awkgram.c"
+#line 2122 "awkgram.c"
break;
case 14: /* source: FILENAME error */
-#line 342 "awkgram.y"
+#line 357 "awkgram.y"
{ yyval = NULL; }
-#line 2113 "awkgram.c"
+#line 2128 "awkgram.c"
break;
case 15: /* source: error */
-#line 344 "awkgram.y"
+#line 359 "awkgram.y"
{ yyval = NULL; }
-#line 2119 "awkgram.c"
+#line 2134 "awkgram.c"
break;
case 16: /* library: FILENAME */
-#line 349 "awkgram.y"
+#line 364 "awkgram.y"
{
void *srcfile;
@@ -2129,58 +2144,58 @@ yyreduce:
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
-#line 2133 "awkgram.c"
+#line 2148 "awkgram.c"
break;
case 17: /* library: FILENAME error */
-#line 359 "awkgram.y"
+#line 374 "awkgram.y"
{ yyval = NULL; }
-#line 2139 "awkgram.c"
+#line 2154 "awkgram.c"
break;
case 18: /* library: error */
-#line 361 "awkgram.y"
+#line 376 "awkgram.y"
{ yyval = NULL; }
-#line 2145 "awkgram.c"
+#line 2160 "awkgram.c"
break;
case 19: /* namespace: FILENAME */
-#line 366 "awkgram.y"
+#line 381 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 2151 "awkgram.c"
+#line 2166 "awkgram.c"
break;
case 20: /* namespace: FILENAME error */
-#line 368 "awkgram.y"
+#line 383 "awkgram.y"
{ yyval = NULL; }
-#line 2157 "awkgram.c"
+#line 2172 "awkgram.c"
break;
case 21: /* namespace: error */
-#line 370 "awkgram.y"
+#line 385 "awkgram.y"
{ yyval = NULL; }
-#line 2163 "awkgram.c"
+#line 2178 "awkgram.c"
break;
case 22: /* pattern: %empty */
-#line 375 "awkgram.y"
+#line 390 "awkgram.y"
{
rule = Rule;
yyval = NULL;
}
-#line 2172 "awkgram.c"
+#line 2187 "awkgram.c"
break;
case 23: /* pattern: exp */
-#line 380 "awkgram.y"
+#line 395 "awkgram.y"
{
rule = Rule;
}
-#line 2180 "awkgram.c"
+#line 2195 "awkgram.c"
break;
case 24: /* pattern: exp comma exp */
-#line 385 "awkgram.y"
+#line 400 "awkgram.y"
{
INSTRUCTION *tp;
@@ -2210,11 +2225,11 @@ yyreduce:
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp);
rule = Rule;
}
-#line 2214 "awkgram.c"
+#line 2229 "awkgram.c"
break;
case 25: /* pattern: LEX_BEGIN */
-#line 415 "awkgram.y"
+#line 430 "awkgram.y"
{
static int begin_seen = 0;
@@ -2226,11 +2241,11 @@ yyreduce:
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2230 "awkgram.c"
+#line 2245 "awkgram.c"
break;
case 26: /* pattern: LEX_END */
-#line 427 "awkgram.y"
+#line 442 "awkgram.y"
{
static int end_seen = 0;
@@ -2242,31 +2257,31 @@ yyreduce:
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2246 "awkgram.c"
+#line 2261 "awkgram.c"
break;
case 27: /* pattern: LEX_BEGINFILE */
-#line 439 "awkgram.y"
+#line 454 "awkgram.y"
{
yyvsp[0]->in_rule = rule = BEGINFILE;
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2256 "awkgram.c"
+#line 2271 "awkgram.c"
break;
case 28: /* pattern: LEX_ENDFILE */
-#line 445 "awkgram.y"
+#line 460 "awkgram.y"
{
yyvsp[0]->in_rule = rule = ENDFILE;
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2266 "awkgram.c"
+#line 2281 "awkgram.c"
break;
case 29: /* action: l_brace statements r_brace opt_semi opt_nls */
-#line 454 "awkgram.y"
+#line 469 "awkgram.y"
{
INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yyvsp[-2]);
@@ -2281,11 +2296,11 @@ yyreduce:
yyval = ip;
}
-#line 2285 "awkgram.c"
+#line 2300 "awkgram.c"
break;
case 31: /* func_name: FUNC_CALL */
-#line 473 "awkgram.y"
+#line 488 "awkgram.y"
{
const char *name = yyvsp[0]->lextok;
char *qname = qualify_name(name, strlen(name));
@@ -2296,36 +2311,36 @@ yyreduce:
}
yyval = yyvsp[0];
}
-#line 2300 "awkgram.c"
+#line 2315 "awkgram.c"
break;
case 32: /* func_name: lex_builtin */
-#line 484 "awkgram.y"
+#line 499 "awkgram.y"
{
yyerror(_("`%s' is a built-in function, it cannot be redefined"),
tokstart);
YYABORT;
}
-#line 2310 "awkgram.c"
+#line 2325 "awkgram.c"
break;
case 33: /* func_name: '@' LEX_EVAL */
-#line 490 "awkgram.y"
+#line 505 "awkgram.y"
{
yyval = yyvsp[0];
at_seen = false;
}
-#line 2319 "awkgram.c"
+#line 2334 "awkgram.c"
break;
case 36: /* $@1: %empty */
-#line 502 "awkgram.y"
+#line 517 "awkgram.y"
{ want_param_names = FUNC_HEADER; }
-#line 2325 "awkgram.c"
+#line 2340 "awkgram.c"
break;
case 37: /* function_prologue: LEX_FUNCTION func_name '(' $@1 opt_param_list r_paren opt_nls */
-#line 503 "awkgram.y"
+#line 518 "awkgram.y"
{
INSTRUCTION *func_comment = NULL;
// Merge any comments found in the parameter list with those
@@ -2351,17 +2366,17 @@ yyreduce:
yyval = yyvsp[-6];
want_param_names = FUNC_BODY;
}
-#line 2355 "awkgram.c"
+#line 2370 "awkgram.c"
break;
case 38: /* $@2: %empty */
-#line 536 "awkgram.y"
+#line 551 "awkgram.y"
{ want_regexp = true; }
-#line 2361 "awkgram.c"
+#line 2376 "awkgram.c"
break;
case 39: /* regexp: a_slash $@2 REGEXP */
-#line 538 "awkgram.y"
+#line 553 "awkgram.y"
{
NODE *n, *exp;
char *re;
@@ -2390,11 +2405,11 @@ yyreduce:
yyval->opcode = Op_match_rec;
yyval->memory = n;
}
-#line 2394 "awkgram.c"
+#line 2409 "awkgram.c"
break;
case 40: /* typed_regexp: TYPED_REGEXP */
-#line 570 "awkgram.y"
+#line 585 "awkgram.y"
{
char *re;
size_t len;
@@ -2407,23 +2422,23 @@ yyreduce:
yyval->opcode = Op_push_re;
yyval->memory = make_typed_regex(re, len);
}
-#line 2411 "awkgram.c"
+#line 2426 "awkgram.c"
break;
case 41: /* a_slash: '/' */
-#line 585 "awkgram.y"
+#line 600 "awkgram.y"
{ bcfree(yyvsp[0]); }
-#line 2417 "awkgram.c"
+#line 2432 "awkgram.c"
break;
case 43: /* statements: %empty */
-#line 591 "awkgram.y"
+#line 606 "awkgram.y"
{ yyval = NULL; }
-#line 2423 "awkgram.c"
+#line 2438 "awkgram.c"
break;
case 44: /* statements: statements statement */
-#line 593 "awkgram.y"
+#line 608 "awkgram.y"
{
if (yyvsp[0] == NULL) {
yyval = yyvsp[-1];
@@ -2443,29 +2458,29 @@ yyreduce:
yyerrok;
}
-#line 2447 "awkgram.c"
+#line 2462 "awkgram.c"
break;
case 45: /* statements: statements error */
-#line 613 "awkgram.y"
+#line 628 "awkgram.y"
{ yyval = NULL; }
-#line 2453 "awkgram.c"
+#line 2468 "awkgram.c"
break;
case 46: /* statement_term: nls */
-#line 617 "awkgram.y"
+#line 632 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 2459 "awkgram.c"
+#line 2474 "awkgram.c"
break;
case 47: /* statement_term: semi opt_nls */
-#line 618 "awkgram.y"
+#line 633 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 2465 "awkgram.c"
+#line 2480 "awkgram.c"
break;
case 48: /* statement: semi opt_nls */
-#line 623 "awkgram.y"
+#line 638 "awkgram.y"
{
if (yyvsp[0] != NULL) {
INSTRUCTION *ip;
@@ -2476,31 +2491,31 @@ yyreduce:
} else
yyval = NULL;
}
-#line 2480 "awkgram.c"
+#line 2495 "awkgram.c"
break;
case 49: /* statement: l_brace statements r_brace */
-#line 634 "awkgram.y"
+#line 649 "awkgram.y"
{
trailing_comment = yyvsp[0]; // NULL or comment
yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]);
}
-#line 2489 "awkgram.c"
+#line 2504 "awkgram.c"
break;
case 50: /* statement: if_statement */
-#line 639 "awkgram.y"
+#line 654 "awkgram.y"
{
if (do_pretty_print)
yyval = list_prepend(yyvsp[0], instruction(Op_exec_count));
else
yyval = yyvsp[0];
}
-#line 2500 "awkgram.c"
+#line 2515 "awkgram.c"
break;
case 51: /* statement: LEX_SWITCH '(' exp r_paren opt_nls l_brace case_statements opt_nls r_brace */
-#line 646 "awkgram.y"
+#line 661 "awkgram.y"
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2608,11 +2623,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2612 "awkgram.c"
+#line 2627 "awkgram.c"
break;
case 52: /* statement: LEX_WHILE '(' exp r_paren opt_nls statement */
-#line 754 "awkgram.y"
+#line 769 "awkgram.y"
{
/*
* -----------------
@@ -2663,11 +2678,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2667 "awkgram.c"
+#line 2682 "awkgram.c"
break;
case 53: /* statement: LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls */
-#line 805 "awkgram.y"
+#line 820 "awkgram.y"
{
/*
* -----------------
@@ -2717,11 +2732,11 @@ yyreduce:
/* else
$1 and $4 are NULLs */
}
-#line 2721 "awkgram.c"
+#line 2736 "awkgram.c"
break;
case 54: /* statement: LEX_FOR '(' NAME LEX_IN simple_variable r_paren opt_nls statement */
-#line 855 "awkgram.y"
+#line 870 "awkgram.y"
{
INSTRUCTION *ip;
char *var_name = yyvsp[-5]->lextok;
@@ -2847,11 +2862,11 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2851 "awkgram.c"
+#line 2866 "awkgram.c"
break;
case 55: /* statement: LEX_FOR '(' opt_simple_stmt semi opt_nls exp semi opt_nls opt_simple_stmt r_paren opt_nls statement */
-#line 981 "awkgram.y"
+#line 996 "awkgram.y"
{
if (yyvsp[-7] != NULL) {
merge_comments(yyvsp[-7], NULL);
@@ -2873,11 +2888,11 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2877 "awkgram.c"
+#line 2892 "awkgram.c"
break;
case 56: /* statement: LEX_FOR '(' opt_simple_stmt semi opt_nls semi opt_nls opt_simple_stmt r_paren opt_nls statement */
-#line 1003 "awkgram.y"
+#line 1018 "awkgram.y"
{
if (yyvsp[-6] != NULL) {
merge_comments(yyvsp[-6], NULL);
@@ -2898,22 +2913,22 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2902 "awkgram.c"
+#line 2917 "awkgram.c"
break;
case 57: /* statement: non_compound_stmt */
-#line 1024 "awkgram.y"
+#line 1039 "awkgram.y"
{
if (do_pretty_print)
yyval = list_prepend(yyvsp[0], instruction(Op_exec_count));
else
yyval = yyvsp[0];
}
-#line 2913 "awkgram.c"
+#line 2928 "awkgram.c"
break;
case 58: /* non_compound_stmt: LEX_BREAK statement_term */
-#line 1034 "awkgram.y"
+#line 1049 "awkgram.y"
{
if (! break_allowed)
error_ln(yyvsp[-1]->source_line,
@@ -2923,11 +2938,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2927 "awkgram.c"
+#line 2942 "awkgram.c"
break;
case 59: /* non_compound_stmt: LEX_CONTINUE statement_term */
-#line 1044 "awkgram.y"
+#line 1059 "awkgram.y"
{
if (! continue_allowed)
error_ln(yyvsp[-1]->source_line,
@@ -2937,11 +2952,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2941 "awkgram.c"
+#line 2956 "awkgram.c"
break;
case 60: /* non_compound_stmt: LEX_NEXT statement_term */
-#line 1054 "awkgram.y"
+#line 1069 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2952,11 +2967,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2956 "awkgram.c"
+#line 2971 "awkgram.c"
break;
case 61: /* non_compound_stmt: LEX_NEXTFILE statement_term */
-#line 1065 "awkgram.y"
+#line 1080 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2969,11 +2984,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2973 "awkgram.c"
+#line 2988 "awkgram.c"
break;
case 62: /* non_compound_stmt: LEX_EXIT opt_exp statement_term */
-#line 1078 "awkgram.y"
+#line 1093 "awkgram.y"
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2990,20 +3005,20 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2994 "awkgram.c"
+#line 3009 "awkgram.c"
break;
case 63: /* $@3: %empty */
-#line 1095 "awkgram.y"
+#line 1110 "awkgram.y"
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 3003 "awkgram.c"
+#line 3018 "awkgram.c"
break;
case 64: /* non_compound_stmt: LEX_RETURN $@3 opt_fcall_exp statement_term */
-#line 1098 "awkgram.y"
+#line 1113 "awkgram.y"
{
if (called_from_eval)
yyvsp[-3]->opcode = Op_K_return_from_eval;
@@ -3017,28 +3032,28 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 3021 "awkgram.c"
+#line 3036 "awkgram.c"
break;
case 65: /* non_compound_stmt: simple_stmt statement_term */
-#line 1112 "awkgram.y"
+#line 1127 "awkgram.y"
{
if (yyvsp[0] != NULL)
yyval = list_append(yyvsp[-1], yyvsp[0]);
else
yyval = yyvsp[-1];
}
-#line 3032 "awkgram.c"
+#line 3047 "awkgram.c"
break;
case 66: /* $@4: %empty */
-#line 1129 "awkgram.y"
+#line 1144 "awkgram.y"
{ in_print = true; in_parens = 0; }
-#line 3038 "awkgram.c"
+#line 3053 "awkgram.c"
break;
case 67: /* simple_stmt: print $@4 print_expression_list output_redir */
-#line 1130 "awkgram.y"
+#line 1145 "awkgram.y"
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -3139,17 +3154,17 @@ regular_print:
}
}
}
-#line 3143 "awkgram.c"
+#line 3158 "awkgram.c"
break;
case 68: /* $@5: %empty */
-#line 1231 "awkgram.y"
+#line 1246 "awkgram.y"
{ sub_counter = 0; }
-#line 3149 "awkgram.c"
+#line 3164 "awkgram.c"
break;
case 69: /* simple_stmt: LEX_DELETE NAME $@5 delete_subscript_list */
-#line 1232 "awkgram.y"
+#line 1247 "awkgram.y"
{
char *arr = yyvsp[-2]->lextok;
@@ -3182,11 +3197,11 @@ regular_print:
yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyvsp[-3]);
}
}
-#line 3186 "awkgram.c"
+#line 3201 "awkgram.c"
break;
case 70: /* simple_stmt: LEX_DELETE '(' NAME ')' */
-#line 1269 "awkgram.y"
+#line 1284 "awkgram.y"
{
static bool warned = false;
char *arr = yyvsp[-1]->lextok;
@@ -3212,54 +3227,54 @@ regular_print:
fatal(_("`delete' is not allowed with FUNCTAB"));
}
}
-#line 3216 "awkgram.c"
+#line 3231 "awkgram.c"
break;
case 71: /* simple_stmt: exp */
-#line 1295 "awkgram.y"
+#line 1310 "awkgram.y"
{
yyval = optimize_assignment(yyvsp[0]);
}
-#line 3224 "awkgram.c"
+#line 3239 "awkgram.c"
break;
case 72: /* opt_simple_stmt: %empty */
-#line 1302 "awkgram.y"
+#line 1317 "awkgram.y"
{ yyval = NULL; }
-#line 3230 "awkgram.c"
+#line 3245 "awkgram.c"
break;
case 73: /* opt_simple_stmt: simple_stmt */
-#line 1304 "awkgram.y"
+#line 1319 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3236 "awkgram.c"
+#line 3251 "awkgram.c"
break;
case 74: /* case_statements: %empty */
-#line 1309 "awkgram.y"
+#line 1324 "awkgram.y"
{ yyval = NULL; }
-#line 3242 "awkgram.c"
+#line 3257 "awkgram.c"
break;
case 75: /* case_statements: case_statements case_statement */
-#line 1311 "awkgram.y"
+#line 1326 "awkgram.y"
{
if (yyvsp[-1] == NULL)
yyval = list_create(yyvsp[0]);
else
yyval = list_prepend(yyvsp[-1], yyvsp[0]);
}
-#line 3253 "awkgram.c"
+#line 3268 "awkgram.c"
break;
case 76: /* case_statements: case_statements error */
-#line 1318 "awkgram.y"
+#line 1333 "awkgram.y"
{ yyval = NULL; }
-#line 3259 "awkgram.c"
+#line 3274 "awkgram.c"
break;
case 77: /* case_statement: LEX_CASE case_value colon opt_nls statements */
-#line 1323 "awkgram.y"
+#line 1338 "awkgram.y"
{
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL)
@@ -3272,11 +3287,11 @@ regular_print:
bcfree(yyvsp[-2]);
yyval = yyvsp[-4];
}
-#line 3276 "awkgram.c"
+#line 3291 "awkgram.c"
break;
case 78: /* case_statement: LEX_DEFAULT colon opt_nls statements */
-#line 1336 "awkgram.y"
+#line 1351 "awkgram.y"
{
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL)
@@ -3288,17 +3303,17 @@ regular_print:
yyvsp[-3]->comment = yyvsp[-1];
yyval = yyvsp[-3];
}
-#line 3292 "awkgram.c"
+#line 3307 "awkgram.c"
break;
case 79: /* case_value: YNUMBER */
-#line 1351 "awkgram.y"
+#line 1366 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3298 "awkgram.c"
+#line 3313 "awkgram.c"
break;
case 80: /* case_value: '-' YNUMBER */
-#line 1353 "awkgram.y"
+#line 1368 "awkgram.y"
{
NODE *n = yyvsp[0]->memory;
(void) force_number(n);
@@ -3306,28 +3321,28 @@ regular_print:
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
-#line 3310 "awkgram.c"
+#line 3325 "awkgram.c"
break;
case 81: /* case_value: '+' YNUMBER */
-#line 1361 "awkgram.y"
+#line 1376 "awkgram.y"
{
NODE *n = yyvsp[0]->lasti->memory;
bcfree(yyvsp[-1]);
add_sign_to_num(n, '+');
yyval = yyvsp[0];
}
-#line 3321 "awkgram.c"
+#line 3336 "awkgram.c"
break;
case 82: /* case_value: YSTRING */
-#line 1368 "awkgram.y"
+#line 1383 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3327 "awkgram.c"
+#line 3342 "awkgram.c"
break;
case 83: /* case_value: regexp */
-#line 1370 "awkgram.y"
+#line 1385 "awkgram.y"
{
if (yyvsp[0]->memory->type == Node_regex)
yyvsp[0]->opcode = Op_push_re;
@@ -3335,57 +3350,57 @@ regular_print:
yyvsp[0]->opcode = Op_push;
yyval = yyvsp[0];
}
-#line 3339 "awkgram.c"
+#line 3354 "awkgram.c"
break;
case 84: /* case_value: typed_regexp */
-#line 1378 "awkgram.y"
+#line 1393 "awkgram.y"
{
assert((yyvsp[0]->memory->flags & REGEX) == REGEX);
yyvsp[0]->opcode = Op_push_re;
yyval = yyvsp[0];
}
-#line 3349 "awkgram.c"
+#line 3364 "awkgram.c"
break;
case 85: /* print: LEX_PRINT */
-#line 1387 "awkgram.y"
+#line 1402 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3355 "awkgram.c"
+#line 3370 "awkgram.c"
break;
case 86: /* print: LEX_PRINTF */
-#line 1389 "awkgram.y"
+#line 1404 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3361 "awkgram.c"
+#line 3376 "awkgram.c"
break;
case 88: /* print_expression_list: '(' expression_list r_paren */
-#line 1399 "awkgram.y"
+#line 1414 "awkgram.y"
{
yyval = yyvsp[-1];
}
-#line 3369 "awkgram.c"
+#line 3384 "awkgram.c"
break;
case 89: /* output_redir: %empty */
-#line 1406 "awkgram.y"
+#line 1421 "awkgram.y"
{
in_print = false;
in_parens = 0;
yyval = NULL;
}
-#line 3379 "awkgram.c"
+#line 3394 "awkgram.c"
break;
case 90: /* $@6: %empty */
-#line 1411 "awkgram.y"
+#line 1426 "awkgram.y"
{ in_print = false; in_parens = 0; }
-#line 3385 "awkgram.c"
+#line 3400 "awkgram.c"
break;
case 91: /* output_redir: IO_OUT $@6 common_exp */
-#line 1412 "awkgram.y"
+#line 1427 "awkgram.y"
{
if (yyvsp[-2]->redir_type == redirect_twoway
&& yyvsp[0]->lasti->opcode == Op_K_getline_redir
@@ -3395,22 +3410,22 @@ regular_print:
lintwarn(_("concatenation as I/O `>' redirection target is ambiguous"));
yyval = list_prepend(yyvsp[0], yyvsp[-2]);
}
-#line 3399 "awkgram.c"
+#line 3414 "awkgram.c"
break;
case 92: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement */
-#line 1425 "awkgram.y"
+#line 1440 "awkgram.y"
{
if (yyvsp[-1] != NULL)
yyvsp[-5]->comment = yyvsp[-1];
add_lint(yyvsp[-3], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL, NULL);
}
-#line 3410 "awkgram.c"
+#line 3425 "awkgram.c"
break;
case 93: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement */
-#line 1433 "awkgram.y"
+#line 1448 "awkgram.y"
{
if (yyvsp[-4] != NULL)
yyvsp[-8]->comment = yyvsp[-4];
@@ -3419,19 +3434,19 @@ regular_print:
add_lint(yyvsp[-6], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]);
}
-#line 3423 "awkgram.c"
+#line 3438 "awkgram.c"
break;
case 94: /* nls: NEWLINE */
-#line 1445 "awkgram.y"
+#line 1460 "awkgram.y"
{
yyval = yyvsp[0];
}
-#line 3431 "awkgram.c"
+#line 3446 "awkgram.c"
break;
case 95: /* nls: nls NEWLINE */
-#line 1449 "awkgram.y"
+#line 1464 "awkgram.y"
{
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) {
@@ -3449,59 +3464,59 @@ regular_print:
} else
yyval = NULL;
}
-#line 3453 "awkgram.c"
+#line 3468 "awkgram.c"
break;
case 96: /* opt_nls: %empty */
-#line 1470 "awkgram.y"
+#line 1485 "awkgram.y"
{ yyval = NULL; }
-#line 3459 "awkgram.c"
+#line 3474 "awkgram.c"
break;
case 97: /* opt_nls: nls */
-#line 1472 "awkgram.y"
+#line 1487 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3465 "awkgram.c"
+#line 3480 "awkgram.c"
break;
case 98: /* input_redir: %empty */
-#line 1477 "awkgram.y"
+#line 1492 "awkgram.y"
{ yyval = NULL; }
-#line 3471 "awkgram.c"
+#line 3486 "awkgram.c"
break;
case 99: /* input_redir: '<' simp_exp */
-#line 1479 "awkgram.y"
+#line 1494 "awkgram.y"
{
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
-#line 3480 "awkgram.c"
+#line 3495 "awkgram.c"
break;
case 100: /* opt_param_list: %empty */
-#line 1487 "awkgram.y"
+#line 1502 "awkgram.y"
{ yyval = NULL; }
-#line 3486 "awkgram.c"
+#line 3501 "awkgram.c"
break;
case 101: /* opt_param_list: param_list */
-#line 1489 "awkgram.y"
+#line 1504 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3492 "awkgram.c"
+#line 3507 "awkgram.c"
break;
case 102: /* param_list: NAME */
-#line 1494 "awkgram.y"
+#line 1509 "awkgram.y"
{
yyvsp[0]->param_count = 0;
yyval = list_create(yyvsp[0]);
}
-#line 3501 "awkgram.c"
+#line 3516 "awkgram.c"
break;
case 103: /* param_list: param_list comma NAME */
-#line 1499 "awkgram.y"
+#line 1514 "awkgram.y"
{
if (yyvsp[-2] != NULL && yyvsp[0] != NULL) {
yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count + 1;
@@ -3518,76 +3533,76 @@ regular_print:
} else
yyval = NULL;
}
-#line 3522 "awkgram.c"
+#line 3537 "awkgram.c"
break;
case 104: /* param_list: error */
-#line 1516 "awkgram.y"
+#line 1531 "awkgram.y"
{ yyval = NULL; }
-#line 3528 "awkgram.c"
+#line 3543 "awkgram.c"
break;
case 105: /* param_list: param_list error */
-#line 1518 "awkgram.y"
+#line 1533 "awkgram.y"
{ yyval = yyvsp[-1]; }
-#line 3534 "awkgram.c"
+#line 3549 "awkgram.c"
break;
case 106: /* param_list: param_list comma error */
-#line 1520 "awkgram.y"
+#line 1535 "awkgram.y"
{ yyval = yyvsp[-2]; }
-#line 3540 "awkgram.c"
+#line 3555 "awkgram.c"
break;
case 107: /* opt_exp: %empty */
-#line 1526 "awkgram.y"
+#line 1541 "awkgram.y"
{ yyval = NULL; }
-#line 3546 "awkgram.c"
+#line 3561 "awkgram.c"
break;
case 108: /* opt_exp: exp */
-#line 1528 "awkgram.y"
+#line 1543 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3552 "awkgram.c"
+#line 3567 "awkgram.c"
break;
case 109: /* opt_expression_list: %empty */
-#line 1533 "awkgram.y"
+#line 1548 "awkgram.y"
{ yyval = NULL; }
-#line 3558 "awkgram.c"
+#line 3573 "awkgram.c"
break;
case 110: /* opt_expression_list: expression_list */
-#line 1535 "awkgram.y"
+#line 1550 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3564 "awkgram.c"
+#line 3579 "awkgram.c"
break;
case 111: /* expression_list: exp */
-#line 1540 "awkgram.y"
+#line 1555 "awkgram.y"
{ yyval = mk_expression_list(NULL, yyvsp[0]); }
-#line 3570 "awkgram.c"
+#line 3585 "awkgram.c"
break;
case 112: /* expression_list: expression_list comma exp */
-#line 1542 "awkgram.y"
+#line 1557 "awkgram.y"
{
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok;
}
-#line 3581 "awkgram.c"
+#line 3596 "awkgram.c"
break;
case 113: /* expression_list: error */
-#line 1549 "awkgram.y"
+#line 1564 "awkgram.y"
{ yyval = NULL; }
-#line 3587 "awkgram.c"
+#line 3602 "awkgram.c"
break;
case 114: /* expression_list: expression_list error */
-#line 1551 "awkgram.y"
+#line 1566 "awkgram.y"
{
/*
* Returning the expression list instead of NULL lets
@@ -3595,66 +3610,66 @@ regular_print:
*/
yyval = yyvsp[-1];
}
-#line 3599 "awkgram.c"
+#line 3614 "awkgram.c"
break;
case 115: /* expression_list: expression_list error exp */
-#line 1559 "awkgram.y"
+#line 1574 "awkgram.y"
{
/* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
-#line 3608 "awkgram.c"
+#line 3623 "awkgram.c"
break;
case 116: /* expression_list: expression_list comma error */
-#line 1564 "awkgram.y"
+#line 1579 "awkgram.y"
{
/* Ditto */
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
-#line 3619 "awkgram.c"
+#line 3634 "awkgram.c"
break;
case 117: /* opt_fcall_expression_list: %empty */
-#line 1574 "awkgram.y"
+#line 1589 "awkgram.y"
{ yyval = NULL; }
-#line 3625 "awkgram.c"
+#line 3640 "awkgram.c"
break;
case 118: /* opt_fcall_expression_list: fcall_expression_list */
-#line 1576 "awkgram.y"
+#line 1591 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3631 "awkgram.c"
+#line 3646 "awkgram.c"
break;
case 119: /* fcall_expression_list: fcall_exp */
-#line 1581 "awkgram.y"
+#line 1596 "awkgram.y"
{ yyval = mk_expression_list(NULL, yyvsp[0]); }
-#line 3637 "awkgram.c"
+#line 3652 "awkgram.c"
break;
case 120: /* fcall_expression_list: fcall_expression_list comma fcall_exp */
-#line 1583 "awkgram.y"
+#line 1598 "awkgram.y"
{
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok;
}
-#line 3648 "awkgram.c"
+#line 3663 "awkgram.c"
break;
case 121: /* fcall_expression_list: error */
-#line 1590 "awkgram.y"
+#line 1605 "awkgram.y"
{ yyval = NULL; }
-#line 3654 "awkgram.c"
+#line 3669 "awkgram.c"
break;
case 122: /* fcall_expression_list: fcall_expression_list error */
-#line 1592 "awkgram.y"
+#line 1607 "awkgram.y"
{
/*
* Returning the expression list instead of NULL lets
@@ -3662,86 +3677,86 @@ regular_print:
*/
yyval = yyvsp[-1];
}
-#line 3666 "awkgram.c"
+#line 3681 "awkgram.c"
break;
case 123: /* fcall_expression_list: fcall_expression_list error fcall_exp */
-#line 1600 "awkgram.y"
+#line 1615 "awkgram.y"
{
/* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
-#line 3675 "awkgram.c"
+#line 3690 "awkgram.c"
break;
case 124: /* fcall_expression_list: fcall_expression_list comma error */
-#line 1605 "awkgram.y"
+#line 1620 "awkgram.y"
{
/* Ditto */
if (yyvsp[-1] != NULL)
yyvsp[-2]->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
-#line 3686 "awkgram.c"
+#line 3701 "awkgram.c"
break;
case 125: /* fcall_exp: exp */
-#line 1614 "awkgram.y"
+#line 1629 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3692 "awkgram.c"
+#line 3707 "awkgram.c"
break;
case 126: /* fcall_exp: typed_regexp */
-#line 1615 "awkgram.y"
+#line 1630 "awkgram.y"
{ yyval = list_create(yyvsp[0]); }
-#line 3698 "awkgram.c"
+#line 3713 "awkgram.c"
break;
case 127: /* opt_fcall_exp: %empty */
-#line 1620 "awkgram.y"
+#line 1635 "awkgram.y"
{ yyval = NULL; }
-#line 3704 "awkgram.c"
+#line 3719 "awkgram.c"
break;
case 128: /* opt_fcall_exp: fcall_exp */
-#line 1621 "awkgram.y"
+#line 1636 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3710 "awkgram.c"
+#line 3725 "awkgram.c"
break;
case 129: /* exp: variable assign_operator exp */
-#line 1627 "awkgram.y"
+#line 1642 "awkgram.y"
{
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of assignment"));
yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]);
}
-#line 3721 "awkgram.c"
+#line 3736 "awkgram.c"
break;
case 130: /* exp: variable ASSIGN typed_regexp */
-#line 1634 "awkgram.y"
+#line 1649 "awkgram.y"
{
yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1]);
}
-#line 3729 "awkgram.c"
+#line 3744 "awkgram.c"
break;
case 131: /* exp: exp LEX_AND exp */
-#line 1638 "awkgram.y"
+#line 1653 "awkgram.y"
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3735 "awkgram.c"
+#line 3750 "awkgram.c"
break;
case 132: /* exp: exp LEX_OR exp */
-#line 1640 "awkgram.y"
+#line 1655 "awkgram.y"
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3741 "awkgram.c"
+#line 3756 "awkgram.c"
break;
case 133: /* exp: exp MATCHOP typed_regexp */
-#line 1642 "awkgram.y"
+#line 1657 "awkgram.y"
{
if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
@@ -3754,11 +3769,11 @@ regular_print:
bcfree(yyvsp[0]);
yyval = list_append(yyvsp[-2], yyvsp[-1]);
}
-#line 3758 "awkgram.c"
+#line 3773 "awkgram.c"
break;
case 134: /* exp: exp MATCHOP exp */
-#line 1655 "awkgram.y"
+#line 1670 "awkgram.y"
{
if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
@@ -3775,11 +3790,11 @@ regular_print:
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
}
-#line 3779 "awkgram.c"
+#line 3794 "awkgram.c"
break;
case 135: /* exp: exp LEX_IN simple_variable */
-#line 1672 "awkgram.y"
+#line 1687 "awkgram.y"
{
if (do_lint_old)
lintwarn_ln(yyvsp[-1]->source_line,
@@ -3789,91 +3804,91 @@ regular_print:
yyvsp[-1]->expr_count = 1;
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
-#line 3793 "awkgram.c"
+#line 3808 "awkgram.c"
break;
case 136: /* exp: exp a_relop exp */
-#line 1682 "awkgram.y"
+#line 1697 "awkgram.y"
{
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of comparison"));
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
-#line 3804 "awkgram.c"
+#line 3819 "awkgram.c"
break;
case 137: /* exp: exp '?' exp ':' exp */
-#line 1689 "awkgram.y"
+#line 1704 "awkgram.y"
{ yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]); }
-#line 3810 "awkgram.c"
+#line 3825 "awkgram.c"
break;
case 138: /* exp: common_exp */
-#line 1691 "awkgram.y"
+#line 1706 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3816 "awkgram.c"
+#line 3831 "awkgram.c"
break;
case 139: /* assign_operator: ASSIGN */
-#line 1696 "awkgram.y"
+#line 1711 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3822 "awkgram.c"
+#line 3837 "awkgram.c"
break;
case 140: /* assign_operator: ASSIGNOP */
-#line 1698 "awkgram.y"
+#line 1713 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3828 "awkgram.c"
+#line 3843 "awkgram.c"
break;
case 141: /* assign_operator: SLASH_BEFORE_EQUAL ASSIGN */
-#line 1700 "awkgram.y"
+#line 1715 "awkgram.y"
{
yyvsp[0]->opcode = Op_assign_quotient;
yyval = yyvsp[0];
}
-#line 3837 "awkgram.c"
+#line 3852 "awkgram.c"
break;
case 142: /* relop_or_less: RELOP */
-#line 1708 "awkgram.y"
+#line 1723 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3843 "awkgram.c"
+#line 3858 "awkgram.c"
break;
case 143: /* relop_or_less: '<' */
-#line 1710 "awkgram.y"
+#line 1725 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3849 "awkgram.c"
+#line 3864 "awkgram.c"
break;
case 144: /* a_relop: relop_or_less */
-#line 1715 "awkgram.y"
+#line 1730 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3855 "awkgram.c"
+#line 3870 "awkgram.c"
break;
case 145: /* a_relop: '>' */
-#line 1717 "awkgram.y"
+#line 1732 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3861 "awkgram.c"
+#line 3876 "awkgram.c"
break;
case 146: /* common_exp: simp_exp */
-#line 1722 "awkgram.y"
+#line 1737 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3867 "awkgram.c"
+#line 3882 "awkgram.c"
break;
case 147: /* common_exp: simp_exp_nc */
-#line 1724 "awkgram.y"
+#line 1739 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3873 "awkgram.c"
+#line 3888 "awkgram.c"
break;
case 148: /* common_exp: common_exp simp_exp */
-#line 1726 "awkgram.y"
+#line 1741 "awkgram.y"
{
int count = 2;
bool is_simple_var = false;
@@ -3927,47 +3942,47 @@ regular_print:
max_args = count;
}
}
-#line 3931 "awkgram.c"
+#line 3946 "awkgram.c"
break;
case 150: /* simp_exp: simp_exp '^' simp_exp */
-#line 1785 "awkgram.y"
+#line 1800 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3937 "awkgram.c"
+#line 3952 "awkgram.c"
break;
case 151: /* simp_exp: simp_exp '*' simp_exp */
-#line 1787 "awkgram.y"
+#line 1802 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3943 "awkgram.c"
+#line 3958 "awkgram.c"
break;
case 152: /* simp_exp: simp_exp '/' simp_exp */
-#line 1789 "awkgram.y"
+#line 1804 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3949 "awkgram.c"
+#line 3964 "awkgram.c"
break;
case 153: /* simp_exp: simp_exp '%' simp_exp */
-#line 1791 "awkgram.y"
+#line 1806 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3955 "awkgram.c"
+#line 3970 "awkgram.c"
break;
case 154: /* simp_exp: simp_exp '+' simp_exp */
-#line 1793 "awkgram.y"
+#line 1808 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3961 "awkgram.c"
+#line 3976 "awkgram.c"
break;
case 155: /* simp_exp: simp_exp '-' simp_exp */
-#line 1795 "awkgram.y"
+#line 1810 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3967 "awkgram.c"
+#line 3982 "awkgram.c"
break;
case 156: /* simp_exp: LEX_GETLINE opt_variable input_redir */
-#line 1797 "awkgram.y"
+#line 1812 "awkgram.y"
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3981,29 +3996,29 @@ regular_print:
_("non-redirected `getline' undefined inside END action"));
yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input);
}
-#line 3985 "awkgram.c"
+#line 4000 "awkgram.c"
break;
case 157: /* simp_exp: variable INCREMENT */
-#line 1811 "awkgram.y"
+#line 1826 "awkgram.y"
{
yyvsp[0]->opcode = Op_postincrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 3994 "awkgram.c"
+#line 4009 "awkgram.c"
break;
case 158: /* simp_exp: variable DECREMENT */
-#line 1816 "awkgram.y"
+#line 1831 "awkgram.y"
{
yyvsp[0]->opcode = Op_postdecrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 4003 "awkgram.c"
+#line 4018 "awkgram.c"
break;
case 159: /* simp_exp: '(' expression_list r_paren LEX_IN simple_variable */
-#line 1821 "awkgram.y"
+#line 1836 "awkgram.y"
{
if (do_lint_old) {
/* first one is warning so that second one comes out if warnings are fatal */
@@ -4024,64 +4039,64 @@ regular_print:
yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]);
}
}
-#line 4028 "awkgram.c"
+#line 4043 "awkgram.c"
break;
case 160: /* simp_exp_nc: common_exp IO_IN LEX_GETLINE opt_variable */
-#line 1847 "awkgram.y"
+#line 1862 "awkgram.y"
{
yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->redir_type);
bcfree(yyvsp[-2]);
}
-#line 4037 "awkgram.c"
+#line 4052 "awkgram.c"
break;
case 161: /* simp_exp_nc: simp_exp_nc '^' simp_exp */
-#line 1853 "awkgram.y"
+#line 1868 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4043 "awkgram.c"
+#line 4058 "awkgram.c"
break;
case 162: /* simp_exp_nc: simp_exp_nc '*' simp_exp */
-#line 1855 "awkgram.y"
+#line 1870 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4049 "awkgram.c"
+#line 4064 "awkgram.c"
break;
case 163: /* simp_exp_nc: simp_exp_nc '/' simp_exp */
-#line 1857 "awkgram.y"
+#line 1872 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4055 "awkgram.c"
+#line 4070 "awkgram.c"
break;
case 164: /* simp_exp_nc: simp_exp_nc '%' simp_exp */
-#line 1859 "awkgram.y"
+#line 1874 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4061 "awkgram.c"
+#line 4076 "awkgram.c"
break;
case 165: /* simp_exp_nc: simp_exp_nc '+' simp_exp */
-#line 1861 "awkgram.y"
+#line 1876 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4067 "awkgram.c"
+#line 4082 "awkgram.c"
break;
case 166: /* simp_exp_nc: simp_exp_nc '-' simp_exp */
-#line 1863 "awkgram.y"
+#line 1878 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4073 "awkgram.c"
+#line 4088 "awkgram.c"
break;
case 167: /* non_post_simp_exp: regexp */
-#line 1868 "awkgram.y"
+#line 1883 "awkgram.y"
{
yyval = list_create(yyvsp[0]);
}
-#line 4081 "awkgram.c"
+#line 4096 "awkgram.c"
break;
case 168: /* non_post_simp_exp: '!' simp_exp */
-#line 1872 "awkgram.y"
+#line 1887 "awkgram.y"
{
if (yyvsp[0]->opcode == Op_match_rec) {
yyvsp[0]->opcode = Op_nomatch;
@@ -4113,11 +4128,11 @@ regular_print:
}
}
}
-#line 4117 "awkgram.c"
+#line 4132 "awkgram.c"
break;
case 169: /* non_post_simp_exp: '(' exp r_paren */
-#line 1904 "awkgram.y"
+#line 1919 "awkgram.y"
{
// Always include. Allows us to lint warn on
// print "foo" > "bar" 1
@@ -4125,31 +4140,31 @@ regular_print:
// print "foo" > ("bar" 1)
yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline));
}
-#line 4129 "awkgram.c"
+#line 4144 "awkgram.c"
break;
case 170: /* non_post_simp_exp: LEX_BUILTIN '(' opt_fcall_expression_list r_paren */
-#line 1912 "awkgram.y"
+#line 1927 "awkgram.y"
{
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL)
YYABORT;
}
-#line 4139 "awkgram.c"
+#line 4154 "awkgram.c"
break;
case 171: /* non_post_simp_exp: LEX_LENGTH '(' opt_fcall_expression_list r_paren */
-#line 1918 "awkgram.y"
+#line 1933 "awkgram.y"
{
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL)
YYABORT;
}
-#line 4149 "awkgram.c"
+#line 4164 "awkgram.c"
break;
case 172: /* non_post_simp_exp: LEX_LENGTH */
-#line 1924 "awkgram.y"
+#line 1939 "awkgram.y"
{
static bool warned = false;
@@ -4162,45 +4177,45 @@ regular_print:
if (yyval == NULL)
YYABORT;
}
-#line 4166 "awkgram.c"
+#line 4181 "awkgram.c"
break;
case 175: /* non_post_simp_exp: INCREMENT variable */
-#line 1939 "awkgram.y"
+#line 1954 "awkgram.y"
{
yyvsp[-1]->opcode = Op_preincrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
}
-#line 4175 "awkgram.c"
+#line 4190 "awkgram.c"
break;
case 176: /* non_post_simp_exp: DECREMENT variable */
-#line 1944 "awkgram.y"
+#line 1959 "awkgram.y"
{
yyvsp[-1]->opcode = Op_predecrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
}
-#line 4184 "awkgram.c"
+#line 4199 "awkgram.c"
break;
case 177: /* non_post_simp_exp: YNUMBER */
-#line 1949 "awkgram.y"
+#line 1964 "awkgram.y"
{
yyval = list_create(yyvsp[0]);
}
-#line 4192 "awkgram.c"
+#line 4207 "awkgram.c"
break;
case 178: /* non_post_simp_exp: YSTRING */
-#line 1953 "awkgram.y"
+#line 1968 "awkgram.y"
{
yyval = list_create(yyvsp[0]);
}
-#line 4200 "awkgram.c"
+#line 4215 "awkgram.c"
break;
case 179: /* non_post_simp_exp: '-' simp_exp */
-#line 1957 "awkgram.y"
+#line 1972 "awkgram.y"
{
if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0
@@ -4215,11 +4230,11 @@ regular_print:
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
-#line 4219 "awkgram.c"
+#line 4234 "awkgram.c"
break;
case 180: /* non_post_simp_exp: '+' simp_exp */
-#line 1972 "awkgram.y"
+#line 1987 "awkgram.y"
{
if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0
@@ -4237,20 +4252,20 @@ regular_print:
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
-#line 4241 "awkgram.c"
+#line 4256 "awkgram.c"
break;
case 181: /* func_call: direct_func_call */
-#line 1993 "awkgram.y"
+#line 2008 "awkgram.y"
{
func_use(yyvsp[0]->lasti->func_name, FUNC_USE);
yyval = yyvsp[0];
}
-#line 4250 "awkgram.c"
+#line 4265 "awkgram.c"
break;
case 182: /* func_call: '@' direct_func_call */
-#line 1998 "awkgram.y"
+#line 2013 "awkgram.y"
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -4284,11 +4299,11 @@ regular_print:
yyval = list_prepend(yyvsp[0], t);
at_seen = false;
}
-#line 4288 "awkgram.c"
+#line 4303 "awkgram.c"
break;
case 183: /* direct_func_call: FUNC_CALL '(' opt_fcall_expression_list r_paren */
-#line 2035 "awkgram.y"
+#line 2050 "awkgram.y"
{
NODE *n;
char *name = yyvsp[-3]->func_name;
@@ -4321,49 +4336,49 @@ regular_print:
yyval = list_append(t, yyvsp[-3]);
}
}
-#line 4325 "awkgram.c"
+#line 4340 "awkgram.c"
break;
case 184: /* opt_variable: %empty */
-#line 2071 "awkgram.y"
+#line 2086 "awkgram.y"
{ yyval = NULL; }
-#line 4331 "awkgram.c"
+#line 4346 "awkgram.c"
break;
case 185: /* opt_variable: variable */
-#line 2073 "awkgram.y"
+#line 2088 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4337 "awkgram.c"
+#line 4352 "awkgram.c"
break;
case 186: /* delete_subscript_list: %empty */
-#line 2078 "awkgram.y"
+#line 2093 "awkgram.y"
{ yyval = NULL; }
-#line 4343 "awkgram.c"
+#line 4358 "awkgram.c"
break;
case 187: /* delete_subscript_list: delete_subscript SUBSCRIPT */
-#line 2080 "awkgram.y"
+#line 2095 "awkgram.y"
{ yyval = yyvsp[-1]; }
-#line 4349 "awkgram.c"
+#line 4364 "awkgram.c"
break;
case 188: /* delete_subscript: delete_exp_list */
-#line 2085 "awkgram.y"
+#line 2100 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4355 "awkgram.c"
+#line 4370 "awkgram.c"
break;
case 189: /* delete_subscript: delete_subscript delete_exp_list */
-#line 2087 "awkgram.y"
+#line 2102 "awkgram.y"
{
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
-#line 4363 "awkgram.c"
+#line 4378 "awkgram.c"
break;
case 190: /* delete_exp_list: bracketed_exp_list */
-#line 2094 "awkgram.y"
+#line 2109 "awkgram.y"
{
INSTRUCTION *ip = yyvsp[0]->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
@@ -4377,11 +4392,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
yyval = yyvsp[0];
}
-#line 4381 "awkgram.c"
+#line 4396 "awkgram.c"
break;
case 191: /* bracketed_exp_list: '[' expression_list ']' */
-#line 2111 "awkgram.y"
+#line 2126 "awkgram.y"
{
INSTRUCTION *t = yyvsp[-1];
if (yyvsp[-1] == NULL) {
@@ -4395,41 +4410,41 @@ regular_print:
yyvsp[0]->sub_count = count_expressions(&t, false);
yyval = list_append(t, yyvsp[0]);
}
-#line 4399 "awkgram.c"
+#line 4414 "awkgram.c"
break;
case 192: /* subscript: bracketed_exp_list */
-#line 2128 "awkgram.y"
+#line 2143 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4405 "awkgram.c"
+#line 4420 "awkgram.c"
break;
case 193: /* subscript: subscript bracketed_exp_list */
-#line 2130 "awkgram.y"
+#line 2145 "awkgram.y"
{
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
-#line 4413 "awkgram.c"
+#line 4428 "awkgram.c"
break;
case 194: /* subscript_list: subscript SUBSCRIPT */
-#line 2137 "awkgram.y"
+#line 2152 "awkgram.y"
{ yyval = yyvsp[-1]; }
-#line 4419 "awkgram.c"
+#line 4434 "awkgram.c"
break;
case 195: /* simple_variable: NAME */
-#line 2142 "awkgram.y"
+#line 2157 "awkgram.y"
{
yyvsp[0]->opcode = Op_push;
yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lextok, Node_var_new);
yyval = list_create(yyvsp[0]);
}
-#line 4429 "awkgram.c"
+#line 4444 "awkgram.c"
break;
case 196: /* simple_variable: NAME subscript_list */
-#line 2148 "awkgram.y"
+#line 2163 "awkgram.y"
{
char *arr = yyvsp[-1]->lextok;
@@ -4437,11 +4452,11 @@ regular_print:
yyvsp[-1]->opcode = Op_push_array;
yyval = list_prepend(yyvsp[0], yyvsp[-1]);
}
-#line 4441 "awkgram.c"
+#line 4456 "awkgram.c"
break;
case 197: /* variable: simple_variable */
-#line 2159 "awkgram.y"
+#line 2174 "awkgram.y"
{
INSTRUCTION *ip = yyvsp[0]->nexti;
if (ip->opcode == Op_push
@@ -4453,85 +4468,85 @@ regular_print:
} else
yyval = yyvsp[0];
}
-#line 4457 "awkgram.c"
+#line 4472 "awkgram.c"
break;
case 198: /* variable: '$' non_post_simp_exp opt_incdec */
-#line 2171 "awkgram.y"
+#line 2186 "awkgram.y"
{
yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != NULL)
mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 4467 "awkgram.c"
+#line 4482 "awkgram.c"
break;
case 199: /* opt_incdec: INCREMENT */
-#line 2180 "awkgram.y"
+#line 2195 "awkgram.y"
{
yyvsp[0]->opcode = Op_postincrement;
}
-#line 4475 "awkgram.c"
+#line 4490 "awkgram.c"
break;
case 200: /* opt_incdec: DECREMENT */
-#line 2184 "awkgram.y"
+#line 2199 "awkgram.y"
{
yyvsp[0]->opcode = Op_postdecrement;
}
-#line 4483 "awkgram.c"
+#line 4498 "awkgram.c"
break;
case 201: /* opt_incdec: %empty */
-#line 2188 "awkgram.y"
+#line 2203 "awkgram.y"
{ yyval = NULL; }
-#line 4489 "awkgram.c"
+#line 4504 "awkgram.c"
break;
case 202: /* l_brace: '{' opt_nls */
-#line 2192 "awkgram.y"
+#line 2207 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4495 "awkgram.c"
+#line 4510 "awkgram.c"
break;
case 203: /* r_brace: '}' opt_nls */
-#line 2196 "awkgram.y"
+#line 2211 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; }
-#line 4501 "awkgram.c"
+#line 4516 "awkgram.c"
break;
case 204: /* r_paren: ')' */
-#line 2200 "awkgram.y"
+#line 2215 "awkgram.y"
{ yyerrok; }
-#line 4507 "awkgram.c"
+#line 4522 "awkgram.c"
break;
case 205: /* opt_semi: %empty */
-#line 2205 "awkgram.y"
+#line 2220 "awkgram.y"
{ yyval = NULL; }
-#line 4513 "awkgram.c"
+#line 4528 "awkgram.c"
break;
case 207: /* semi: ';' */
-#line 2210 "awkgram.y"
+#line 2225 "awkgram.y"
{ yyerrok; }
-#line 4519 "awkgram.c"
+#line 4534 "awkgram.c"
break;
case 208: /* colon: ':' */
-#line 2214 "awkgram.y"
+#line 2229 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; }
-#line 4525 "awkgram.c"
+#line 4540 "awkgram.c"
break;
case 209: /* comma: ',' opt_nls */
-#line 2218 "awkgram.y"
+#line 2233 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; }
-#line 4531 "awkgram.c"
+#line 4546 "awkgram.c"
break;
-#line 4535 "awkgram.c"
+#line 4550 "awkgram.c"
default: break;
}
@@ -4724,7 +4739,7 @@ yyreturnlab:
return yyresult;
}
-#line 2220 "awkgram.y"
+#line 2235 "awkgram.y"
struct token {
@@ -6587,6 +6602,9 @@ retry:
yylval = GET_INSTRUCTION(Op_token);
if (want_source) {
yylval->lextok = estrdup(tokstart, tok - tokstart);
+ // See the comment in the production for @namespace.
+ if (want_namespace)
+ change_namespace(yylval->lextok);
return lasttok = FILENAME;
}
@@ -6927,6 +6945,8 @@ retry:
switch (class) {
case LEX_NAMESPACE:
+ want_namespace = true;
+ // fall through
case LEX_INCLUDE:
case LEX_LOAD:
want_source = true;
@@ -9327,7 +9347,7 @@ done:
return i;
}
-/* set_namespace --- change the current namespace */
+/* set_namespace --- update namespace data structures */
static void
set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
@@ -9358,13 +9378,9 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
return;
}
- if (strcmp(ns->lextok, current_namespace) == 0)
- ; // nothing to do
- else if (strcmp(ns->lextok, awk_namespace) == 0) {
- set_current_namespace(awk_namespace);
- } else {
- set_current_namespace(estrdup(ns->lextok, strlen(ns->lextok)));
- }
+ // Actual changing of namespace is done earlier.
+ // See comments in the production and in yylex().
+
efree(ns->lextok);
// save info and push on front of list of namespaces seen
@@ -9377,11 +9393,35 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
ns->lextok = NULL;
bcfree(ns);
- namespace_changed = true;
-
return;
}
+/* change_namespace --- change the current namespace */
+
+static void
+change_namespace(const char *new_namespace)
+{
+ /* error messages will come from set_namespace(), above */
+
+ if (! is_valid_identifier(new_namespace))
+ return;
+
+ int mid = check_special(new_namespace);
+
+ if (mid >= 0)
+ return;
+
+ if (strcmp(new_namespace, current_namespace) == 0)
+ ; // nothing to do
+ else if (strcmp(new_namespace, awk_namespace) == 0) {
+ set_current_namespace(awk_namespace);
+ } else {
+ set_current_namespace(estrdup(new_namespace, strlen(new_namespace)));
+ }
+
+ namespace_changed = true;
+}
+
/* qualify_name --- put name into namespace */
static char *
diff --git a/awkgram.y b/awkgram.y
index f4a81242..a39452f8 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -57,6 +57,7 @@ static void dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t
static bool include_source(INSTRUCTION *file, void **srcfile_p);
static bool load_library(INSTRUCTION *file, void **srcfile_p);
static void set_namespace(INSTRUCTION *ns, INSTRUCTION *comment);
+static void change_namespace(const char *new_namespace);
static void next_sourcefile(void);
static char *tokexpand(void);
static NODE *set_profile_text(NODE *n, const char *str, size_t len);
@@ -112,6 +113,7 @@ static void add_sign_to_num(NODE *n, char sign);
static bool at_seen = false;
static bool want_source = false;
+static bool want_namespace = false;
static bool want_regexp = false; /* lexical scanning kludge */
static enum {
FUNC_HEADER,
@@ -317,7 +319,20 @@ rule
}
| '@' LEX_NAMESPACE namespace statement_term
{
+ /*
+ * 1/2022:
+ * We have an interesting isssue here. This production isn't
+ * reduced until after the token following the statement_term
+ * is seen. As a result, the change in namespace doesn't take
+ * effect until then. That's fine if the first token is 'function'
+ * or BEGIN or some such, but it's a disaster if it's an identifer;
+ * that identifier will be in the previous namespace.
+ * Therefore, the actual setting of the namespace is done immediately
+ * down in the scanner.
+ */
+
want_source = false;
+ want_namespace = false;
at_seen = false;
// this frees $3 storage in all cases
@@ -4079,6 +4094,9 @@ retry:
yylval = GET_INSTRUCTION(Op_token);
if (want_source) {
yylval->lextok = estrdup(tokstart, tok - tokstart);
+ // See the comment in the production for @namespace.
+ if (want_namespace)
+ change_namespace(yylval->lextok);
return lasttok = FILENAME;
}
@@ -4419,6 +4437,8 @@ retry:
switch (class) {
case LEX_NAMESPACE:
+ want_namespace = true;
+ // fall through
case LEX_INCLUDE:
case LEX_LOAD:
want_source = true;
@@ -6819,7 +6839,7 @@ done:
return i;
}
-/* set_namespace --- change the current namespace */
+/* set_namespace --- update namespace data structures */
static void
set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
@@ -6850,13 +6870,9 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
return;
}
- if (strcmp(ns->lextok, current_namespace) == 0)
- ; // nothing to do
- else if (strcmp(ns->lextok, awk_namespace) == 0) {
- set_current_namespace(awk_namespace);
- } else {
- set_current_namespace(estrdup(ns->lextok, strlen(ns->lextok)));
- }
+ // Actual changing of namespace is done earlier.
+ // See comments in the production and in yylex().
+
efree(ns->lextok);
// save info and push on front of list of namespaces seen
@@ -6869,11 +6885,35 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
ns->lextok = NULL;
bcfree(ns);
- namespace_changed = true;
-
return;
}
+/* change_namespace --- change the current namespace */
+
+static void
+change_namespace(const char *new_namespace)
+{
+ /* error messages will come from set_namespace(), above */
+
+ if (! is_valid_identifier(new_namespace))
+ return;
+
+ int mid = check_special(new_namespace);
+
+ if (mid >= 0)
+ return;
+
+ if (strcmp(new_namespace, current_namespace) == 0)
+ ; // nothing to do
+ else if (strcmp(new_namespace, awk_namespace) == 0) {
+ set_current_namespace(awk_namespace);
+ } else {
+ set_current_namespace(estrdup(new_namespace, strlen(new_namespace)));
+ }
+
+ namespace_changed = true;
+}
+
/* qualify_name --- put name into namespace */
static char *
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 88cf9f0e..db08ab90 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.ini (Indirect Calls): Use `the_function' everywhere.
+ Thanks to John Naman, <gawker@703n.com> for the report.
+
2021-12-10 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Updated from GNULIB.
diff --git a/doc/gawk.info b/doc/gawk.info
index 6aaff404..97cb96ca 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -15345,8 +15345,8 @@ identifier immediately followed by an opening parenthesis, any
arguments, and then a closing parenthesis, with the addition of a
leading '@' character:
- the_func = "sum"
- result = @the_func() # calls the sum() function
+ the_function = "sum"
+ result = @the_function() # calls the sum() function
Here is a full program that processes the previously shown data,
using indirect function calls:
@@ -15589,7 +15589,7 @@ functions indirectly, as follows.
example, in the following case:
for (i = 1; i <= n; i++)
- @the_func()
+ @the_function()
'gawk' looks up the actual function to call only once.
@@ -39042,325 +39042,325 @@ Ref: Function Caveats-Footnote-1637557
Node: Return Statement637677
Node: Dynamic Typing640656
Node: Indirect Calls641586
-Ref: Indirect Calls-Footnote-1651841
-Node: Functions Summary651969
-Node: Library Functions654674
-Ref: Library Functions-Footnote-1658281
-Ref: Library Functions-Footnote-2658424
-Node: Library Names658595
-Ref: Library Names-Footnote-1662262
-Ref: Library Names-Footnote-2662485
-Node: General Functions662571
-Node: Strtonum Function663753
-Node: Assert Function666775
-Node: Round Function670101
-Node: Cliff Random Function671641
-Node: Ordinal Functions672657
-Ref: Ordinal Functions-Footnote-1675720
-Ref: Ordinal Functions-Footnote-2675972
-Node: Join Function676182
-Ref: Join Function-Footnote-1677952
-Node: Getlocaltime Function678152
-Node: Readfile Function681894
-Node: Shell Quoting683871
-Node: Isnumeric Function685299
-Node: Data File Management686687
-Node: Filetrans Function687319
-Node: Rewind Function691415
-Node: File Checking693324
-Ref: File Checking-Footnote-1694658
-Node: Empty Files694859
-Node: Ignoring Assigns696838
-Node: Getopt Function698388
-Ref: Getopt Function-Footnote-1713685
-Node: Passwd Functions713885
-Ref: Passwd Functions-Footnote-1722724
-Node: Group Functions722812
-Ref: Group Functions-Footnote-1730710
-Node: Walking Arrays730917
-Node: Library Functions Summary733925
-Node: Library Exercises735331
-Node: Sample Programs735796
-Node: Running Examples736566
-Node: Clones737294
-Node: Cut Program738518
-Node: Egrep Program748658
-Node: Id Program757659
-Node: Split Program767594
-Ref: Split Program-Footnote-1777487
-Node: Tee Program777660
-Node: Uniq Program780450
-Node: Wc Program788038
-Node: Bytes vs. Characters788425
-Node: Using extensions789973
-Node: wc program790727
-Node: Miscellaneous Programs795592
-Node: Dupword Program796805
-Node: Alarm Program798835
-Node: Translate Program803690
-Ref: Translate Program-Footnote-1808255
-Node: Labels Program808525
-Ref: Labels Program-Footnote-1811876
-Node: Word Sorting811960
-Node: History Sorting816032
-Node: Extract Program818257
-Node: Simple Sed826270
-Node: Igawk Program829344
-Ref: Igawk Program-Footnote-1843675
-Ref: Igawk Program-Footnote-2843877
-Ref: Igawk Program-Footnote-3843999
-Node: Anagram Program844114
-Node: Signature Program847176
-Node: Programs Summary848423
-Node: Programs Exercises849637
-Ref: Programs Exercises-Footnote-1853767
-Node: Advanced Features853853
-Node: Nondecimal Data855984
-Node: Boolean Typed Values857582
-Node: Array Sorting859463
-Node: Controlling Array Traversal860168
-Ref: Controlling Array Traversal-Footnote-1868536
-Node: Array Sorting Functions868654
-Ref: Array Sorting Functions-Footnote-1874028
-Node: Two-way I/O874224
-Ref: Two-way I/O-Footnote-1881950
-Ref: Two-way I/O-Footnote-2882137
-Node: TCP/IP Networking882219
-Node: Profiling885295
-Node: Extension Philosophy894604
-Node: Advanced Features Summary896083
-Node: Internationalization898098
-Node: I18N and L10N899772
-Node: Explaining gettext900459
-Ref: Explaining gettext-Footnote-1906351
-Ref: Explaining gettext-Footnote-2906536
-Node: Programmer i18n906701
-Ref: Programmer i18n-Footnote-1911650
-Node: Translator i18n911699
-Node: String Extraction912493
-Ref: String Extraction-Footnote-1913625
-Node: Printf Ordering913711
-Ref: Printf Ordering-Footnote-1916497
-Node: I18N Portability916561
-Ref: I18N Portability-Footnote-1919017
-Node: I18N Example919080
-Ref: I18N Example-Footnote-1922355
-Ref: I18N Example-Footnote-2922428
-Node: Gawk I18N922537
-Node: I18N Summary923159
-Node: Debugger924500
-Node: Debugging925500
-Node: Debugging Concepts925941
-Node: Debugging Terms927750
-Node: Awk Debugging930325
-Ref: Awk Debugging-Footnote-1931270
-Node: Sample Debugging Session931402
-Node: Debugger Invocation931936
-Node: Finding The Bug933322
-Node: List of Debugger Commands939796
-Node: Breakpoint Control941129
-Node: Debugger Execution Control944823
-Node: Viewing And Changing Data948185
-Node: Execution Stack951726
-Node: Debugger Info953363
-Node: Miscellaneous Debugger Commands957434
-Node: Readline Support962496
-Node: Limitations963392
-Node: Debugging Summary965946
-Node: Namespaces967225
-Node: Global Namespace968336
-Node: Qualified Names969734
-Node: Default Namespace970733
-Node: Changing The Namespace971474
-Node: Naming Rules973088
-Node: Internal Name Management974936
-Node: Namespace Example975978
-Node: Namespace And Features978540
-Node: Namespace Summary979975
-Node: Arbitrary Precision Arithmetic981452
-Node: Computer Arithmetic982939
-Ref: table-numeric-ranges986705
-Ref: table-floating-point-ranges987199
-Ref: Computer Arithmetic-Footnote-1987858
-Node: Math Definitions987915
-Ref: table-ieee-formats990891
-Node: MPFR features991459
-Node: FP Math Caution993177
-Ref: FP Math Caution-Footnote-1994249
-Node: Inexactness of computations994618
-Node: Inexact representation995649
-Node: Comparing FP Values997009
-Node: Errors accumulate998250
-Node: Strange values999706
-Ref: Strange values-Footnote-11002294
-Node: Getting Accuracy1002399
-Node: Try To Round1005109
-Node: Setting precision1006008
-Ref: table-predefined-precision-strings1006705
-Node: Setting the rounding mode1008536
-Ref: table-gawk-rounding-modes1008910
-Ref: Setting the rounding mode-Footnote-11012842
-Node: Arbitrary Precision Integers1013021
-Ref: Arbitrary Precision Integers-Footnote-11016196
-Node: Checking for MPFR1016345
-Node: POSIX Floating Point Problems1017819
-Ref: POSIX Floating Point Problems-Footnote-11022104
-Node: Floating point summary1022142
-Node: Dynamic Extensions1024332
-Node: Extension Intro1025885
-Node: Plugin License1027151
-Node: Extension Mechanism Outline1027948
-Ref: figure-load-extension1028387
-Ref: figure-register-new-function1029953
-Ref: figure-call-new-function1031046
-Node: Extension API Description1033109
-Node: Extension API Functions Introduction1034822
-Ref: table-api-std-headers1036658
-Node: General Data Types1040908
-Ref: General Data Types-Footnote-11049614
-Node: Memory Allocation Functions1049913
-Ref: Memory Allocation Functions-Footnote-11054414
-Node: Constructor Functions1054513
-Node: API Ownership of MPFR and GMP Values1058166
-Node: Registration Functions1059479
-Node: Extension Functions1060179
-Node: Exit Callback Functions1065501
-Node: Extension Version String1066751
-Node: Input Parsers1067414
-Node: Output Wrappers1080135
-Node: Two-way processors1084647
-Node: Printing Messages1086912
-Ref: Printing Messages-Footnote-11088083
-Node: Updating ERRNO1088236
-Node: Requesting Values1088975
-Ref: table-value-types-returned1089712
-Node: Accessing Parameters1090821
-Node: Symbol Table Access1092058
-Node: Symbol table by name1092570
-Ref: Symbol table by name-Footnote-11095595
-Node: Symbol table by cookie1095723
-Ref: Symbol table by cookie-Footnote-11099908
-Node: Cached values1099972
-Ref: Cached values-Footnote-11103508
-Node: Array Manipulation1103661
-Ref: Array Manipulation-Footnote-11104752
-Node: Array Data Types1104789
-Ref: Array Data Types-Footnote-11107447
-Node: Array Functions1107539
-Node: Flattening Arrays1112037
-Node: Creating Arrays1119013
-Node: Redirection API1123780
-Node: Extension API Variables1126613
-Node: Extension Versioning1127324
-Ref: gawk-api-version1127753
-Node: Extension GMP/MPFR Versioning1129485
-Node: Extension API Informational Variables1131113
-Node: Extension API Boilerplate1132186
-Node: Changes from API V11136160
-Node: Finding Extensions1137732
-Node: Extension Example1138291
-Node: Internal File Description1139089
-Node: Internal File Ops1143169
-Ref: Internal File Ops-Footnote-11154519
-Node: Using Internal File Ops1154659
-Ref: Using Internal File Ops-Footnote-11157042
-Node: Extension Samples1157316
-Node: Extension Sample File Functions1158845
-Node: Extension Sample Fnmatch1166494
-Node: Extension Sample Fork1167981
-Node: Extension Sample Inplace1169199
-Node: Extension Sample Ord1172825
-Node: Extension Sample Readdir1173661
-Ref: table-readdir-file-types1174550
-Node: Extension Sample Revout1175618
-Node: Extension Sample Rev2way1176207
-Node: Extension Sample Read write array1176947
-Node: Extension Sample Readfile1180113
-Node: Extension Sample Time1181208
-Node: Extension Sample API Tests1182960
-Node: gawkextlib1183452
-Node: Extension summary1186370
-Node: Extension Exercises1190072
-Node: Language History1191314
-Node: V7/SVR3.11192970
-Node: SVR41195122
-Node: POSIX1196556
-Node: BTL1197937
-Node: POSIX/GNU1198666
-Node: Feature History1204444
-Node: Common Extensions1221619
-Node: Ranges and Locales1222902
-Ref: Ranges and Locales-Footnote-11227518
-Ref: Ranges and Locales-Footnote-21227545
-Ref: Ranges and Locales-Footnote-31227780
-Node: Contributors1228003
-Node: History summary1234000
-Node: Installation1235380
-Node: Gawk Distribution1236324
-Node: Getting1236808
-Node: Extracting1237771
-Node: Distribution contents1239409
-Node: Unix Installation1246470
-Node: Quick Installation1247274
-Node: Compiling with MPFR1249694
-Node: Shell Startup Files1250384
-Node: Additional Configuration Options1251473
-Node: Configuration Philosophy1253788
-Node: Compiling from Git1256184
-Node: Building the Documentation1256739
-Node: Non-Unix Installation1258123
-Node: PC Installation1258583
-Node: PC Binary Installation1259421
-Node: PC Compiling1260294
-Node: PC Using1261411
-Node: Cygwin1264964
-Node: MSYS1266188
-Node: VMS Installation1266790
-Node: VMS Compilation1267509
-Ref: VMS Compilation-Footnote-11268738
-Node: VMS Dynamic Extensions1268796
-Node: VMS Installation Details1270481
-Node: VMS Running1272743
-Node: VMS GNV1277022
-Node: Bugs1277736
-Node: Bug definition1278648
-Node: Bug address1281584
-Node: Usenet1284972
-Node: Performance bugs1286161
-Node: Asking for help1289082
-Node: Maintainers1291049
-Node: Other Versions1292243
-Node: Installation summary1300407
-Node: Notes1301771
-Node: Compatibility Mode1302565
-Node: Additions1303347
-Node: Accessing The Source1304272
-Node: Adding Code1305709
-Node: New Ports1311901
-Node: Derived Files1316276
-Ref: Derived Files-Footnote-11321936
-Ref: Derived Files-Footnote-21321971
-Ref: Derived Files-Footnote-31322569
-Node: Future Extensions1322683
-Node: Implementation Limitations1323341
-Node: Extension Design1324551
-Node: Old Extension Problems1325695
-Ref: Old Extension Problems-Footnote-11327213
-Node: Extension New Mechanism Goals1327270
-Ref: Extension New Mechanism Goals-Footnote-11330634
-Node: Extension Other Design Decisions1330823
-Node: Extension Future Growth1332936
-Node: Notes summary1333542
-Node: Basic Concepts1334700
-Node: Basic High Level1335381
-Ref: figure-general-flow1335663
-Ref: figure-process-flow1336349
-Ref: Basic High Level-Footnote-11339651
-Node: Basic Data Typing1339836
-Node: Glossary1343164
-Node: Copying1375051
-Node: GNU Free Documentation License1412594
-Node: Index1437714
+Ref: Indirect Calls-Footnote-1651853
+Node: Functions Summary651981
+Node: Library Functions654686
+Ref: Library Functions-Footnote-1658293
+Ref: Library Functions-Footnote-2658436
+Node: Library Names658607
+Ref: Library Names-Footnote-1662274
+Ref: Library Names-Footnote-2662497
+Node: General Functions662583
+Node: Strtonum Function663765
+Node: Assert Function666787
+Node: Round Function670113
+Node: Cliff Random Function671653
+Node: Ordinal Functions672669
+Ref: Ordinal Functions-Footnote-1675732
+Ref: Ordinal Functions-Footnote-2675984
+Node: Join Function676194
+Ref: Join Function-Footnote-1677964
+Node: Getlocaltime Function678164
+Node: Readfile Function681906
+Node: Shell Quoting683883
+Node: Isnumeric Function685311
+Node: Data File Management686699
+Node: Filetrans Function687331
+Node: Rewind Function691427
+Node: File Checking693336
+Ref: File Checking-Footnote-1694670
+Node: Empty Files694871
+Node: Ignoring Assigns696850
+Node: Getopt Function698400
+Ref: Getopt Function-Footnote-1713697
+Node: Passwd Functions713897
+Ref: Passwd Functions-Footnote-1722736
+Node: Group Functions722824
+Ref: Group Functions-Footnote-1730722
+Node: Walking Arrays730929
+Node: Library Functions Summary733937
+Node: Library Exercises735343
+Node: Sample Programs735808
+Node: Running Examples736578
+Node: Clones737306
+Node: Cut Program738530
+Node: Egrep Program748670
+Node: Id Program757671
+Node: Split Program767606
+Ref: Split Program-Footnote-1777499
+Node: Tee Program777672
+Node: Uniq Program780462
+Node: Wc Program788050
+Node: Bytes vs. Characters788437
+Node: Using extensions789985
+Node: wc program790739
+Node: Miscellaneous Programs795604
+Node: Dupword Program796817
+Node: Alarm Program798847
+Node: Translate Program803702
+Ref: Translate Program-Footnote-1808267
+Node: Labels Program808537
+Ref: Labels Program-Footnote-1811888
+Node: Word Sorting811972
+Node: History Sorting816044
+Node: Extract Program818269
+Node: Simple Sed826282
+Node: Igawk Program829356
+Ref: Igawk Program-Footnote-1843687
+Ref: Igawk Program-Footnote-2843889
+Ref: Igawk Program-Footnote-3844011
+Node: Anagram Program844126
+Node: Signature Program847188
+Node: Programs Summary848435
+Node: Programs Exercises849649
+Ref: Programs Exercises-Footnote-1853779
+Node: Advanced Features853865
+Node: Nondecimal Data855996
+Node: Boolean Typed Values857594
+Node: Array Sorting859475
+Node: Controlling Array Traversal860180
+Ref: Controlling Array Traversal-Footnote-1868548
+Node: Array Sorting Functions868666
+Ref: Array Sorting Functions-Footnote-1874040
+Node: Two-way I/O874236
+Ref: Two-way I/O-Footnote-1881962
+Ref: Two-way I/O-Footnote-2882149
+Node: TCP/IP Networking882231
+Node: Profiling885307
+Node: Extension Philosophy894616
+Node: Advanced Features Summary896095
+Node: Internationalization898110
+Node: I18N and L10N899784
+Node: Explaining gettext900471
+Ref: Explaining gettext-Footnote-1906363
+Ref: Explaining gettext-Footnote-2906548
+Node: Programmer i18n906713
+Ref: Programmer i18n-Footnote-1911662
+Node: Translator i18n911711
+Node: String Extraction912505
+Ref: String Extraction-Footnote-1913637
+Node: Printf Ordering913723
+Ref: Printf Ordering-Footnote-1916509
+Node: I18N Portability916573
+Ref: I18N Portability-Footnote-1919029
+Node: I18N Example919092
+Ref: I18N Example-Footnote-1922367
+Ref: I18N Example-Footnote-2922440
+Node: Gawk I18N922549
+Node: I18N Summary923171
+Node: Debugger924512
+Node: Debugging925512
+Node: Debugging Concepts925953
+Node: Debugging Terms927762
+Node: Awk Debugging930337
+Ref: Awk Debugging-Footnote-1931282
+Node: Sample Debugging Session931414
+Node: Debugger Invocation931948
+Node: Finding The Bug933334
+Node: List of Debugger Commands939808
+Node: Breakpoint Control941141
+Node: Debugger Execution Control944835
+Node: Viewing And Changing Data948197
+Node: Execution Stack951738
+Node: Debugger Info953375
+Node: Miscellaneous Debugger Commands957446
+Node: Readline Support962508
+Node: Limitations963404
+Node: Debugging Summary965958
+Node: Namespaces967237
+Node: Global Namespace968348
+Node: Qualified Names969746
+Node: Default Namespace970745
+Node: Changing The Namespace971486
+Node: Naming Rules973100
+Node: Internal Name Management974948
+Node: Namespace Example975990
+Node: Namespace And Features978552
+Node: Namespace Summary979987
+Node: Arbitrary Precision Arithmetic981464
+Node: Computer Arithmetic982951
+Ref: table-numeric-ranges986717
+Ref: table-floating-point-ranges987211
+Ref: Computer Arithmetic-Footnote-1987870
+Node: Math Definitions987927
+Ref: table-ieee-formats990903
+Node: MPFR features991471
+Node: FP Math Caution993189
+Ref: FP Math Caution-Footnote-1994261
+Node: Inexactness of computations994630
+Node: Inexact representation995661
+Node: Comparing FP Values997021
+Node: Errors accumulate998262
+Node: Strange values999718
+Ref: Strange values-Footnote-11002306
+Node: Getting Accuracy1002411
+Node: Try To Round1005121
+Node: Setting precision1006020
+Ref: table-predefined-precision-strings1006717
+Node: Setting the rounding mode1008548
+Ref: table-gawk-rounding-modes1008922
+Ref: Setting the rounding mode-Footnote-11012854
+Node: Arbitrary Precision Integers1013033
+Ref: Arbitrary Precision Integers-Footnote-11016208
+Node: Checking for MPFR1016357
+Node: POSIX Floating Point Problems1017831
+Ref: POSIX Floating Point Problems-Footnote-11022116
+Node: Floating point summary1022154
+Node: Dynamic Extensions1024344
+Node: Extension Intro1025897
+Node: Plugin License1027163
+Node: Extension Mechanism Outline1027960
+Ref: figure-load-extension1028399
+Ref: figure-register-new-function1029965
+Ref: figure-call-new-function1031058
+Node: Extension API Description1033121
+Node: Extension API Functions Introduction1034834
+Ref: table-api-std-headers1036670
+Node: General Data Types1040920
+Ref: General Data Types-Footnote-11049626
+Node: Memory Allocation Functions1049925
+Ref: Memory Allocation Functions-Footnote-11054426
+Node: Constructor Functions1054525
+Node: API Ownership of MPFR and GMP Values1058178
+Node: Registration Functions1059491
+Node: Extension Functions1060191
+Node: Exit Callback Functions1065513
+Node: Extension Version String1066763
+Node: Input Parsers1067426
+Node: Output Wrappers1080147
+Node: Two-way processors1084659
+Node: Printing Messages1086924
+Ref: Printing Messages-Footnote-11088095
+Node: Updating ERRNO1088248
+Node: Requesting Values1088987
+Ref: table-value-types-returned1089724
+Node: Accessing Parameters1090833
+Node: Symbol Table Access1092070
+Node: Symbol table by name1092582
+Ref: Symbol table by name-Footnote-11095607
+Node: Symbol table by cookie1095735
+Ref: Symbol table by cookie-Footnote-11099920
+Node: Cached values1099984
+Ref: Cached values-Footnote-11103520
+Node: Array Manipulation1103673
+Ref: Array Manipulation-Footnote-11104764
+Node: Array Data Types1104801
+Ref: Array Data Types-Footnote-11107459
+Node: Array Functions1107551
+Node: Flattening Arrays1112049
+Node: Creating Arrays1119025
+Node: Redirection API1123792
+Node: Extension API Variables1126625
+Node: Extension Versioning1127336
+Ref: gawk-api-version1127765
+Node: Extension GMP/MPFR Versioning1129497
+Node: Extension API Informational Variables1131125
+Node: Extension API Boilerplate1132198
+Node: Changes from API V11136172
+Node: Finding Extensions1137744
+Node: Extension Example1138303
+Node: Internal File Description1139101
+Node: Internal File Ops1143181
+Ref: Internal File Ops-Footnote-11154531
+Node: Using Internal File Ops1154671
+Ref: Using Internal File Ops-Footnote-11157054
+Node: Extension Samples1157328
+Node: Extension Sample File Functions1158857
+Node: Extension Sample Fnmatch1166506
+Node: Extension Sample Fork1167993
+Node: Extension Sample Inplace1169211
+Node: Extension Sample Ord1172837
+Node: Extension Sample Readdir1173673
+Ref: table-readdir-file-types1174562
+Node: Extension Sample Revout1175630
+Node: Extension Sample Rev2way1176219
+Node: Extension Sample Read write array1176959
+Node: Extension Sample Readfile1180125
+Node: Extension Sample Time1181220
+Node: Extension Sample API Tests1182972
+Node: gawkextlib1183464
+Node: Extension summary1186382
+Node: Extension Exercises1190084
+Node: Language History1191326
+Node: V7/SVR3.11192982
+Node: SVR41195134
+Node: POSIX1196568
+Node: BTL1197949
+Node: POSIX/GNU1198678
+Node: Feature History1204456
+Node: Common Extensions1221631
+Node: Ranges and Locales1222914
+Ref: Ranges and Locales-Footnote-11227530
+Ref: Ranges and Locales-Footnote-21227557
+Ref: Ranges and Locales-Footnote-31227792
+Node: Contributors1228015
+Node: History summary1234012
+Node: Installation1235392
+Node: Gawk Distribution1236336
+Node: Getting1236820
+Node: Extracting1237783
+Node: Distribution contents1239421
+Node: Unix Installation1246482
+Node: Quick Installation1247286
+Node: Compiling with MPFR1249706
+Node: Shell Startup Files1250396
+Node: Additional Configuration Options1251485
+Node: Configuration Philosophy1253800
+Node: Compiling from Git1256196
+Node: Building the Documentation1256751
+Node: Non-Unix Installation1258135
+Node: PC Installation1258595
+Node: PC Binary Installation1259433
+Node: PC Compiling1260306
+Node: PC Using1261423
+Node: Cygwin1264976
+Node: MSYS1266200
+Node: VMS Installation1266802
+Node: VMS Compilation1267521
+Ref: VMS Compilation-Footnote-11268750
+Node: VMS Dynamic Extensions1268808
+Node: VMS Installation Details1270493
+Node: VMS Running1272755
+Node: VMS GNV1277034
+Node: Bugs1277748
+Node: Bug definition1278660
+Node: Bug address1281596
+Node: Usenet1284984
+Node: Performance bugs1286173
+Node: Asking for help1289094
+Node: Maintainers1291061
+Node: Other Versions1292255
+Node: Installation summary1300419
+Node: Notes1301783
+Node: Compatibility Mode1302577
+Node: Additions1303359
+Node: Accessing The Source1304284
+Node: Adding Code1305721
+Node: New Ports1311913
+Node: Derived Files1316288
+Ref: Derived Files-Footnote-11321948
+Ref: Derived Files-Footnote-21321983
+Ref: Derived Files-Footnote-31322581
+Node: Future Extensions1322695
+Node: Implementation Limitations1323353
+Node: Extension Design1324563
+Node: Old Extension Problems1325707
+Ref: Old Extension Problems-Footnote-11327225
+Node: Extension New Mechanism Goals1327282
+Ref: Extension New Mechanism Goals-Footnote-11330646
+Node: Extension Other Design Decisions1330835
+Node: Extension Future Growth1332948
+Node: Notes summary1333554
+Node: Basic Concepts1334712
+Node: Basic High Level1335393
+Ref: figure-general-flow1335675
+Ref: figure-process-flow1336361
+Ref: Basic High Level-Footnote-11339663
+Node: Basic Data Typing1339848
+Node: Glossary1343176
+Node: Copying1375063
+Node: GNU Free Documentation License1412606
+Node: Index1437726

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index cb7ad4c3..7fb6a570 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -21985,8 +21985,8 @@ a closing parenthesis, with the addition of a leading @samp{@@}
character:
@example
-the_func = "sum"
-result = @@the_func() # calls the sum() function
+the_function = "sum"
+result = @@the_function() # calls the sum() function
@end example
Here is a full program that processes the previously shown data,
@@ -22298,7 +22298,7 @@ For example, in the following case:
@example
for (i = 1; i <= n; i++)
- @@the_func()
+ @@the_function()
@end example
@noindent
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 97d21f04..f8c164e9 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -20897,8 +20897,8 @@ a closing parenthesis, with the addition of a leading @samp{@@}
character:
@example
-the_func = "sum"
-result = @@the_func() # calls the sum() function
+the_function = "sum"
+result = @@the_function() # calls the sum() function
@end example
Here is a full program that processes the previously shown data,
@@ -21210,7 +21210,7 @@ For example, in the following case:
@example
for (i = 1; i <= n; i++)
- @@the_func()
+ @@the_function()
@end example
@noindent
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 675ebbf2..7b6bc9f7 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,4 +1,4 @@
-2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 4d4b1252..5caf38cc 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -203,7 +203,7 @@ GAWK_EXT_TESTS = \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
- nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
profile1 profile10 profile11 profile12 profile13 profile14 \
profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
@@ -3071,6 +3071,11 @@ nsindirect1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/symbol.c b/symbol.c
index be01369c..300fa871 100644
--- a/symbol.c
+++ b/symbol.c
@@ -604,7 +604,10 @@ load_symbols()
|| r->type == Node_var
|| r->type == Node_var_array
|| r->type == Node_var_new) {
- tmp = make_string(r->vname, strlen(r->vname));
+ if (strncmp(r->vname, "awk::", 5) == 0)
+ tmp = make_string(r->vname + 5, strlen(r->vname) - 5);
+ else
+ tmp = make_string(r->vname, strlen(r->vname));
aptr = assoc_lookup(sym_array, tmp);
unref(tmp);
unref(*aptr);
diff --git a/test/ChangeLog b/test/ChangeLog
index c6c0c657..47289312 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): nsidentifier, new test.
+ * nsidentifier.awk, nsidentifier.ok: New files.
+
2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
* Makefile.am (EXTRA_DIST): Add readall1.awk, readall2.awk, and
diff --git a/test/Makefile.am b/test/Makefile.am
index 1fa8ad3f..16606b09 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -850,6 +850,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1459,7 +1461,7 @@ GAWK_EXT_TESTS = \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
- nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
profile1 profile10 profile11 profile12 profile13 profile14 \
profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
diff --git a/test/Makefile.in b/test/Makefile.in
index c6c131fc..cb4551e2 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1116,6 +1116,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1725,7 +1727,7 @@ GAWK_EXT_TESTS = \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
- nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
profile1 profile10 profile11 profile12 profile13 profile14 \
profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
@@ -4752,6 +4754,11 @@ nsindirect1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f080c29f..923e1f78 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1800,6 +1800,11 @@ nsindirect1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/nsidentifier.awk b/test/nsidentifier.awk
new file mode 100644
index 00000000..0c665289
--- /dev/null
+++ b/test/nsidentifier.awk
@@ -0,0 +1,36 @@
+# Overdocumented Test Case for FUNCTAB
+
+@namespace "ns"
+
+ns1 = 1 # ns::ns1
+ns::ns2 = 2 # ns::ns2
+awk::defined_in_ns3 = 3 # defined_in_ns3
+@namespace "awk"
+awkspace4 = 4 # awkspace4
+awk::awkspace5 = 5 # awkspace5
+
+BEGIN {
+ list = "awk::defined_in_ns3 awk::awkspace5 ns1 ns::ns1 ns::ns2 awkspace4 awkspace5" # list
+ n = split(list, test) # n, test
+ for (i = 1; i <= n; i++) { # i
+ var = test[i] # var
+ sub(/awk::/, "", var) # no 'awk::' in SYMTAB or SYMTAB
+
+ yesno = (test[i] in FUNCTAB) ? "Yes" : "No " # yesno
+ printf("%s %s in FUNCTAB\n", yesno, test[i])
+ yesno = (test[i] in PROCINFO["identifiers"]) ? "Yes" : "No "
+ printf("%s %s in PROCINFO[\"identifiers\"]\n", yesno, test[i])
+
+ yesno = (var in SYMTAB) ? "Yes" : "No "
+ printf("%s %s in SYMTAB\n", yesno, var)
+ yesno = (var in PROCINFO["identifiers"]) ? "Yes" :"No "
+ printf("%s %s in PROCINFO[\"identifiers\"]\n", yesno, var)
+ printf("\n")
+ }
+ print "------------------------------"
+ for (i in PROCINFO["identifiers"])
+ print i | "LC_ALL=C sort"
+ close("LC_ALL=C sort")
+
+ exit 0
+}
diff --git a/test/nsidentifier.ok b/test/nsidentifier.ok
new file mode 100644
index 00000000..5743f94c
--- /dev/null
+++ b/test/nsidentifier.ok
@@ -0,0 +1,118 @@
+No awk::defined_in_ns3 in FUNCTAB
+No awk::defined_in_ns3 in PROCINFO["identifiers"]
+Yes defined_in_ns3 in SYMTAB
+Yes defined_in_ns3 in PROCINFO["identifiers"]
+
+No awk::awkspace5 in FUNCTAB
+No awk::awkspace5 in PROCINFO["identifiers"]
+Yes awkspace5 in SYMTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+
+No ns1 in FUNCTAB
+No ns1 in PROCINFO["identifiers"]
+No ns1 in SYMTAB
+No ns1 in PROCINFO["identifiers"]
+
+No ns::ns1 in FUNCTAB
+Yes ns::ns1 in PROCINFO["identifiers"]
+Yes ns::ns1 in SYMTAB
+Yes ns::ns1 in PROCINFO["identifiers"]
+
+No ns::ns2 in FUNCTAB
+Yes ns::ns2 in PROCINFO["identifiers"]
+Yes ns::ns2 in SYMTAB
+Yes ns::ns2 in PROCINFO["identifiers"]
+
+No awkspace4 in FUNCTAB
+Yes awkspace4 in PROCINFO["identifiers"]
+Yes awkspace4 in SYMTAB
+Yes awkspace4 in PROCINFO["identifiers"]
+
+No awkspace5 in FUNCTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+Yes awkspace5 in SYMTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+
+------------------------------
+ARGC
+ARGIND
+ARGV
+BINMODE
+CONVFMT
+ENVIRON
+ERRNO
+FIELDWIDTHS
+FILENAME
+FNR
+FPAT
+FS
+FUNCTAB
+IGNORECASE
+LINT
+NF
+NR
+OFMT
+OFS
+ORS
+PREC
+PROCINFO
+RLENGTH
+ROUNDMODE
+RS
+RSTART
+RT
+SUBSEP
+SYMTAB
+TEXTDOMAIN
+and
+asort
+asorti
+atan2
+awkspace4
+awkspace5
+bindtextdomain
+close
+compl
+cos
+dcgettext
+dcngettext
+defined_in_ns3
+exp
+fflush
+gensub
+gsub
+i
+index
+int
+isarray
+length
+list
+log
+lshift
+match
+mktime
+n
+ns::ns1
+ns::ns2
+or
+patsplit
+rand
+rshift
+sin
+split
+sprintf
+sqrt
+srand
+strftime
+strtonum
+sub
+substr
+system
+systime
+test
+tolower
+toupper
+typeof
+var
+xor
+yesno