PATCH [perl #121144]: \S, \W, etc fail for above ASCII
authorKarl Williamson <public@khwilliamson.com>
Mon, 3 Feb 2014 05:30:10 +0000 (22:30 -0700)
committerKarl Williamson <public@khwilliamson.com>
Mon, 3 Feb 2014 05:59:58 +0000 (22:59 -0700)
There were three things wrong with these couple of lines of code.that
help generate the synthetic start class (SSC).

1)  It used PL_regkind, instead of straight OP.  This meant that /u
    matches were treated the same as /d matches since they both have the
    same regkind.
2)  For what it thought was just for /d, it used the complement of
    ASCII, which matches 128-INFINITY, whereas it wanted 128-255 only..
3)  It did a union of this complement, instead of a subtract of the
    non-complement, forgetting that we are about to complement the
    result, so that if we want the end result to have something, we
    better have the input not have that something, or the complementing
    will screw it up.

regcomp.c
t/re/re_tests

index bcd159c..884d9cc 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4912,10 +4912,12 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVdf" RHS=%"UVdf"\n",
 
                     /* NPOSIXD matches all upper Latin1 code points unless the
                      * target string being matched is UTF-8, which is
-                     * unknowable until match time */
-                    if (PL_regkind[OP(scan)] == NPOSIXD) {
-                        _invlist_union_complement_2nd(my_invlist,
-                                        PL_XPosix_ptrs[_CC_ASCII], &my_invlist);
+                     * unknowable until match time.  Since we are going to
+                     * invert, we want to get rid of all of them so that the
+                     * inversion will match all */
+                    if (OP(scan) == NPOSIXD) {
+                        _invlist_subtract(my_invlist, PL_UpperLatin1,
+                                          &my_invlist);
                     }
 
                   join_posix:
index 5033060..d5c66f7 100644 (file)
@@ -1843,5 +1843,10 @@ A+(*PRUNE)BC(?{})        AAABC   y       $&      AAABC
 
 # RT #120600: Variable length lookbehind is not variable
 (?<W>a)(?<BB>(?=(?&W))(?<=(?&W)))(?&BB)        aa      y       $&      a       # test repeated recursive patterns
+
+# This group is from RT #121144
+/^\S+=/d       \x{3a3}=\x{3a0} y       $&      \x{3a3}=
+/^\S+=/u       \x{3a3}=\x{3a0} y       $&      \x{3a3}=
+
 # Keep these lines at the end of the file
 # vim: softtabstop=0 noexpandtab