diff options
author | Karl Williamson <khw@cpan.org> | 2015-10-30 21:14:55 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2015-10-30 21:15:11 +0000 |
commit | 9e053d5265641a359970d9a120a0247e29e78337 (patch) | |
tree | 3204a49530ea3f334e1c28b4701064689508c44f | |
parent | 91ab096a451147e8b05d83ddf2732c8e0a53a8dc (diff) | |
download | perl-9e053d5265641a359970d9a120a0247e29e78337.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.
(cherry picked from commit 67481c39e5c4241caaadaabb962ba281af64d9aa)
-rw-r--r-- | regexec.c | 21 | ||||
-rw-r--r-- | t/lib/warnings/regexec | 1 |
2 files changed, 7 insertions, 15 deletions
@@ -2075,8 +2075,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; } @@ -2113,16 +2112,14 @@ 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; } 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; } @@ -2174,9 +2171,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; } @@ -2184,9 +2179,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; @@ -2245,9 +2238,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 750880e4db..147254ebbb 100644 --- a/t/lib/warnings/regexec +++ b/t/lib/warnings/regexec @@ -212,3 +212,4 @@ 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. |