aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-12-22 18:32:21 +0200
committerArnold D. Robbins <arnold@skeeve.com>2016-12-22 18:32:21 +0200
commit6402c9480ffcd8610b1322a381f0c14a42d95083 (patch)
treebbf1f2c00923c562b1ff346b5a6b759d58920902 /node.c
parent2af62b50e5b9574c0e169fb4d99c4912e56eef1f (diff)
parentaf31a6de1bd15d4d5f5520ebfcb1d24239b9a683 (diff)
downloadegawk-6402c9480ffcd8610b1322a381f0c14a42d95083.tar.gz
egawk-6402c9480ffcd8610b1322a381f0c14a42d95083.tar.bz2
egawk-6402c9480ffcd8610b1322a381f0c14a42d95083.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'node.c')
-rw-r--r--node.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/node.c b/node.c
index cef6acbe..97f65fa3 100644
--- a/node.c
+++ b/node.c
@@ -444,6 +444,27 @@ make_str_node(const char *s, size_t len, int flags)
return r;
}
+/* make_typed_regex --- make a typed regex node */
+
+NODE *
+make_typed_regex(const char *re, size_t len)
+{
+ NODE *n, *exp, *n2;
+
+ exp = make_str_node(re, len, ALREADY_MALLOCED);
+ n = make_regnode(Node_regex, exp);
+ if (n == NULL)
+ fatal(_("could not make typed regex"));
+
+ n2 = make_string(re, len);
+ n2->typed_re = n;
+ n2->numbr = 0;
+ n2->flags |= NUMCUR|STRCUR|REGEX;
+ n2->flags &= ~(STRING|NUMBER);
+
+ return n2;
+}
+
/* unref --- remove reference to a particular node */