diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-11-15 21:45:58 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-11-15 21:45:58 +0200 |
commit | 4f1eec385831018980e4c7424e1a544c5313b52a (patch) | |
tree | dc9ffe7aba416c469113a03ff08629d2bfeb6312 /builtin.c | |
parent | b37675aa79213f2665abb2bbb4db90560642bdee (diff) | |
download | egawk-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.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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') { |