aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-11-15 21:45:58 +0200
committerArnold D. Robbins <arnold@skeeve.com>2016-11-15 21:45:58 +0200
commit4f1eec385831018980e4c7424e1a544c5313b52a (patch)
treedc9ffe7aba416c469113a03ff08629d2bfeb6312 /builtin.c
parentb37675aa79213f2665abb2bbb4db90560642bdee (diff)
downloadegawk-4f1eec385831018980e4c7424e1a544c5313b52a.tar.gz
egawk-4f1eec385831018980e4c7424e1a544c5313b52a.tar.bz2
egawk-4f1eec385831018980e4c7424e1a544c5313b52a.zip
Finish reworking typed regexes. Tests pass!
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/builtin.c b/builtin.c
index 001dd6e2..d51eafe2 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') {