aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-09-20 21:40:36 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-09-20 21:40:36 +0300
commit3dc29b1fbb332fd0a0571ed803401f4ca069e9b3 (patch)
tree76760d37284a0813a3df38b4e03c131a3e1b8d1b /re.c
parentcbff5bd8144c06b2c6790060462c68a22e0d4452 (diff)
parent491c127c5c78f0729f3e75bc0d07d49285a2041b (diff)
downloadegawk-3dc29b1fbb332fd0a0571ed803401f4ca069e9b3.tar.gz
egawk-3dc29b1fbb332fd0a0571ed803401f4ca069e9b3.tar.bz2
egawk-3dc29b1fbb332fd0a0571ed803401f4ca069e9b3.zip
Merge branch 'master' into feature/typed-regex
Diffstat (limited to 're.c')
-rw-r--r--re.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/re.c b/re.c
index da6982ea..13173290 100644
--- a/re.c
+++ b/re.c
@@ -49,7 +49,6 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
int c, c2;
static bool first = true;
static bool no_dfa = false;
- bool has_anchor = false;
reg_syntax_t dfa_syn;
int i;
@@ -160,9 +159,6 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
} /* switch */
} else {
c = *src;
- if (c == '^' || c == '$')
- has_anchor = true;
-
*dest++ = *src++; /* not '\\' */
}
if (gawk_mb_cur_max > 1 && is_multibyte)
@@ -228,11 +224,10 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
if (dfa && ! no_dfa) {
rp->dfareg = dfaalloc();
dfasyntax(rp->dfareg, & localeinfo, dfa_syn,
- ignorecase ? DFA_CASE_FOLD : 0);
+ (ignorecase ? DFA_CASE_FOLD : 0) | DFA_ANCHOR);
dfacomp(buf, len, rp->dfareg, true);
} else
rp->dfareg = NULL;
- rp->has_anchor = has_anchor;
/* Additional flags that help with RS as regexp. */
for (i = 0; i < len; i++) {
@@ -287,7 +282,7 @@ research(Regexp *rp, char *str, int start,
ret = dfaexec(superset, str+start, str+start+len,
true, NULL, NULL);
- if (ret && ((! need_start && ! rp->has_anchor)
+ if (ret && (! need_start
|| (! superset && dfaisfast(rp->dfareg))))
ret = dfaexec(rp->dfareg, str+start, str+start+len,
true, NULL, &try_backref);
@@ -298,7 +293,6 @@ research(Regexp *rp, char *str, int start,
|| start != 0
|| no_bol
|| need_start
- || rp->has_anchor
|| try_backref) {
/*
* Passing NULL as last arg speeds up search for cases