reg_fold.t: Make test cases non-optimizable away
authorKarl Williamson <public@khwilliamson.com>
Wed, 27 Jun 2012 00:14:23 +0000 (18:14 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sat, 30 Jun 2012 04:22:41 +0000 (22:22 -0600)
This commit changes the bracketed character classes to include a
non-related character.  This is in preparation for a future commit which
would cause the current character classes to be optimized into EXACTish
nodes which would start passing TODO tests, but don't fix the underlying
problem with character classes.  That bug is that you can't split a
multi-char fold across nodes. It probably is not fixable in Perl without
a total restructuring of the regular expression mechanism.  For example,
"\N{LATIN SMALL LIGATURE FFI}" doesn't match /[f][f][i]/i.  But it would
if those got optimized into a single EXACTF node.  (The problem is not
limited to character classes, /(f)(f)(i)/i also doesn't match, and
can't, as $1, $2, and $3 are not well-defined.)

t/re/reg_fold.t

index 9b5ef11..9e97ddd 100644 (file)
@@ -76,7 +76,11 @@ for  (@folds) {
                 $lhs = $chr;
                 $rhs = "";
                 foreach my $rhs_char (@folded) {
-                    $rhs .= '[' if $charclass;
+
+                    # The colon is an unrelated character to the rest of the
+                    # class, and makes sure no optimization into an EXACTish
+                    # node occurs.
+                    $rhs .= '[:' if $charclass;
                     $rhs .=  $rhs_char;
                     $rhs .= ']' if $charclass;
                 }