summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-05-08 09:59:13 -0600
committerJesse Vincent <jesse@bestpractical.com>2011-06-07 23:25:06 -0400
commit42c872b9bc4120939576b21e6a254beb4ef91c7a (patch)
tree84aa6da51345b86fab6312378659d5cdd4fdce42
parentea44a8551c9893e54d5fb0f7ef09c5b60e058eef (diff)
downloadperl-42c872b9bc4120939576b21e6a254beb4ef91c7a.tar.gz
/iaa doesn't work when the result is trie'd
It turns out that caseless tries currently only work on UTF-8 EXACTFU nodes. The code attempted to test that by using UNI_SEMANTICS, but that doesn't actually work; what is important is the semantics of the current node.
-rw-r--r--regcomp.c11
-rw-r--r--t/re/fold_grind.t4
2 files changed, 8 insertions, 7 deletions
diff --git a/regcomp.c b/regcomp.c
index 94f28c7058..d490884644 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3048,20 +3048,17 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
}
} else {
/*
- Currently we do not believe that the trie logic can
- handle case insensitive matching properly when the
- pattern is not unicode (thus forcing unicode semantics).
+ Currently the trie logic handles case insensitive matching properly only
+ when the pattern is UTF-8 and the node is EXACTFU (thus forcing unicode
+ semantics).
If/when this is fixed the following define can be swapped
in below to fully enable trie logic.
- XXX It may work if not UTF and/or /a (AT_LEAST_UNI_SEMANTICS) but perhaps
- not /aa
-
#define TRIE_TYPE_IS_SAFE 1
*/
-#define TRIE_TYPE_IS_SAFE ((UTF && UNI_SEMANTICS) || optype==EXACT)
+#define TRIE_TYPE_IS_SAFE ((UTF && optype == EXACTFU) || optype==EXACT)
if ( last && TRIE_TYPE_IS_SAFE ) {
make_trie( pRExC_state,
diff --git a/t/re/fold_grind.t b/t/re/fold_grind.t
index 460d296644..0e482de21e 100644
--- a/t/re/fold_grind.t
+++ b/t/re/fold_grind.t
@@ -446,6 +446,10 @@ foreach my $test (sort { numerically } keys %tests) {
# XXX Doesn't currently test multi-char folds in pattern
next if @pattern != 1;
+ # See if works on what could be a simple trie.
+ $eval = "my \$c = \"$lhs\"; my \$p = qr/$rhs|xyz/i$charset;$upgrade_target$upgrade_pattern \$c $op \$p";
+ run_test($eval, ++$count, "", "");
+
my $okays = 0;
my $this_iteration = 0;