/* See if the folded version matches */
STRLEN foldlen;
to_utf8_fold(utf8_p, folded, &foldlen);
- if (swash_fetch(sw, folded, 1)) { /* 1 => is utf8 */
- match = TRUE;
- }
- else {
- /* The fold in a few cases of an above Latin1 char
- * is in the Latin1 range, and hence may be in the
- * bitmap */
- if (UTF8_IS_INVARIANT(*folded)
- && ANYOF_BITMAP_TEST(n, UNI_TO_NATIVE(*folded)))
{
- match = TRUE;
- }
- else if (UTF8_IS_DOWNGRADEABLE_START(*folded)
- && ANYOF_BITMAP_TEST(n,
- UNI_TO_NATIVE(
- TWO_BYTE_UTF8_TO_UNI(folded[0],
- folded[1]))))
- { /* Since the fold comes from internally
- * generated data, we can safely assume it is
- * valid utf8 in the test above */
- match = TRUE;
- }
- if (! match) {
SV** listp;
/* Consider "k" =~ /[K]/i. The line above
* nulls since NULL isn't folded or
* foldable */
try_c = SvPVX(*try_p);
+
+ /* The fold in a few cases of an above Latin1 char
+ * is in the Latin1 range, and hence may be in the
+ * bitmap */
if (UTF8_IS_INVARIANT(*try_c)
&& ANYOF_BITMAP_TEST(n,
UNI_TO_NATIVE(*try_c)))
TWO_BYTE_UTF8_TO_UNI(try_c[0],
try_c[1]))))
{
+ /* Since the fold comes from internally
+ * generated data, we can safely assume it is
+ * valid utf8 in the test above */
match = TRUE;
break;
} else if (swash_fetch(sw,
}
}
}
- }
}
}
}
}
my $test;
+ # A multi-char fold should not match just one char;
+ # e.g., ":ß:" !~ /:[_s]:/i
+ $test = qq[":$c:" !~ /:[_$f]:/i];
+ ok eval $test, "$code - $name - $mapping - $type - $test";
+
local $TODO = 'Multi-char fold in [character class]';
- TODO: { # e.g., ":ß:" !~ /:[_s]:/i # A multi-char fold should not
- # match just one char
- $test = qq[":$c:" !~ /:[_$f]:/i];
- ok eval $test, "$code - $name - $mapping - $type - $test";
- }
TODO: { # e.g., ":ß:" =~ /:[_s]{2}:/i
$test = qq[":$c:" =~ /:[_$f]{$f_length}:/i];
ok eval $test, "$code - $name - $mapping - $type - $test";