[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/typed-regex-2, created. gawk-4.1
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/typed-regex-2, created. gawk-4.1.0-2064-gf0b405c |
Date: |
Tue, 15 Nov 2016 19:49:00 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/typed-regex-2 has been created
at f0b405cceab16dadbb84b95a8d68f705bc20f70f (commit)
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=f0b405cceab16dadbb84b95a8d68f705bc20f70f
commit f0b405cceab16dadbb84b95a8d68f705bc20f70f
Author: Arnold D. Robbins <address@hidden>
Date: Tue Nov 15 21:47:48 2016 +0200
Actually remove tre_reg define.
diff --git a/awk.h b/awk.h
index 890e586..1cd1d5d 100644
--- a/awk.h
+++ b/awk.h
@@ -509,7 +509,6 @@ typedef struct exp_node {
#else
#define numbr sub.val.fltnum
#endif
-#define tre_regs sub.val.preg
#define typed_re sub.val.typre
/*
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=4f1eec385831018980e4c7424e1a544c5313b52a
commit 4f1eec385831018980e4c7424e1a544c5313b52a
Author: Arnold D. Robbins <address@hidden>
Date: Tue Nov 15 21:45:58 2016 +0200
Finish reworking typed regexes. Tests pass!
diff --git a/ChangeLog b/ChangeLog
index d1de219..0c1cac3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2016-11-15 Arnold D. Robbins <address@hidden>
+ Finish reworking typed regexes.
+
+ * awk.h (typed_re): Replaces tre_reg.
+ * awkgram.y (typed_regexp production): Node_val points to a regular
+ Node_regex and also has string value and length.
+ (make_regnode): Simplified back to its original form.
+ * builtin.c (call_sub, call_match, call_split_func): For REGEX,
+ get n->typed_re.
+ * field.c (do_split, do_patsplit): Ditto, for separator regexp.
+ * profile.c (pprint): Op_match_rec, handle REGEX correctly.
+ * re.c (re_update): If REGEX, get t->typed_re->re_reg.
+
+2016-11-15 Arnold D. Robbins <address@hidden>
+
Start reworking typed regexes.
* awk.h (Node_typedregex): Nuked.
diff --git a/awk.h b/awk.h
index cc487c3..890e586 100644
--- a/awk.h
+++ b/awk.h
@@ -384,7 +384,7 @@ typedef struct exp_node {
int idx;
wchar_t *wsp;
size_t wslen;
- Regexp *preg;
+ struct exp_node *typre;
} val;
} sub;
NODETYPE type;
@@ -510,6 +510,7 @@ typedef struct exp_node {
#define numbr sub.val.fltnum
#endif
#define tre_regs sub.val.preg
+#define typed_re sub.val.typre
/*
* If stfmt is set to STFMT_UNUSED, it means that the string representation
diff --git a/awkgram.c b/awkgram.c
index 4bf6b95..0017994 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -673,24 +673,24 @@ static const yytype_uint16 yyrline[] =
0, 215, 215, 217, 222, 223, 227, 239, 244, 255,
262, 268, 277, 285, 287, 292, 300, 302, 308, 316,
326, 356, 370, 384, 392, 403, 415, 417, 419, 425,
- 433, 434, 438, 438, 484, 483, 517, 539, 541, 546,
- 556, 603, 608, 609, 613, 615, 617, 624, 714, 756,
- 798, 911, 918, 925, 936, 946, 956, 966, 978, 995,
- 994, 1019, 1031, 1031, 1130, 1130, 1164, 1195, 1204, 1205,
- 1211, 1212, 1219, 1224, 1236, 1250, 1252, 1260, 1267, 1269,
- 1277, 1286, 1288, 1297, 1298, 1306, 1311, 1311, 1322, 1326,
- 1334, 1335, 1338, 1340, 1345, 1346, 1355, 1356, 1361, 1366,
- 1375, 1377, 1379, 1386, 1387, 1393, 1394, 1399, 1401, 1406,
- 1408, 1416, 1421, 1430, 1431, 1436, 1438, 1443, 1445, 1453,
- 1458, 1466, 1467, 1472, 1479, 1483, 1485, 1487, 1500, 1517,
- 1527, 1534, 1536, 1541, 1543, 1545, 1553, 1555, 1560, 1562,
- 1567, 1569, 1571, 1627, 1629, 1631, 1633, 1635, 1637, 1639,
- 1641, 1655, 1660, 1665, 1690, 1696, 1698, 1700, 1702, 1704,
- 1706, 1711, 1715, 1747, 1749, 1755, 1761, 1774, 1775, 1776,
- 1781, 1786, 1790, 1794, 1809, 1830, 1835, 1872, 1901, 1902,
- 1908, 1909, 1914, 1916, 1923, 1940, 1957, 1959, 1966, 1971,
- 1979, 1989, 2001, 2010, 2014, 2018, 2022, 2026, 2030, 2033,
- 2035, 2039, 2043, 2047
+ 433, 434, 438, 438, 484, 483, 517, 546, 548, 553,
+ 563, 610, 615, 616, 620, 622, 624, 631, 721, 763,
+ 805, 918, 925, 932, 943, 953, 963, 973, 985, 1002,
+ 1001, 1026, 1038, 1038, 1137, 1137, 1171, 1202, 1211, 1212,
+ 1218, 1219, 1226, 1231, 1243, 1257, 1259, 1267, 1274, 1276,
+ 1284, 1293, 1295, 1304, 1305, 1313, 1318, 1318, 1329, 1333,
+ 1341, 1342, 1345, 1347, 1352, 1353, 1362, 1363, 1368, 1373,
+ 1382, 1384, 1386, 1393, 1394, 1400, 1401, 1406, 1408, 1413,
+ 1415, 1423, 1428, 1437, 1438, 1443, 1445, 1450, 1452, 1460,
+ 1465, 1473, 1474, 1479, 1486, 1490, 1492, 1494, 1507, 1524,
+ 1534, 1541, 1543, 1548, 1550, 1552, 1560, 1562, 1567, 1569,
+ 1574, 1576, 1578, 1634, 1636, 1638, 1640, 1642, 1644, 1646,
+ 1648, 1662, 1667, 1672, 1697, 1703, 1705, 1707, 1709, 1711,
+ 1713, 1718, 1722, 1754, 1756, 1762, 1768, 1781, 1782, 1783,
+ 1788, 1793, 1797, 1801, 1816, 1837, 1842, 1879, 1908, 1909,
+ 1915, 1916, 1921, 1923, 1930, 1947, 1964, 1966, 1973, 1978,
+ 1986, 1996, 2008, 2017, 2021, 2025, 2029, 2033, 2037, 2040,
+ 2042, 2046, 2050, 2054
};
#endif
@@ -2274,7 +2274,7 @@ yyreduce:
case 36:
#line 518 "awkgram.y" /* yacc.c:1646 */
{
- NODE *n, *exp;
+ NODE *n, *exp, *n2;
char *re;
size_t len;
@@ -2283,26 +2283,33 @@ yyreduce:
len = strlen(re);
exp = make_str_node(re, len, ALREADY_MALLOCED);
- n = make_regnode(Node_val, exp);
+ n = make_regnode(Node_regex, exp);
if (n == NULL) {
unref(exp);
YYABORT;
}
+
+ n2 = make_string(re, len);
+ n2->typed_re = n;
+ n2->numbr = 0;
+ n2->flags |= NUMCUR|STRCUR|REGEX;
+ n2->flags &= ~(STRING|NUMBER);
+
(yyval) = (yyvsp[0]);
(yyval)->opcode = Op_push_re;
- (yyval)->memory = n;
+ (yyval)->memory = n2;
}
-#line 2296 "awkgram.c" /* yacc.c:1646 */
+#line 2303 "awkgram.c" /* yacc.c:1646 */
break;
case 37:
-#line 540 "awkgram.y" /* yacc.c:1646 */
+#line 547 "awkgram.y" /* yacc.c:1646 */
{ bcfree((yyvsp[0])); }
-#line 2302 "awkgram.c" /* yacc.c:1646 */
+#line 2309 "awkgram.c" /* yacc.c:1646 */
break;
case 39:
-#line 546 "awkgram.y" /* yacc.c:1646 */
+#line 553 "awkgram.y" /* yacc.c:1646 */
{
if (prior_comment != NULL) {
(yyval) = list_create(prior_comment);
@@ -2313,11 +2320,11 @@ yyreduce:
} else
(yyval) = NULL;
}
-#line 2317 "awkgram.c" /* yacc.c:1646 */
+#line 2324 "awkgram.c" /* yacc.c:1646 */
break;
case 40:
-#line 557 "awkgram.y" /* yacc.c:1646 */
+#line 564 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0]) == NULL) {
if (prior_comment != NULL) {
@@ -2364,40 +2371,40 @@ yyreduce:
}
yyerrok;
}
-#line 2368 "awkgram.c" /* yacc.c:1646 */
+#line 2375 "awkgram.c" /* yacc.c:1646 */
break;
case 41:
-#line 604 "awkgram.y" /* yacc.c:1646 */
+#line 611 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2374 "awkgram.c" /* yacc.c:1646 */
+#line 2381 "awkgram.c" /* yacc.c:1646 */
break;
case 44:
-#line 614 "awkgram.y" /* yacc.c:1646 */
+#line 621 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2380 "awkgram.c" /* yacc.c:1646 */
+#line 2387 "awkgram.c" /* yacc.c:1646 */
break;
case 45:
-#line 616 "awkgram.y" /* yacc.c:1646 */
+#line 623 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 2386 "awkgram.c" /* yacc.c:1646 */
+#line 2393 "awkgram.c" /* yacc.c:1646 */
break;
case 46:
-#line 618 "awkgram.y" /* yacc.c:1646 */
+#line 625 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]),
instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2397 "awkgram.c" /* yacc.c:1646 */
+#line 2404 "awkgram.c" /* yacc.c:1646 */
break;
case 47:
-#line 625 "awkgram.y" /* yacc.c:1646 */
+#line 632 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2487,11 +2494,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2491 "awkgram.c" /* yacc.c:1646 */
+#line 2498 "awkgram.c" /* yacc.c:1646 */
break;
case 48:
-#line 715 "awkgram.y" /* yacc.c:1646 */
+#line 722 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2533,11 +2540,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2537 "awkgram.c" /* yacc.c:1646 */
+#line 2544 "awkgram.c" /* yacc.c:1646 */
break;
case 49:
-#line 757 "awkgram.y" /* yacc.c:1646 */
+#line 764 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2579,11 +2586,11 @@ yyreduce:
} /* else
$1 and $4 are NULLs */
}
-#line 2583 "awkgram.c" /* yacc.c:1646 */
+#line 2590 "awkgram.c" /* yacc.c:1646 */
break;
case 50:
-#line 799 "awkgram.y" /* yacc.c:1646 */
+#line 806 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip;
char *var_name = (yyvsp[-5])->lextok;
@@ -2696,33 +2703,33 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2700 "awkgram.c" /* yacc.c:1646 */
+#line 2707 "awkgram.c" /* yacc.c:1646 */
break;
case 51:
-#line 912 "awkgram.y" /* yacc.c:1646 */
+#line 919 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]),
(yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2711 "awkgram.c" /* yacc.c:1646 */
+#line 2718 "awkgram.c" /* yacc.c:1646 */
break;
case 52:
-#line 919 "awkgram.y" /* yacc.c:1646 */
+#line 926 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION
*) NULL, (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2722 "awkgram.c" /* yacc.c:1646 */
+#line 2729 "awkgram.c" /* yacc.c:1646 */
break;
case 53:
-#line 926 "awkgram.y" /* yacc.c:1646 */
+#line 933 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]),
instruction(Op_exec_count));
@@ -2730,11 +2737,11 @@ regular_loop:
(yyval) = (yyvsp[0]);
(yyval) = add_pending_comment((yyval));
}
-#line 2734 "awkgram.c" /* yacc.c:1646 */
+#line 2741 "awkgram.c" /* yacc.c:1646 */
break;
case 54:
-#line 937 "awkgram.y" /* yacc.c:1646 */
+#line 944 "awkgram.y" /* yacc.c:1646 */
{
if (! break_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2744,11 +2751,11 @@ regular_loop:
(yyval) = add_pending_comment((yyval));
}
-#line 2748 "awkgram.c" /* yacc.c:1646 */
+#line 2755 "awkgram.c" /* yacc.c:1646 */
break;
case 55:
-#line 947 "awkgram.y" /* yacc.c:1646 */
+#line 954 "awkgram.y" /* yacc.c:1646 */
{
if (! continue_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2758,11 +2765,11 @@ regular_loop:
(yyval) = add_pending_comment((yyval));
}
-#line 2762 "awkgram.c" /* yacc.c:1646 */
+#line 2769 "awkgram.c" /* yacc.c:1646 */
break;
case 56:
-#line 957 "awkgram.y" /* yacc.c:1646 */
+#line 964 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2772,11 +2779,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
(yyval) = add_pending_comment((yyval));
}
-#line 2776 "awkgram.c" /* yacc.c:1646 */
+#line 2783 "awkgram.c" /* yacc.c:1646 */
break;
case 57:
-#line 967 "awkgram.y" /* yacc.c:1646 */
+#line 974 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2788,11 +2795,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
(yyval) = add_pending_comment((yyval));
}
-#line 2792 "awkgram.c" /* yacc.c:1646 */
+#line 2799 "awkgram.c" /* yacc.c:1646 */
break;
case 58:
-#line 979 "awkgram.y" /* yacc.c:1646 */
+#line 986 "awkgram.y" /* yacc.c:1646 */
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2808,20 +2815,20 @@ regular_loop:
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
(yyval) = add_pending_comment((yyval));
}
-#line 2812 "awkgram.c" /* yacc.c:1646 */
+#line 2819 "awkgram.c" /* yacc.c:1646 */
break;
case 59:
-#line 995 "awkgram.y" /* yacc.c:1646 */
+#line 1002 "awkgram.y" /* yacc.c:1646 */
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2821 "awkgram.c" /* yacc.c:1646 */
+#line 2828 "awkgram.c" /* yacc.c:1646 */
break;
case 60:
-#line 998 "awkgram.y" /* yacc.c:1646 */
+#line 1005 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL) {
(yyval) = list_create((yyvsp[-3]));
@@ -2843,17 +2850,17 @@ regular_loop:
}
(yyval) = add_pending_comment((yyval));
}
-#line 2847 "awkgram.c" /* yacc.c:1646 */
+#line 2854 "awkgram.c" /* yacc.c:1646 */
break;
case 62:
-#line 1031 "awkgram.y" /* yacc.c:1646 */
+#line 1038 "awkgram.y" /* yacc.c:1646 */
{ in_print = true; in_parens = 0; }
-#line 2853 "awkgram.c" /* yacc.c:1646 */
+#line 2860 "awkgram.c" /* yacc.c:1646 */
break;
case 63:
-#line 1032 "awkgram.y" /* yacc.c:1646 */
+#line 1039 "awkgram.y" /* yacc.c:1646 */
{
/*
* Optimization: plain `print' has no expression list, so $3 is
null.
@@ -2951,17 +2958,17 @@ regular_print:
}
(yyval) = add_pending_comment((yyval));
}
-#line 2955 "awkgram.c" /* yacc.c:1646 */
+#line 2962 "awkgram.c" /* yacc.c:1646 */
break;
case 64:
-#line 1130 "awkgram.y" /* yacc.c:1646 */
+#line 1137 "awkgram.y" /* yacc.c:1646 */
{ sub_counter = 0; }
-#line 2961 "awkgram.c" /* yacc.c:1646 */
+#line 2968 "awkgram.c" /* yacc.c:1646 */
break;
case 65:
-#line 1131 "awkgram.y" /* yacc.c:1646 */
+#line 1138 "awkgram.y" /* yacc.c:1646 */
{
char *arr = (yyvsp[-2])->lextok;
@@ -2995,11 +3002,11 @@ regular_print:
}
(yyval) = add_pending_comment((yyval));
}
-#line 2999 "awkgram.c" /* yacc.c:1646 */
+#line 3006 "awkgram.c" /* yacc.c:1646 */
break;
case 66:
-#line 1169 "awkgram.y" /* yacc.c:1646 */
+#line 1176 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
char *arr = (yyvsp[-1])->lextok;
@@ -3026,55 +3033,55 @@ regular_print:
}
(yyval) = add_pending_comment((yyval));
}
-#line 3030 "awkgram.c" /* yacc.c:1646 */
+#line 3037 "awkgram.c" /* yacc.c:1646 */
break;
case 67:
-#line 1196 "awkgram.y" /* yacc.c:1646 */
+#line 1203 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = optimize_assignment((yyvsp[0]));
(yyval) = add_pending_comment((yyval));
}
-#line 3039 "awkgram.c" /* yacc.c:1646 */
+#line 3046 "awkgram.c" /* yacc.c:1646 */
break;
case 68:
-#line 1204 "awkgram.y" /* yacc.c:1646 */
+#line 1211 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3045 "awkgram.c" /* yacc.c:1646 */
+#line 3052 "awkgram.c" /* yacc.c:1646 */
break;
case 69:
-#line 1206 "awkgram.y" /* yacc.c:1646 */
+#line 1213 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3051 "awkgram.c" /* yacc.c:1646 */
+#line 3058 "awkgram.c" /* yacc.c:1646 */
break;
case 70:
-#line 1211 "awkgram.y" /* yacc.c:1646 */
+#line 1218 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3057 "awkgram.c" /* yacc.c:1646 */
+#line 3064 "awkgram.c" /* yacc.c:1646 */
break;
case 71:
-#line 1213 "awkgram.y" /* yacc.c:1646 */
+#line 1220 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL)
(yyval) = list_create((yyvsp[0]));
else
(yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
}
-#line 3068 "awkgram.c" /* yacc.c:1646 */
+#line 3075 "awkgram.c" /* yacc.c:1646 */
break;
case 72:
-#line 1220 "awkgram.y" /* yacc.c:1646 */
+#line 1227 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3074 "awkgram.c" /* yacc.c:1646 */
+#line 3081 "awkgram.c" /* yacc.c:1646 */
break;
case 73:
-#line 1225 "awkgram.y" /* yacc.c:1646 */
+#line 1232 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -3086,11 +3093,11 @@ regular_print:
bcfree((yyvsp[-2]));
(yyval) = (yyvsp[-4]);
}
-#line 3090 "awkgram.c" /* yacc.c:1646 */
+#line 3097 "awkgram.c" /* yacc.c:1646 */
break;
case 74:
-#line 1237 "awkgram.y" /* yacc.c:1646 */
+#line 1244 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -3101,17 +3108,17 @@ regular_print:
(yyvsp[-3])->case_stmt = casestmt;
(yyval) = (yyvsp[-3]);
}
-#line 3105 "awkgram.c" /* yacc.c:1646 */
+#line 3112 "awkgram.c" /* yacc.c:1646 */
break;
case 75:
-#line 1251 "awkgram.y" /* yacc.c:1646 */
+#line 1258 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3111 "awkgram.c" /* yacc.c:1646 */
+#line 3118 "awkgram.c" /* yacc.c:1646 */
break;
case 76:
-#line 1253 "awkgram.y" /* yacc.c:1646 */
+#line 1260 "awkgram.y" /* yacc.c:1646 */
{
NODE *n = (yyvsp[0])->memory;
(void) force_number(n);
@@ -3119,28 +3126,28 @@ regular_print:
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3123 "awkgram.c" /* yacc.c:1646 */
+#line 3130 "awkgram.c" /* yacc.c:1646 */
break;
case 77:
-#line 1261 "awkgram.y" /* yacc.c:1646 */
+#line 1268 "awkgram.y" /* yacc.c:1646 */
{
NODE *n = (yyvsp[0])->lasti->memory;
bcfree((yyvsp[-1]));
add_sign_to_num(n, '+');
(yyval) = (yyvsp[0]);
}
-#line 3134 "awkgram.c" /* yacc.c:1646 */
+#line 3141 "awkgram.c" /* yacc.c:1646 */
break;
case 78:
-#line 1268 "awkgram.y" /* yacc.c:1646 */
+#line 1275 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3140 "awkgram.c" /* yacc.c:1646 */
+#line 3147 "awkgram.c" /* yacc.c:1646 */
break;
case 79:
-#line 1270 "awkgram.y" /* yacc.c:1646 */
+#line 1277 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->memory->type == Node_regex)
(yyvsp[0])->opcode = Op_push_re;
@@ -3148,57 +3155,57 @@ regular_print:
(yyvsp[0])->opcode = Op_push;
(yyval) = (yyvsp[0]);
}
-#line 3152 "awkgram.c" /* yacc.c:1646 */
+#line 3159 "awkgram.c" /* yacc.c:1646 */
break;
case 80:
-#line 1278 "awkgram.y" /* yacc.c:1646 */
+#line 1285 "awkgram.y" /* yacc.c:1646 */
{
assert(((yyvsp[0])->memory->flags & REGEX) == REGEX);
(yyvsp[0])->opcode = Op_push_re;
(yyval) = (yyvsp[0]);
}
-#line 3162 "awkgram.c" /* yacc.c:1646 */
+#line 3169 "awkgram.c" /* yacc.c:1646 */
break;
case 81:
-#line 1287 "awkgram.y" /* yacc.c:1646 */
+#line 1294 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3168 "awkgram.c" /* yacc.c:1646 */
+#line 3175 "awkgram.c" /* yacc.c:1646 */
break;
case 82:
-#line 1289 "awkgram.y" /* yacc.c:1646 */
+#line 1296 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3174 "awkgram.c" /* yacc.c:1646 */
+#line 3181 "awkgram.c" /* yacc.c:1646 */
break;
case 84:
-#line 1299 "awkgram.y" /* yacc.c:1646 */
+#line 1306 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = (yyvsp[-1]);
}
-#line 3182 "awkgram.c" /* yacc.c:1646 */
+#line 3189 "awkgram.c" /* yacc.c:1646 */
break;
case 85:
-#line 1306 "awkgram.y" /* yacc.c:1646 */
+#line 1313 "awkgram.y" /* yacc.c:1646 */
{
in_print = false;
in_parens = 0;
(yyval) = NULL;
}
-#line 3192 "awkgram.c" /* yacc.c:1646 */
+#line 3199 "awkgram.c" /* yacc.c:1646 */
break;
case 86:
-#line 1311 "awkgram.y" /* yacc.c:1646 */
+#line 1318 "awkgram.y" /* yacc.c:1646 */
{ in_print = false; in_parens = 0; }
-#line 3198 "awkgram.c" /* yacc.c:1646 */
+#line 3205 "awkgram.c" /* yacc.c:1646 */
break;
case 87:
-#line 1312 "awkgram.y" /* yacc.c:1646 */
+#line 1319 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->redir_type == redirect_twoway
&& (yyvsp[0])->lasti->opcode == Op_K_getline_redir
@@ -3206,63 +3213,63 @@ regular_print:
yyerror(_("multistage two-way pipelines don't work"));
(yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
}
-#line 3210 "awkgram.c" /* yacc.c:1646 */
+#line 3217 "awkgram.c" /* yacc.c:1646 */
break;
case 88:
-#line 1323 "awkgram.y" /* yacc.c:1646 */
+#line 1330 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]),
NULL, NULL);
}
-#line 3218 "awkgram.c" /* yacc.c:1646 */
+#line 3225 "awkgram.c" /* yacc.c:1646 */
break;
case 89:
-#line 1328 "awkgram.y" /* yacc.c:1646 */
+#line 1335 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]),
(yyvsp[-2]), (yyvsp[0]));
}
-#line 3226 "awkgram.c" /* yacc.c:1646 */
+#line 3233 "awkgram.c" /* yacc.c:1646 */
break;
case 94:
-#line 1345 "awkgram.y" /* yacc.c:1646 */
+#line 1352 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3232 "awkgram.c" /* yacc.c:1646 */
+#line 3239 "awkgram.c" /* yacc.c:1646 */
break;
case 95:
-#line 1347 "awkgram.y" /* yacc.c:1646 */
+#line 1354 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3241 "awkgram.c" /* yacc.c:1646 */
+#line 3248 "awkgram.c" /* yacc.c:1646 */
break;
case 96:
-#line 1355 "awkgram.y" /* yacc.c:1646 */
+#line 1362 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3247 "awkgram.c" /* yacc.c:1646 */
+#line 3254 "awkgram.c" /* yacc.c:1646 */
break;
case 97:
-#line 1357 "awkgram.y" /* yacc.c:1646 */
+#line 1364 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3253 "awkgram.c" /* yacc.c:1646 */
+#line 3260 "awkgram.c" /* yacc.c:1646 */
break;
case 98:
-#line 1362 "awkgram.y" /* yacc.c:1646 */
+#line 1369 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->param_count = 0;
(yyval) = list_create((yyvsp[0]));
}
-#line 3262 "awkgram.c" /* yacc.c:1646 */
+#line 3269 "awkgram.c" /* yacc.c:1646 */
break;
case 99:
-#line 1367 "awkgram.y" /* yacc.c:1646 */
+#line 1374 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2]) != NULL && (yyvsp[0]) != NULL) {
(yyvsp[0])->param_count =
(yyvsp[-2])->lasti->param_count + 1;
@@ -3271,74 +3278,74 @@ regular_print:
} else
(yyval) = NULL;
}
-#line 3275 "awkgram.c" /* yacc.c:1646 */
+#line 3282 "awkgram.c" /* yacc.c:1646 */
break;
case 100:
-#line 1376 "awkgram.y" /* yacc.c:1646 */
+#line 1383 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3281 "awkgram.c" /* yacc.c:1646 */
+#line 3288 "awkgram.c" /* yacc.c:1646 */
break;
case 101:
-#line 1378 "awkgram.y" /* yacc.c:1646 */
+#line 1385 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3287 "awkgram.c" /* yacc.c:1646 */
+#line 3294 "awkgram.c" /* yacc.c:1646 */
break;
case 102:
-#line 1380 "awkgram.y" /* yacc.c:1646 */
+#line 1387 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]); }
-#line 3293 "awkgram.c" /* yacc.c:1646 */
+#line 3300 "awkgram.c" /* yacc.c:1646 */
break;
case 103:
-#line 1386 "awkgram.y" /* yacc.c:1646 */
+#line 1393 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3299 "awkgram.c" /* yacc.c:1646 */
+#line 3306 "awkgram.c" /* yacc.c:1646 */
break;
case 104:
-#line 1388 "awkgram.y" /* yacc.c:1646 */
+#line 1395 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3305 "awkgram.c" /* yacc.c:1646 */
+#line 3312 "awkgram.c" /* yacc.c:1646 */
break;
case 105:
-#line 1393 "awkgram.y" /* yacc.c:1646 */
+#line 1400 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3311 "awkgram.c" /* yacc.c:1646 */
+#line 3318 "awkgram.c" /* yacc.c:1646 */
break;
case 106:
-#line 1395 "awkgram.y" /* yacc.c:1646 */
+#line 1402 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3317 "awkgram.c" /* yacc.c:1646 */
+#line 3324 "awkgram.c" /* yacc.c:1646 */
break;
case 107:
-#line 1400 "awkgram.y" /* yacc.c:1646 */
+#line 1407 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3323 "awkgram.c" /* yacc.c:1646 */
+#line 3330 "awkgram.c" /* yacc.c:1646 */
break;
case 108:
-#line 1402 "awkgram.y" /* yacc.c:1646 */
+#line 1409 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3332 "awkgram.c" /* yacc.c:1646 */
+#line 3339 "awkgram.c" /* yacc.c:1646 */
break;
case 109:
-#line 1407 "awkgram.y" /* yacc.c:1646 */
+#line 1414 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3338 "awkgram.c" /* yacc.c:1646 */
+#line 3345 "awkgram.c" /* yacc.c:1646 */
break;
case 110:
-#line 1409 "awkgram.y" /* yacc.c:1646 */
+#line 1416 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3346,62 +3353,62 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3350 "awkgram.c" /* yacc.c:1646 */
+#line 3357 "awkgram.c" /* yacc.c:1646 */
break;
case 111:
-#line 1417 "awkgram.y" /* yacc.c:1646 */
+#line 1424 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3359 "awkgram.c" /* yacc.c:1646 */
+#line 3366 "awkgram.c" /* yacc.c:1646 */
break;
case 112:
-#line 1422 "awkgram.y" /* yacc.c:1646 */
+#line 1429 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3368 "awkgram.c" /* yacc.c:1646 */
+#line 3375 "awkgram.c" /* yacc.c:1646 */
break;
case 113:
-#line 1430 "awkgram.y" /* yacc.c:1646 */
+#line 1437 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3374 "awkgram.c" /* yacc.c:1646 */
+#line 3381 "awkgram.c" /* yacc.c:1646 */
break;
case 114:
-#line 1432 "awkgram.y" /* yacc.c:1646 */
+#line 1439 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3380 "awkgram.c" /* yacc.c:1646 */
+#line 3387 "awkgram.c" /* yacc.c:1646 */
break;
case 115:
-#line 1437 "awkgram.y" /* yacc.c:1646 */
+#line 1444 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3386 "awkgram.c" /* yacc.c:1646 */
+#line 3393 "awkgram.c" /* yacc.c:1646 */
break;
case 116:
-#line 1439 "awkgram.y" /* yacc.c:1646 */
+#line 1446 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3395 "awkgram.c" /* yacc.c:1646 */
+#line 3402 "awkgram.c" /* yacc.c:1646 */
break;
case 117:
-#line 1444 "awkgram.y" /* yacc.c:1646 */
+#line 1451 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3401 "awkgram.c" /* yacc.c:1646 */
+#line 3408 "awkgram.c" /* yacc.c:1646 */
break;
case 118:
-#line 1446 "awkgram.y" /* yacc.c:1646 */
+#line 1453 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3409,72 +3416,72 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3413 "awkgram.c" /* yacc.c:1646 */
+#line 3420 "awkgram.c" /* yacc.c:1646 */
break;
case 119:
-#line 1454 "awkgram.y" /* yacc.c:1646 */
+#line 1461 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3422 "awkgram.c" /* yacc.c:1646 */
+#line 3429 "awkgram.c" /* yacc.c:1646 */
break;
case 120:
-#line 1459 "awkgram.y" /* yacc.c:1646 */
+#line 1466 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3431 "awkgram.c" /* yacc.c:1646 */
+#line 3438 "awkgram.c" /* yacc.c:1646 */
break;
case 121:
-#line 1466 "awkgram.y" /* yacc.c:1646 */
+#line 1473 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3437 "awkgram.c" /* yacc.c:1646 */
+#line 3444 "awkgram.c" /* yacc.c:1646 */
break;
case 122:
-#line 1467 "awkgram.y" /* yacc.c:1646 */
+#line 1474 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = list_create((yyvsp[0])); }
-#line 3443 "awkgram.c" /* yacc.c:1646 */
+#line 3450 "awkgram.c" /* yacc.c:1646 */
break;
case 123:
-#line 1473 "awkgram.y" /* yacc.c:1646 */
+#line 1480 "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 3454 "awkgram.c" /* yacc.c:1646 */
+#line 3461 "awkgram.c" /* yacc.c:1646 */
break;
case 124:
-#line 1480 "awkgram.y" /* yacc.c:1646 */
+#line 1487 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_assignment((yyvsp[-2]), list_create((yyvsp[0])),
(yyvsp[-1]));
}
-#line 3462 "awkgram.c" /* yacc.c:1646 */
+#line 3469 "awkgram.c" /* yacc.c:1646 */
break;
case 125:
-#line 1484 "awkgram.y" /* yacc.c:1646 */
+#line 1491 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3468 "awkgram.c" /* yacc.c:1646 */
+#line 3475 "awkgram.c" /* yacc.c:1646 */
break;
case 126:
-#line 1486 "awkgram.y" /* yacc.c:1646 */
+#line 1493 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3474 "awkgram.c" /* yacc.c:1646 */
+#line 3481 "awkgram.c" /* yacc.c:1646 */
break;
case 127:
-#line 1488 "awkgram.y" /* yacc.c:1646 */
+#line 1495 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
@@ -3487,11 +3494,11 @@ regular_print:
bcfree((yyvsp[0]));
(yyval) = list_append((yyvsp[-2]), (yyvsp[-1]));
}
-#line 3491 "awkgram.c" /* yacc.c:1646 */
+#line 3498 "awkgram.c" /* yacc.c:1646 */
break;
case 128:
-#line 1501 "awkgram.y" /* yacc.c:1646 */
+#line 1508 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
@@ -3508,11 +3515,11 @@ regular_print:
(yyval) = list_append(list_merge((yyvsp[-2]),
(yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3512 "awkgram.c" /* yacc.c:1646 */
+#line 3519 "awkgram.c" /* yacc.c:1646 */
break;
case 129:
-#line 1518 "awkgram.y" /* yacc.c:1646 */
+#line 1525 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old)
warning_ln((yyvsp[-1])->source_line,
@@ -3522,91 +3529,91 @@ regular_print:
(yyvsp[-1])->expr_count = 1;
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])),
(yyvsp[-1]));
}
-#line 3526 "awkgram.c" /* yacc.c:1646 */
+#line 3533 "awkgram.c" /* yacc.c:1646 */
break;
case 130:
-#line 1528 "awkgram.y" /* yacc.c:1646 */
+#line 1535 "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 3537 "awkgram.c" /* yacc.c:1646 */
+#line 3544 "awkgram.c" /* yacc.c:1646 */
break;
case 131:
-#line 1535 "awkgram.y" /* yacc.c:1646 */
+#line 1542 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]),
(yyvsp[-1]), (yyvsp[0])); }
-#line 3543 "awkgram.c" /* yacc.c:1646 */
+#line 3550 "awkgram.c" /* yacc.c:1646 */
break;
case 132:
-#line 1537 "awkgram.y" /* yacc.c:1646 */
+#line 1544 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3549 "awkgram.c" /* yacc.c:1646 */
+#line 3556 "awkgram.c" /* yacc.c:1646 */
break;
case 133:
-#line 1542 "awkgram.y" /* yacc.c:1646 */
+#line 1549 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3555 "awkgram.c" /* yacc.c:1646 */
+#line 3562 "awkgram.c" /* yacc.c:1646 */
break;
case 134:
-#line 1544 "awkgram.y" /* yacc.c:1646 */
+#line 1551 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3561 "awkgram.c" /* yacc.c:1646 */
+#line 3568 "awkgram.c" /* yacc.c:1646 */
break;
case 135:
-#line 1546 "awkgram.y" /* yacc.c:1646 */
+#line 1553 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[0]);
}
-#line 3570 "awkgram.c" /* yacc.c:1646 */
+#line 3577 "awkgram.c" /* yacc.c:1646 */
break;
case 136:
-#line 1554 "awkgram.y" /* yacc.c:1646 */
+#line 1561 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3576 "awkgram.c" /* yacc.c:1646 */
+#line 3583 "awkgram.c" /* yacc.c:1646 */
break;
case 137:
-#line 1556 "awkgram.y" /* yacc.c:1646 */
+#line 1563 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3582 "awkgram.c" /* yacc.c:1646 */
+#line 3589 "awkgram.c" /* yacc.c:1646 */
break;
case 138:
-#line 1561 "awkgram.y" /* yacc.c:1646 */
+#line 1568 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3588 "awkgram.c" /* yacc.c:1646 */
+#line 3595 "awkgram.c" /* yacc.c:1646 */
break;
case 139:
-#line 1563 "awkgram.y" /* yacc.c:1646 */
+#line 1570 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3594 "awkgram.c" /* yacc.c:1646 */
+#line 3601 "awkgram.c" /* yacc.c:1646 */
break;
case 140:
-#line 1568 "awkgram.y" /* yacc.c:1646 */
+#line 1575 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3600 "awkgram.c" /* yacc.c:1646 */
+#line 3607 "awkgram.c" /* yacc.c:1646 */
break;
case 141:
-#line 1570 "awkgram.y" /* yacc.c:1646 */
+#line 1577 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3606 "awkgram.c" /* yacc.c:1646 */
+#line 3613 "awkgram.c" /* yacc.c:1646 */
break;
case 142:
-#line 1572 "awkgram.y" /* yacc.c:1646 */
+#line 1579 "awkgram.y" /* yacc.c:1646 */
{
int count = 2;
bool is_simple_var = false;
@@ -3659,47 +3666,47 @@ regular_print:
max_args = count;
}
}
-#line 3663 "awkgram.c" /* yacc.c:1646 */
+#line 3670 "awkgram.c" /* yacc.c:1646 */
break;
case 144:
-#line 1630 "awkgram.y" /* yacc.c:1646 */
+#line 1637 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3669 "awkgram.c" /* yacc.c:1646 */
+#line 3676 "awkgram.c" /* yacc.c:1646 */
break;
case 145:
-#line 1632 "awkgram.y" /* yacc.c:1646 */
+#line 1639 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3675 "awkgram.c" /* yacc.c:1646 */
+#line 3682 "awkgram.c" /* yacc.c:1646 */
break;
case 146:
-#line 1634 "awkgram.y" /* yacc.c:1646 */
+#line 1641 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3681 "awkgram.c" /* yacc.c:1646 */
+#line 3688 "awkgram.c" /* yacc.c:1646 */
break;
case 147:
-#line 1636 "awkgram.y" /* yacc.c:1646 */
+#line 1643 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3687 "awkgram.c" /* yacc.c:1646 */
+#line 3694 "awkgram.c" /* yacc.c:1646 */
break;
case 148:
-#line 1638 "awkgram.y" /* yacc.c:1646 */
+#line 1645 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3693 "awkgram.c" /* yacc.c:1646 */
+#line 3700 "awkgram.c" /* yacc.c:1646 */
break;
case 149:
-#line 1640 "awkgram.y" /* yacc.c:1646 */
+#line 1647 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3699 "awkgram.c" /* yacc.c:1646 */
+#line 3706 "awkgram.c" /* yacc.c:1646 */
break;
case 150:
-#line 1642 "awkgram.y" /* yacc.c:1646 */
+#line 1649 "awkgram.y" /* yacc.c:1646 */
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3713,29 +3720,29 @@ regular_print:
_("non-redirected `getline' undefined inside
END action"));
(yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]),
redirect_input);
}
-#line 3717 "awkgram.c" /* yacc.c:1646 */
+#line 3724 "awkgram.c" /* yacc.c:1646 */
break;
case 151:
-#line 1656 "awkgram.y" /* yacc.c:1646 */
+#line 1663 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3726 "awkgram.c" /* yacc.c:1646 */
+#line 3733 "awkgram.c" /* yacc.c:1646 */
break;
case 152:
-#line 1661 "awkgram.y" /* yacc.c:1646 */
+#line 1668 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3735 "awkgram.c" /* yacc.c:1646 */
+#line 3742 "awkgram.c" /* yacc.c:1646 */
break;
case 153:
-#line 1666 "awkgram.y" /* yacc.c:1646 */
+#line 1673 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old) {
warning_ln((yyvsp[-1])->source_line,
@@ -3755,64 +3762,64 @@ regular_print:
(yyval) = list_append(list_merge(t, (yyvsp[0])),
(yyvsp[-1]));
}
}
-#line 3759 "awkgram.c" /* yacc.c:1646 */
+#line 3766 "awkgram.c" /* yacc.c:1646 */
break;
case 154:
-#line 1691 "awkgram.y" /* yacc.c:1646 */
+#line 1698 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]),
(yyvsp[-2])->redir_type);
bcfree((yyvsp[-2]));
}
-#line 3768 "awkgram.c" /* yacc.c:1646 */
+#line 3775 "awkgram.c" /* yacc.c:1646 */
break;
case 155:
-#line 1697 "awkgram.y" /* yacc.c:1646 */
+#line 1704 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3774 "awkgram.c" /* yacc.c:1646 */
+#line 3781 "awkgram.c" /* yacc.c:1646 */
break;
case 156:
-#line 1699 "awkgram.y" /* yacc.c:1646 */
+#line 1706 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3780 "awkgram.c" /* yacc.c:1646 */
+#line 3787 "awkgram.c" /* yacc.c:1646 */
break;
case 157:
-#line 1701 "awkgram.y" /* yacc.c:1646 */
+#line 1708 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3786 "awkgram.c" /* yacc.c:1646 */
+#line 3793 "awkgram.c" /* yacc.c:1646 */
break;
case 158:
-#line 1703 "awkgram.y" /* yacc.c:1646 */
+#line 1710 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3792 "awkgram.c" /* yacc.c:1646 */
+#line 3799 "awkgram.c" /* yacc.c:1646 */
break;
case 159:
-#line 1705 "awkgram.y" /* yacc.c:1646 */
+#line 1712 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3798 "awkgram.c" /* yacc.c:1646 */
+#line 3805 "awkgram.c" /* yacc.c:1646 */
break;
case 160:
-#line 1707 "awkgram.y" /* yacc.c:1646 */
+#line 1714 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3804 "awkgram.c" /* yacc.c:1646 */
+#line 3811 "awkgram.c" /* yacc.c:1646 */
break;
case 161:
-#line 1712 "awkgram.y" /* yacc.c:1646 */
+#line 1719 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3812 "awkgram.c" /* yacc.c:1646 */
+#line 3819 "awkgram.c" /* yacc.c:1646 */
break;
case 162:
-#line 1716 "awkgram.y" /* yacc.c:1646 */
+#line 1723 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->opcode == Op_match_rec) {
(yyvsp[0])->opcode = Op_nomatch;
@@ -3844,37 +3851,37 @@ regular_print:
}
}
}
-#line 3848 "awkgram.c" /* yacc.c:1646 */
+#line 3855 "awkgram.c" /* yacc.c:1646 */
break;
case 163:
-#line 1748 "awkgram.y" /* yacc.c:1646 */
+#line 1755 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3854 "awkgram.c" /* yacc.c:1646 */
+#line 3861 "awkgram.c" /* yacc.c:1646 */
break;
case 164:
-#line 1750 "awkgram.y" /* yacc.c:1646 */
+#line 1757 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3864 "awkgram.c" /* yacc.c:1646 */
+#line 3871 "awkgram.c" /* yacc.c:1646 */
break;
case 165:
-#line 1756 "awkgram.y" /* yacc.c:1646 */
+#line 1763 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3874 "awkgram.c" /* yacc.c:1646 */
+#line 3881 "awkgram.c" /* yacc.c:1646 */
break;
case 166:
-#line 1762 "awkgram.y" /* yacc.c:1646 */
+#line 1769 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
@@ -3887,45 +3894,45 @@ regular_print:
if ((yyval) == NULL)
YYABORT;
}
-#line 3891 "awkgram.c" /* yacc.c:1646 */
+#line 3898 "awkgram.c" /* yacc.c:1646 */
break;
case 169:
-#line 1777 "awkgram.y" /* yacc.c:1646 */
+#line 1784 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3900 "awkgram.c" /* yacc.c:1646 */
+#line 3907 "awkgram.c" /* yacc.c:1646 */
break;
case 170:
-#line 1782 "awkgram.y" /* yacc.c:1646 */
+#line 1789 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3909 "awkgram.c" /* yacc.c:1646 */
+#line 3916 "awkgram.c" /* yacc.c:1646 */
break;
case 171:
-#line 1787 "awkgram.y" /* yacc.c:1646 */
+#line 1794 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3917 "awkgram.c" /* yacc.c:1646 */
+#line 3924 "awkgram.c" /* yacc.c:1646 */
break;
case 172:
-#line 1791 "awkgram.y" /* yacc.c:1646 */
+#line 1798 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3925 "awkgram.c" /* yacc.c:1646 */
+#line 3932 "awkgram.c" /* yacc.c:1646 */
break;
case 173:
-#line 1795 "awkgram.y" /* yacc.c:1646 */
+#line 1802 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->lasti->opcode == Op_push_i
&& ((yyvsp[0])->lasti->memory->flags & STRING) == 0
@@ -3940,11 +3947,11 @@ regular_print:
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
}
-#line 3944 "awkgram.c" /* yacc.c:1646 */
+#line 3951 "awkgram.c" /* yacc.c:1646 */
break;
case 174:
-#line 1810 "awkgram.y" /* yacc.c:1646 */
+#line 1817 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->lasti->opcode == Op_push_i
&& ((yyvsp[0])->lasti->memory->flags & STRING) == 0
@@ -3962,20 +3969,20 @@ regular_print:
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
}
-#line 3966 "awkgram.c" /* yacc.c:1646 */
+#line 3973 "awkgram.c" /* yacc.c:1646 */
break;
case 175:
-#line 1831 "awkgram.y" /* yacc.c:1646 */
+#line 1838 "awkgram.y" /* yacc.c:1646 */
{
func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[0]);
}
-#line 3975 "awkgram.c" /* yacc.c:1646 */
+#line 3982 "awkgram.c" /* yacc.c:1646 */
break;
case 176:
-#line 1836 "awkgram.y" /* yacc.c:1646 */
+#line 1843 "awkgram.y" /* yacc.c:1646 */
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -4009,11 +4016,11 @@ regular_print:
(yyval) = list_prepend((yyvsp[0]), t);
at_seen = false;
}
-#line 4013 "awkgram.c" /* yacc.c:1646 */
+#line 4020 "awkgram.c" /* yacc.c:1646 */
break;
case 177:
-#line 1873 "awkgram.y" /* yacc.c:1646 */
+#line 1880 "awkgram.y" /* yacc.c:1646 */
{
NODE *n;
@@ -4038,49 +4045,49 @@ regular_print:
(yyval) = list_append(t, (yyvsp[-3]));
}
}
-#line 4042 "awkgram.c" /* yacc.c:1646 */
+#line 4049 "awkgram.c" /* yacc.c:1646 */
break;
case 178:
-#line 1901 "awkgram.y" /* yacc.c:1646 */
+#line 1908 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 4048 "awkgram.c" /* yacc.c:1646 */
+#line 4055 "awkgram.c" /* yacc.c:1646 */
break;
case 179:
-#line 1903 "awkgram.y" /* yacc.c:1646 */
+#line 1910 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 4054 "awkgram.c" /* yacc.c:1646 */
+#line 4061 "awkgram.c" /* yacc.c:1646 */
break;
case 180:
-#line 1908 "awkgram.y" /* yacc.c:1646 */
+#line 1915 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 4060 "awkgram.c" /* yacc.c:1646 */
+#line 4067 "awkgram.c" /* yacc.c:1646 */
break;
case 181:
-#line 1910 "awkgram.y" /* yacc.c:1646 */
+#line 1917 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 4066 "awkgram.c" /* yacc.c:1646 */
+#line 4073 "awkgram.c" /* yacc.c:1646 */
break;
case 182:
-#line 1915 "awkgram.y" /* yacc.c:1646 */
+#line 1922 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 4072 "awkgram.c" /* yacc.c:1646 */
+#line 4079 "awkgram.c" /* yacc.c:1646 */
break;
case 183:
-#line 1917 "awkgram.y" /* yacc.c:1646 */
+#line 1924 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 4080 "awkgram.c" /* yacc.c:1646 */
+#line 4087 "awkgram.c" /* yacc.c:1646 */
break;
case 184:
-#line 1924 "awkgram.y" /* yacc.c:1646 */
+#line 1931 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated
expressions */
@@ -4094,11 +4101,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
(yyval) = (yyvsp[0]);
}
-#line 4098 "awkgram.c" /* yacc.c:1646 */
+#line 4105 "awkgram.c" /* yacc.c:1646 */
break;
case 185:
-#line 1941 "awkgram.y" /* yacc.c:1646 */
+#line 1948 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *t = (yyvsp[-1]);
if ((yyvsp[-1]) == NULL) {
@@ -4112,31 +4119,31 @@ regular_print:
(yyvsp[0])->sub_count = count_expressions(&t, false);
(yyval) = list_append(t, (yyvsp[0]));
}
-#line 4116 "awkgram.c" /* yacc.c:1646 */
+#line 4123 "awkgram.c" /* yacc.c:1646 */
break;
case 186:
-#line 1958 "awkgram.y" /* yacc.c:1646 */
+#line 1965 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 4122 "awkgram.c" /* yacc.c:1646 */
+#line 4129 "awkgram.c" /* yacc.c:1646 */
break;
case 187:
-#line 1960 "awkgram.y" /* yacc.c:1646 */
+#line 1967 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 4130 "awkgram.c" /* yacc.c:1646 */
+#line 4137 "awkgram.c" /* yacc.c:1646 */
break;
case 188:
-#line 1967 "awkgram.y" /* yacc.c:1646 */
+#line 1974 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 4136 "awkgram.c" /* yacc.c:1646 */
+#line 4143 "awkgram.c" /* yacc.c:1646 */
break;
case 189:
-#line 1972 "awkgram.y" /* yacc.c:1646 */
+#line 1979 "awkgram.y" /* yacc.c:1646 */
{
char *var_name = (yyvsp[0])->lextok;
@@ -4144,22 +4151,22 @@ regular_print:
(yyvsp[0])->memory = variable((yyvsp[0])->source_line,
var_name, Node_var_new);
(yyval) = list_create((yyvsp[0]));
}
-#line 4148 "awkgram.c" /* yacc.c:1646 */
+#line 4155 "awkgram.c" /* yacc.c:1646 */
break;
case 190:
-#line 1980 "awkgram.y" /* yacc.c:1646 */
+#line 1987 "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 4159 "awkgram.c" /* yacc.c:1646 */
+#line 4166 "awkgram.c" /* yacc.c:1646 */
break;
case 191:
-#line 1990 "awkgram.y" /* yacc.c:1646 */
+#line 1997 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->nexti;
if (ip->opcode == Op_push
@@ -4171,73 +4178,73 @@ regular_print:
} else
(yyval) = (yyvsp[0]);
}
-#line 4175 "awkgram.c" /* yacc.c:1646 */
+#line 4182 "awkgram.c" /* yacc.c:1646 */
break;
case 192:
-#line 2002 "awkgram.y" /* yacc.c:1646 */
+#line 2009 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
if ((yyvsp[0]) != NULL)
mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 4185 "awkgram.c" /* yacc.c:1646 */
+#line 4192 "awkgram.c" /* yacc.c:1646 */
break;
case 193:
-#line 2011 "awkgram.y" /* yacc.c:1646 */
+#line 2018 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
}
-#line 4193 "awkgram.c" /* yacc.c:1646 */
+#line 4200 "awkgram.c" /* yacc.c:1646 */
break;
case 194:
-#line 2015 "awkgram.y" /* yacc.c:1646 */
+#line 2022 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
}
-#line 4201 "awkgram.c" /* yacc.c:1646 */
+#line 4208 "awkgram.c" /* yacc.c:1646 */
break;
case 195:
-#line 2018 "awkgram.y" /* yacc.c:1646 */
+#line 2025 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 4207 "awkgram.c" /* yacc.c:1646 */
+#line 4214 "awkgram.c" /* yacc.c:1646 */
break;
case 197:
-#line 2026 "awkgram.y" /* yacc.c:1646 */
+#line 2033 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4213 "awkgram.c" /* yacc.c:1646 */
+#line 4220 "awkgram.c" /* yacc.c:1646 */
break;
case 198:
-#line 2030 "awkgram.y" /* yacc.c:1646 */
+#line 2037 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4219 "awkgram.c" /* yacc.c:1646 */
+#line 4226 "awkgram.c" /* yacc.c:1646 */
break;
case 201:
-#line 2039 "awkgram.y" /* yacc.c:1646 */
+#line 2046 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4225 "awkgram.c" /* yacc.c:1646 */
+#line 4232 "awkgram.c" /* yacc.c:1646 */
break;
case 202:
-#line 2043 "awkgram.y" /* yacc.c:1646 */
+#line 2050 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); yyerrok; }
-#line 4231 "awkgram.c" /* yacc.c:1646 */
+#line 4238 "awkgram.c" /* yacc.c:1646 */
break;
case 203:
-#line 2047 "awkgram.y" /* yacc.c:1646 */
+#line 2054 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4237 "awkgram.c" /* yacc.c:1646 */
+#line 4244 "awkgram.c" /* yacc.c:1646 */
break;
-#line 4241 "awkgram.c" /* yacc.c:1646 */
+#line 4248 "awkgram.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4465,7 +4472,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 2049 "awkgram.y" /* yacc.c:1906 */
+#line 2056 "awkgram.y" /* yacc.c:1906 */
struct token {
@@ -7426,9 +7433,9 @@ make_regnode(int type, NODE *exp)
getnode(n);
memset(n, 0, sizeof(NODE));
n->type = type;
+ n->re_cnt = 1;
if (type == Node_regex) {
- n->re_cnt = 1;
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true,
false);
if (n->re_reg == NULL) {
freenode(n);
@@ -7437,14 +7444,6 @@ make_regnode(int type, NODE *exp)
n->re_exp = exp;
n->re_flags = CONSTANT;
n->valref = 1;
- } else if (type == Node_val) {
- exp->tre_regs = make_regexp(exp->stptr, exp->stlen, false,
true, false);
- exp->flags |= REGEX|MALLOC|STRCUR|NUMCUR;
- exp->numbr = 0;
- exp->flags &= ~(STRING|NUMBER);
- exp->valref = 1;
- unref(n);
- n = exp;
}
return n;
}
diff --git a/awkgram.y b/awkgram.y
index 4df22a6..ccbf93a 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -516,7 +516,7 @@ regexp
typed_regexp
: TYPED_REGEXP
{
- NODE *n, *exp;
+ NODE *n, *exp, *n2;
char *re;
size_t len;
@@ -525,14 +525,21 @@ typed_regexp
len = strlen(re);
exp = make_str_node(re, len, ALREADY_MALLOCED);
- n = make_regnode(Node_val, exp);
+ n = make_regnode(Node_regex, exp);
if (n == NULL) {
unref(exp);
YYABORT;
}
+
+ n2 = make_string(re, len);
+ n2->typed_re = n;
+ n2->numbr = 0;
+ n2->flags |= NUMCUR|STRCUR|REGEX;
+ n2->flags &= ~(STRING|NUMBER);
+
$$ = $1;
$$->opcode = Op_push_re;
- $$->memory = n;
+ $$->memory = n2;
}
a_slash
@@ -5006,9 +5013,9 @@ make_regnode(int type, NODE *exp)
getnode(n);
memset(n, 0, sizeof(NODE));
n->type = type;
+ n->re_cnt = 1;
if (type == Node_regex) {
- n->re_cnt = 1;
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true,
false);
if (n->re_reg == NULL) {
freenode(n);
@@ -5017,14 +5024,6 @@ make_regnode(int type, NODE *exp)
n->re_exp = exp;
n->re_flags = CONSTANT;
n->valref = 1;
- } else if (type == Node_val) {
- exp->tre_regs = make_regexp(exp->stptr, exp->stlen, false,
true, false);
- exp->flags |= REGEX|MALLOC|STRCUR|NUMCUR;
- exp->numbr = 0;
- exp->flags &= ~(STRING|NUMBER);
- exp->valref = 1;
- unref(n);
- n = exp;
}
return n;
}
diff --git a/builtin.c b/builtin.c
index 001dd6e..d51eafe 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3201,7 +3201,9 @@ call_sub(const char *name, int nargs)
* push replace
* push $0
*/
- if ((regex->flags & REGEX) == 0)
+ if ((regex->flags & REGEX) != 0)
+ regex = regex->typed_re;
+ else
regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
@@ -3226,7 +3228,9 @@ call_sub(const char *name, int nargs)
* nargs++
* }
*/
- if ((regex->flags & REGEX) == 0)
+ if ((regex->flags & REGEX) != 0)
+ regex = regex->typed_re;
+ else
regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
@@ -3264,8 +3268,11 @@ call_match(int nargs)
/* Don't need to pop the string just to push it back ... */
- if ((regex->flags & REGEX) == 0)
+ if ((regex->flags & REGEX) != 0)
+ regex = regex->typed_re;
+ else
regex = make_regnode(Node_regex, regex);
+
PUSH(regex);
if (array)
@@ -3293,7 +3300,9 @@ call_split_func(const char *name, int nargs)
if (nargs >= 3) {
regex = POP_STRING();
- if ((regex->flags & REGEX) == 0)
+ if ((regex->flags & REGEX) != 0)
+ regex = regex->typed_re;
+ else
regex = make_regnode(Node_regex, regex);
} else {
if (name[0] == 's') {
diff --git a/field.c b/field.c
index 4f24d5f..2c4b1f5 100644
--- a/field.c
+++ b/field.c
@@ -929,6 +929,9 @@ do_split(int nargs)
return make_number((AWKNUM) 0);
}
+ if ((sep->flags & REGEX) != 0)
+ sep = sep->typed_re;
+
if ( (sep->re_flags & FS_DFLT) != 0
&& current_field_sep() == Using_FS
&& ! RS_is_null) {
@@ -991,6 +994,9 @@ do_patsplit(int nargs)
src = TOP_STRING();
+ if ((sep->flags & REGEX) != 0)
+ sep = sep->typed_re;
+
fpat = sep->re_exp;
if (fpat->stlen == 0)
fatal(_("patsplit: third argument must be non-null"));
diff --git a/profile.c b/profile.c
index f27f9dd..ebb7b7e 100644
--- a/profile.c
+++ b/profile.c
@@ -646,11 +646,13 @@ cleanup:
fall through */
case Op_match_rec:
{
- NODE *re = pc->memory->re_exp;
- if (pc->memory->type == Node_regex)
+ if (pc->memory->type == Node_regex) {
+ NODE *re = pc->memory->re_exp;
str = pp_string(re->stptr, re->stlen, '/');
- else
- str = pp_typed_regex(re->stptr, re->stlen, '/');
+ } else {
+ assert((pc->memory->flags & REGEX) != 0);
+ str = pp_typed_regex(pc->memory->stptr,
pc->memory->stlen, '/');
+ }
pp_push(pc->opcode, str, CAN_FREE);
}
break;
@@ -673,8 +675,7 @@ cleanup:
str = pp_group3(txt, op2str(pc->opcode), restr);
pp_free(t2);
} else if (m->type == Node_val && (m->flags & REGEX) !=
0) {
- NODE *re = m->re_exp;
- restr = pp_typed_regex(re->stptr, re->stlen,
'/');
+ restr = pp_typed_regex(m->stptr, m->stlen, '/');
str = pp_group3(txt, op2str(pc->opcode), restr);
efree(restr);
} else {
diff --git a/re.c b/re.c
index e4191a1..dcb0667 100644
--- a/re.c
+++ b/re.c
@@ -346,7 +346,7 @@ re_update(NODE *t)
NODE *t1;
if (t->type == Node_val && (t->flags & REGEX) != 0)
- return t->tre_regs;
+ return t->typed_re->re_reg;
if ((t->re_flags & CASE) == IGNORECASE) {
/* regex was compiled with settings matching IGNORECASE */
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=b37675aa79213f2665abb2bbb4db90560642bdee
commit b37675aa79213f2665abb2bbb4db90560642bdee
Author: Arnold D. Robbins <address@hidden>
Date: Tue Nov 15 21:03:57 2016 +0200
First steps reworking code away from node type.
diff --git a/ChangeLog b/ChangeLog
index 986b856..d1de219 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2016-11-15 Arnold D. Robbins <address@hidden>
+
+ Start reworking typed regexes.
+
+ * awk.h (Node_typedregex): Nuked.
+ [REGEX]: New flag.
+ (tre_reg): New member in val part of NODE union.
+ (force_string, force_number, fixtype): Remove use of Node_typedregex.
+ * awkgram.y (grammer): Use REGEX flag instead of node type.
+ (valinfo); Ditto.
+ (make_regnode): Adjust creation based on node type.
+ * builtin.c (do_length, do_print, call_sub, call_match,
+ call_split_func, do_typeof): Adjust code.
+ * debug.c (watchpoint_triggered, initialize_watch_item,
+ print_memory): Adjust code.
+ * eval.c (nodetypes): Remove Node_typedregex.
+ (flags2str): Add REGEX.
+ (setup_frame): Adjust code after removal of Node_typedregex.
+ * interpret.h (r_interpret): Adjust code after removal
+ of Node_typedregex.
+ * profile.c (pp_typed_regex): Renamed from pp_strong_regex.
+ (pp_string_or_strong_regex): Renamed from pp_string_or_strong_regex.
+ (pprint): Adjust code after removal of Node_typedregex.
+ * re.c (re_update): Adjust code after removal of Node_typedregex.
+
2016-11-04 Eli Zaretskii <address@hidden>
* builtin.c (efwrite) [__MINGW32__]: Call w32_maybe_set_errno if
diff --git a/awk.h b/awk.h
index df90119..cc487c3 100644
--- a/awk.h
+++ b/awk.h
@@ -267,7 +267,6 @@ 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 */
@@ -385,6 +384,7 @@ typedef struct exp_node {
int idx;
wchar_t *wsp;
size_t wslen;
+ Regexp *preg;
} val;
} sub;
NODETYPE type;
@@ -461,6 +461,7 @@ typedef struct exp_node {
* See cint_array.c */
# define XARRAY 0x20000
# define NUMCONSTSTR 0x40000 /* have string value for
numeric constant */
+# define REGEX 0x80000 /* this is a typed regex */
} NODE;
#define vname sub.nodep.name
@@ -508,6 +509,7 @@ typedef struct exp_node {
#else
#define numbr sub.val.fltnum
#endif
+#define tre_regs sub.val.preg
/*
* If stfmt is set to STFMT_UNUSED, it means that the string representation
@@ -1818,9 +1820,6 @@ dupnode(NODE *n)
static inline NODE *
force_string(NODE *s)
{
- if (s->type == Node_typedregex)
- return dupnode(s->re_exp);
-
if ((s->flags & STRCUR) != 0
&& (s->stfmt == STFMT_UNUSED || s->stfmt == CONVFMTidx)
)
@@ -1847,9 +1846,6 @@ 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);
}
@@ -1866,15 +1862,12 @@ force_number(NODE *n)
* It is safe to assume that the return value will be the same NODE,
* since force_number on a MAYBE_NUM should always return the same NODE,
* and force_string on an INTIND should as well.
- *
- * There is no way to handle a Node_typedregex correctly, so we ignore
- * that case.
*/
static inline NODE *
fixtype(NODE *n)
{
- assert(n->type == Node_val || n->type == Node_typedregex);
+ assert(n->type == Node_val);
if (n->type == Node_val) {
if ((n->flags & MAYBE_NUM) != 0)
return force_number(n);
diff --git a/awkgram.c b/awkgram.c
index fed91b3..4bf6b95 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -2283,7 +2283,7 @@ yyreduce:
len = strlen(re);
exp = make_str_node(re, len, ALREADY_MALLOCED);
- n = make_regnode(Node_typedregex, exp);
+ n = make_regnode(Node_val, exp);
if (n == NULL) {
unref(exp);
YYABORT;
@@ -3154,7 +3154,7 @@ regular_print:
case 80:
#line 1278 "awkgram.y" /* yacc.c:1646 */
{
- assert((yyvsp[0])->memory->type == Node_typedregex);
+ assert(((yyvsp[0])->memory->flags & REGEX) == REGEX);
(yyvsp[0])->opcode = Op_push_re;
(yyval) = (yyvsp[0]);
}
@@ -3481,7 +3481,7 @@ regular_print:
_("regular expression on left of `~' or `!~'
operator"));
assert((yyvsp[0])->opcode == Op_push_re
- && (yyvsp[0])->memory->type == Node_typedregex);
+ && ((yyvsp[0])->memory->flags & REGEX) != 0);
/* RHS is @/.../ */
(yyvsp[-1])->memory = (yyvsp[0])->memory;
bcfree((yyvsp[0]));
@@ -5836,6 +5836,7 @@ yylex(void)
lexeme = lexptr;
thisline = NULL;
+
collect_regexp:
if (want_regexp) {
int in_brack = 0; /* count brackets, [[:alnum:]] allowed
*/
@@ -7051,8 +7052,8 @@ valinfo(NODE *n, Func_print print_func, FILE *fp)
{
if (n == Nnull_string)
print_func(fp, "uninitialized scalar\n");
- else if (n->type == Node_typedregex)
- print_func(fp, "@/%.*s/\n", n->re_exp->stlen, n->re_exp->stptr);
+ else if ((n->flags & REGEX) != 0)
+ print_func(fp, "@/%.*s/\n", n->stlen, n->stptr);
else if ((n->flags & STRING) != 0) {
pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
print_func(fp, "\n");
@@ -7425,9 +7426,9 @@ make_regnode(int type, NODE *exp)
getnode(n);
memset(n, 0, sizeof(NODE));
n->type = type;
- n->re_cnt = 1;
- if (type == Node_regex || type == Node_typedregex) {
+ if (type == Node_regex) {
+ n->re_cnt = 1;
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true,
false);
if (n->re_reg == NULL) {
freenode(n);
@@ -7436,6 +7437,14 @@ make_regnode(int type, NODE *exp)
n->re_exp = exp;
n->re_flags = CONSTANT;
n->valref = 1;
+ } else if (type == Node_val) {
+ exp->tre_regs = make_regexp(exp->stptr, exp->stlen, false,
true, false);
+ exp->flags |= REGEX|MALLOC|STRCUR|NUMCUR;
+ exp->numbr = 0;
+ exp->flags &= ~(STRING|NUMBER);
+ exp->valref = 1;
+ unref(n);
+ n = exp;
}
return n;
}
diff --git a/awkgram.y b/awkgram.y
index 7fc1f27..4df22a6 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -525,7 +525,7 @@ typed_regexp
len = strlen(re);
exp = make_str_node(re, len, ALREADY_MALLOCED);
- n = make_regnode(Node_typedregex, exp);
+ n = make_regnode(Node_val, exp);
if (n == NULL) {
unref(exp);
YYABORT;
@@ -1276,7 +1276,7 @@ case_value
}
| typed_regexp
{
- assert($1->memory->type == Node_typedregex);
+ assert(($1->memory->flags & REGEX) == REGEX);
$1->opcode = Op_push_re;
$$ = $1;
}
@@ -1491,7 +1491,7 @@ exp
_("regular expression on left of `~' or `!~'
operator"));
assert($3->opcode == Op_push_re
- && $3->memory->type == Node_typedregex);
+ && ($3->memory->flags & REGEX) != 0);
/* RHS is @/.../ */
$2->memory = $3->memory;
bcfree($3);
@@ -3416,6 +3416,7 @@ yylex(void)
lexeme = lexptr;
thisline = NULL;
+
collect_regexp:
if (want_regexp) {
int in_brack = 0; /* count brackets, [[:alnum:]] allowed
*/
@@ -4631,8 +4632,8 @@ valinfo(NODE *n, Func_print print_func, FILE *fp)
{
if (n == Nnull_string)
print_func(fp, "uninitialized scalar\n");
- else if (n->type == Node_typedregex)
- print_func(fp, "@/%.*s/\n", n->re_exp->stlen, n->re_exp->stptr);
+ else if ((n->flags & REGEX) != 0)
+ print_func(fp, "@/%.*s/\n", n->stlen, n->stptr);
else if ((n->flags & STRING) != 0) {
pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
print_func(fp, "\n");
@@ -5005,9 +5006,9 @@ make_regnode(int type, NODE *exp)
getnode(n);
memset(n, 0, sizeof(NODE));
n->type = type;
- n->re_cnt = 1;
- if (type == Node_regex || type == Node_typedregex) {
+ if (type == Node_regex) {
+ n->re_cnt = 1;
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true,
false);
if (n->re_reg == NULL) {
freenode(n);
@@ -5016,6 +5017,14 @@ make_regnode(int type, NODE *exp)
n->re_exp = exp;
n->re_flags = CONSTANT;
n->valref = 1;
+ } else if (type == Node_val) {
+ exp->tre_regs = make_regexp(exp->stptr, exp->stlen, false,
true, false);
+ exp->flags |= REGEX|MALLOC|STRCUR|NUMCUR;
+ exp->numbr = 0;
+ exp->flags &= ~(STRING|NUMBER);
+ exp->valref = 1;
+ unref(n);
+ n = exp;
}
return n;
}
diff --git a/builtin.c b/builtin.c
index a7fe631..001dd6e 100644
--- a/builtin.c
+++ b/builtin.c
@@ -536,7 +536,7 @@ do_length(int nargs)
return make_number(size);
}
- assert(tmp->type == Node_val || tmp->type == Node_typedregex);
+ assert(tmp->type == Node_val);
if (do_lint && (fixtype(tmp)->flags & STRING) == 0)
lintwarn(_("length: received non-string argument"));
@@ -2195,11 +2195,9 @@ do_print(int nargs, int redirtype)
fatal(_("attempt to use array `%s' in a scalar
context"), array_vname(tmp));
}
- if (tmp->type == Node_typedregex)
- args_array[i] = force_string(tmp);
- else if ( (tmp->flags & STRCUR) == 0
- || ( tmp->stfmt != STFMT_UNUSED
- && tmp->stfmt != OFMTidx))
+ if ( (tmp->flags & STRCUR) == 0
+ || ( tmp->stfmt != STFMT_UNUSED
+ && tmp->stfmt != OFMTidx))
args_array[i] = format_val(OFMT, OFMTidx, tmp);
}
@@ -3203,7 +3201,7 @@ call_sub(const char *name, int nargs)
* push replace
* push $0
*/
- if (regex->type != Node_typedregex)
+ if ((regex->flags & REGEX) == 0)
regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
@@ -3228,7 +3226,7 @@ call_sub(const char *name, int nargs)
* nargs++
* }
*/
- if (regex->type != Node_typedregex)
+ if ((regex->flags & REGEX) == 0)
regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
@@ -3266,7 +3264,7 @@ call_match(int nargs)
/* Don't need to pop the string just to push it back ... */
- if (regex->type != Node_typedregex)
+ if ((regex->flags & REGEX) == 0)
regex = make_regnode(Node_regex, regex);
PUSH(regex);
@@ -3295,7 +3293,7 @@ call_split_func(const char *name, int nargs)
if (nargs >= 3) {
regex = POP_STRING();
- if (regex->type != Node_typedregex)
+ if ((regex->flags & REGEX) == 0)
regex = make_regnode(Node_regex, regex);
} else {
if (name[0] == 's') {
@@ -3955,12 +3953,9 @@ do_typeof(int nargs)
res = "array";
deref = false;
break;
- case Node_typedregex:
- res = "regexp";
- break;
case Node_val:
case Node_var:
- switch (arg->flags & (STRING|NUMBER|MAYBE_NUM)) {
+ switch (arg->flags & (STRING|NUMBER|MAYBE_NUM|REGEX)) {
case STRING:
res = "string";
break;
@@ -3970,6 +3965,9 @@ do_typeof(int nargs)
case STRING|MAYBE_NUM:
res = "strnum";
break;
+ case REGEX:
+ res = "regexp";
+ break;
case NUMBER|STRING:
if (arg == Nnull_string) {
res = "unassigned";
diff --git a/debug.c b/debug.c
index 70ba82e..6d591cb 100644
--- a/debug.c
+++ b/debug.c
@@ -1736,8 +1736,6 @@ watchpoint_triggered(struct list_item *w)
/* new != NULL */
if (t2->type == Node_val)
w->cur_value = dupnode(t2);
- else if (t2->type == Node_typedregex)
- w->cur_value = dupnode(t2);
else {
w->flags |= CUR_IS_ARRAY;
w->cur_size = (t2->type == Node_var_array) ?
assoc_length(t2) : 0;
@@ -1750,7 +1748,6 @@ watchpoint_triggered(struct list_item *w)
w->flags |= CUR_IS_ARRAY;
w->cur_size = assoc_length(t2);
} else
- /* works for Node_typedregex too */
w->cur_value = dupnode(t2);
}
@@ -1793,7 +1790,7 @@ initialize_watch_item(struct list_item *w)
} else if (symbol->type == Node_var_array) {
w->flags |= CUR_IS_ARRAY;
w->cur_size = assoc_length(symbol);
- } else if (symbol->type == Node_typedregex) {
+ } else if (symbol->type == Node_val && (symbol->flags & REGEX)
!= 0) {
w->cur_value = dupnode(symbol);
} /* else
can't happen */
@@ -3708,14 +3705,14 @@ print_memory(NODE *m, NODE *func, Func_print
print_func, FILE *fp)
print_func(fp, "%g", m->numbr);
} else if ((m->flags & STRING) != 0)
pp_string_fp(print_func, fp, m->stptr, m->stlen, '"',
false);
- else
+ else if ((m->flags & REGEX) != 0) {
+ print_func(fp, "@");
+ pp_string_fp(print_func, fp, m->stptr, m->stlen, '/',
false);
+ } else
print_func(fp, "-?-");
print_func(fp, " [%s]", flags2str(m->flags));
break;
- case Node_typedregex:
- print_func(fp, "@");
- /* fall through */
case Node_regex:
pp_string_fp(print_func, fp, m->re_exp->stptr,
m->re_exp->stlen, '/', false);
break;
diff --git a/eval.c b/eval.c
index 00da9ee..813a306 100644
--- a/eval.c
+++ b/eval.c
@@ -236,7 +236,6 @@ static const char *const nodetypes[] = {
"Node_val",
"Node_regex",
"Node_dynregex",
- "Node_typedregex",
"Node_var",
"Node_var_array",
"Node_var_new",
@@ -451,6 +450,7 @@ flags2str(int flagval)
{ HALFHAT, "HALFHAT" },
{ XARRAY, "XARRAY" },
{ NUMCONSTSTR, "NUMCONSTSTR" },
+ { REGEX, "REGEX" },
{ 0, NULL },
};
@@ -1330,11 +1330,6 @@ 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/interpret.h b/interpret.h
index 9d3c108..9b73761 100644
--- a/interpret.h
+++ b/interpret.h
@@ -268,7 +268,7 @@ uninitialized_scalar:
r = r->var_value;
}
- if (r->type == Node_val || r->type == Node_typedregex)
+ if (r->type == Node_val)
UPREF(r);
PUSH(r);
break;
@@ -991,7 +991,8 @@ arrayfor:
r = POP_STRING();
unref(m->re_exp);
m->re_exp = r;
- } else if (m->type == Node_typedregex) {
+ } else if (m->type == Node_val) {
+ assert((m->flags & REGEX) != 0);
UPREF(m);
}
PUSH(m);
diff --git a/profile.c b/profile.c
index c60fd29..f27f9dd 100644
--- a/profile.c
+++ b/profile.c
@@ -32,8 +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 char *pp_string_or_typed_regex(const char *in_str, size_t len, int
delim, bool typed_regex);
+static char *pp_typed_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);
@@ -640,7 +640,7 @@ cleanup:
break;
case Op_push_re:
- if (pc->memory->type != Node_regex && pc->memory->type
!= Node_typedregex)
+ if (pc->memory->type != Node_regex &&
(pc->memory->flags & REGEX) == 0)
break;
/* else
fall through */
@@ -650,7 +650,7 @@ cleanup:
if (pc->memory->type == Node_regex)
str = pp_string(re->stptr, re->stlen, '/');
else
- str = pp_strong_regex(re->stptr, re->stlen,
'/');
+ str = pp_typed_regex(re->stptr, re->stlen, '/');
pp_push(pc->opcode, str, CAN_FREE);
}
break;
@@ -672,9 +672,9 @@ cleanup:
txt = t2->pp_str;
str = pp_group3(txt, op2str(pc->opcode), restr);
pp_free(t2);
- } else if (m->type == Node_typedregex) {
+ } else if (m->type == Node_val && (m->flags & REGEX) !=
0) {
NODE *re = m->re_exp;
- restr = pp_strong_regex(re->stptr, re->stlen,
'/');
+ restr = pp_typed_regex(re->stptr, re->stlen,
'/');
str = pp_group3(txt, op2str(pc->opcode), restr);
efree(restr);
} else {
@@ -1416,21 +1416,21 @@ parenthesize(int type, NODE *left, NODE *right)
char *
pp_string(const char *in_str, size_t len, int delim)
{
- return pp_string_or_strong_regex(in_str, len, delim, false);
+ return pp_string_or_typed_regex(in_str, len, delim, false);
}
-/* pp_strong_regex --- pretty format a hard regex constant */
+/* pp_typed_regex --- pretty format a hard regex constant */
static char *
-pp_strong_regex(const char *in_str, size_t len, int delim)
+pp_typed_regex(const char *in_str, size_t len, int delim)
{
- return pp_string_or_strong_regex(in_str, len, delim, true);
+ return pp_string_or_typed_regex(in_str, len, delim, true);
}
-/* pp_string_or_strong_regex --- pretty format a string, regex, or hard regex
constant */
+/* pp_string_or_typed_regex --- pretty format a string, regex, or typed regex
constant */
char *
-pp_string_or_strong_regex(const char *in_str, size_t len, int delim, bool
strong_regex)
+pp_string_or_typed_regex(const char *in_str, size_t len, int delim, bool
typed_regex)
{
static char str_escapes[] = "\a\b\f\n\r\t\v\\";
static char str_printables[] = "abfnrtv\\";
@@ -1464,12 +1464,12 @@ pp_string_or_strong_regex(const char *in_str, size_t
len, int delim, bool strong
} ofre -= (l)
/* initial size; 3 for delim + terminating null, 1 for @ */
- osiz = len + 3 + 1 + (strong_regex == true);
+ osiz = len + 3 + 1 + (typed_regex == true);
emalloc(obuf, char *, osiz, "pp_string");
obufout = obuf;
ofre = osiz - 1;
- if (strong_regex)
+ if (typed_regex)
*obufout++ = '@';
*obufout++ = delim;
diff --git a/re.c b/re.c
index 4360d30..e4191a1 100644
--- a/re.c
+++ b/re.c
@@ -345,18 +345,17 @@ re_update(NODE *t)
{
NODE *t1;
+ if (t->type == Node_val && (t->flags & REGEX) != 0)
+ return t->tre_regs;
+
if ((t->re_flags & CASE) == IGNORECASE) {
/* 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 || t->type ==
Node_typedregex);
+ assert(t->type == Node_regex);
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, true) == 0)
-----------------------------------------------------------------------
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/typed-regex-2, created. gawk-4.1.0-2064-gf0b405c,
Arnold Robbins <=