diff options
author | Karl Williamson <khw@cpan.org> | 2015-10-19 11:59:05 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2015-10-19 12:40:24 -0600 |
commit | 67481c39e5c4241caaadaabb962ba281af64d9aa (patch) | |
tree | 24d52de62b12a0035859556f512c003ed2729b4b | |
parent | 00e3344b7aba855b0e0ace0c62580ed9dc74be15 (diff) | |
download | perl-67481c39e5c4241caaadaabb962ba281af64d9aa.tar.gz |
Fix some bugs in \B[sb}, \B{wb}, \B[gcb}
Under \B{} the result is the complement of the \b{} result. However in
this code, the result was getting complemented again, wrongly.
-rw-r--r-- | regexec.c | 21 | ||||
-rw-r--r-- | t/lib/warnings/regexec | 1 |
2 files changed, 7 insertions, 15 deletions
@@ -2067,8 +2067,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, case GCB_BOUND: if (s == reginfo->strbeg) { /* GCB always matches at begin and end */ - if (to_complement ^ cBOOL(reginfo->intuit - || regtry(reginfo, &s))) + if (reginfo->intuit || regtry(reginfo, &s)) { goto got_it; } @@ -2107,16 +2106,14 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, /* And, since this is a bound, it can match after the final * character in the string */ - if (to_complement ^ cBOOL(reginfo->intuit || regtry(reginfo, &s))) { + if ((reginfo->intuit || regtry(reginfo, &s))) { goto got_it; } break; case SB_BOUND: if (s == reginfo->strbeg) { /* SB always matches at beginning */ - if (to_complement - ^ cBOOL(reginfo->intuit || regtry(reginfo, &s))) - { + if (reginfo->intuit || regtry(reginfo, &s)) { goto got_it; } @@ -2168,9 +2165,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, /* Here are at the final position in the target string. The SB * value is always true here, so matches, depending on other * constraints */ - if (to_complement ^ cBOOL(reginfo->intuit - || regtry(reginfo, &s))) - { + if (reginfo->intuit || regtry(reginfo, &s)) { goto got_it; } @@ -2178,9 +2173,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, case WB_BOUND: if (s == reginfo->strbeg) { - if (to_complement ^ cBOOL(reginfo->intuit - || regtry(reginfo, &s))) - { + if (reginfo->intuit || regtry(reginfo, &s)) { goto got_it; } s += (utf8_target) ? UTF8SKIP(s) : 1; @@ -2239,9 +2232,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, } } - if (to_complement ^ cBOOL(reginfo->intuit - || regtry(reginfo, &s))) - { + if (reginfo->intuit || regtry(reginfo, &s)) { goto got_it; } } diff --git a/t/lib/warnings/regexec b/t/lib/warnings/regexec index 1f3b65b167..900dd6ee7f 100644 --- a/t/lib/warnings/regexec +++ b/t/lib/warnings/regexec @@ -212,6 +212,7 @@ Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 16. Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17. Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17. +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17. ######## # NAME (?[ ]) in non-UTF-8 locale eval { require POSIX; POSIX->import("locale_h") }; |