regex: \R can match either 1 or 2 chars
authorKarl Williamson <public@khwilliamson.com>
Tue, 16 Oct 2012 18:09:04 +0000 (12:09 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 17 Oct 2012 03:48:37 +0000 (21:48 -0600)
Therefore it is not "simple", and should not be compiled as such,
causing things like the test added herein to fail.

regcomp.c
regexec.c
t/re/re_tests

index 2df4ce2..d1ee95c 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -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);
index c59743a..f25bce1 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -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;
index a59a6ab..387a74b 100644 (file)
@@ -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