From bf847b770dec8fd2e364a56abc8618987b9de917 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 29 Nov 2016 20:32:29 +0200 Subject: Add regex value support to API. Update rwarr extension and test. --- node.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'node.c') 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 */ -- cgit v1.2.3