regexec.c: Add missing handlers for locale \d
authorKarl Williamson <public@khwilliamson.com>
Mon, 6 Dec 2010 19:01:22 +0000 (12:01 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 8 Dec 2010 02:52:43 +0000 (18:52 -0800)
regexec.c had some code to handle \d under locales, but not everywhere.

regexec.c

index 112722e..b04bead 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -6094,6 +6094,20 @@ S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max, int depth)
                scan++;
        }
        break;
+    case DIGITL:
+       PL_reg_flags |= RF_tainted;
+       if (utf8_target) {
+           loceol = PL_regeol;
+           while (hardcount < max && scan < loceol &&
+                  isDIGIT_LC_utf8((U8*)scan)) {
+               scan += UTF8SKIP(scan);
+               hardcount++;
+           }
+       } else {
+           while (scan < loceol && isDIGIT_LC(*scan))
+               scan++;
+       }
+       break;
     case NDIGIT:
        if (utf8_target) {
            loceol = PL_regeol;
@@ -6107,6 +6121,20 @@ S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max, int depth)
            while (scan < loceol && !isDIGIT(*scan))
                scan++;
        }
+    case NDIGITL:
+       PL_reg_flags |= RF_tainted;
+       if (utf8_target) {
+           loceol = PL_regeol;
+           while (hardcount < max && scan < loceol &&
+                  !isDIGIT_LC_utf8((U8*)scan)) {
+               scan += UTF8SKIP(scan);
+               hardcount++;
+           }
+       } else {
+           while (scan < loceol && !isDIGIT_LC(*scan))
+               scan++;
+       }
+       break;
     case LNBREAK:
         if (utf8_target) {
            loceol = PL_regeol;