diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-10-16 12:09:04 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-10-16 21:48:37 -0600 |
commit | 565fc1bb88638c2490cdab7a1055007f6b2d577c (patch) | |
tree | a01a32bc6f2847c2a11806907810cbf189fcbd1c | |
parent | 89fd9d0b0c00e75d034243e463ba1dcb825d9136 (diff) | |
download | perl-565fc1bb88638c2490cdab7a1055007f6b2d577c.tar.gz |
regex: \R can match either 1 or 2 chars
Therefore it is not "simple", and should not be compiled as such,
causing things like the test added herein to fail.
-rw-r--r-- | regcomp.c | 2 | ||||
-rw-r--r-- | regexec.c | 21 | ||||
-rw-r--r-- | t/re/re_tests | 2 |
3 files changed, 5 insertions, 20 deletions
@@ -10274,7 +10274,7 @@ tryagain: goto finish_meta_pat; case 'R': ret = reg_node(pRExC_state, LNBREAK); - *flagp |= HASWIDTH|SIMPLE; + *flagp |= HASWIDTH; goto finish_meta_pat; case 'h': ret = reg_node(pRExC_state, HORIZWS); @@ -7022,25 +7022,8 @@ S_regrepeat(pTHX_ const regexp *prog, char **startposp, const regnode *p, I32 ma } break; case LNBREAK: - if (utf8_target) { - loceol = PL_regeol; - while (hardcount < max && scan < loceol && - (c=is_LNBREAK_utf8_safe(scan, loceol))) { - scan += c; - hardcount++; - } - } else { - /* - LNBREAK can match two latin chars, which is ok, - because we have a null terminated string, but we - have to use hardcount in this situation - */ - while (scan < loceol && (c=is_LNBREAK_latin1_safe(scan, loceol))) { - scan+=c; - hardcount++; - } - } - break; + Perl_croak(aTHX_ "panic: regrepeat() should not be called with non-simple: LNBREAK"); + assert(0); /* NOTREACHED */ case HORIZWS: if (utf8_target) { loceol = PL_regeol; diff --git a/t/re/re_tests b/t/re/re_tests index a59a6ab522..387a74b252 100644 --- a/t/re/re_tests +++ b/t/re/re_tests @@ -1709,4 +1709,6 @@ ab[c\\\](??{"x"})]{3}d ab\\](d y - - (\x{100}) \x{2000}\x{2000}\x{2000}\x{100} y $-[0]:$-[1]:$+[0]:$+[1] 3:3:4:4 +^\R{2}$ \r\n\r\n y $& \r\n\r\n + # vim: softtabstop=0 noexpandtab |