summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-12-23 12:24:09 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-19 11:58:18 -0700
commite22b340a2e08cb60ead800f83a4e05a34a035593 (patch)
treeee11fdf9c805e3b1fd96e78ecb0906117cee1039 /regcomp.c
parent3f410cf638be529b0fb3e325021d45bc856e300f (diff)
downloadperl-e22b340a2e08cb60ead800f83a4e05a34a035593.tar.gz
regcomp.c: regex start class for sharp s
Under most folding types, the optimizer start class should include all of s, S, and the sharp s (\xdf) if it includes any of them. The code was neglecting the latter. This is currently not relevant, as there is special handling of the sharp s elsewhere in regcomp.c. But this is a step to changing that special handling to fix some bugs.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index dfdbf7b5d3..f7bb10889a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3318,6 +3318,19 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
* the full latin1 fold. (Can't do this for locale,
* because not known until runtime */
ANYOF_BITMAP_SET(data->start_class, PL_fold_latin1[uc]);
+
+ /* All folds except under /iaa that include s, S, and
+ * sharp_s also may include the others */
+ if (OP(scan) != EXACTFA) {
+ if (uc == 's' || uc == 'S') {
+ ANYOF_BITMAP_SET(data->start_class,
+ LATIN_SMALL_LETTER_SHARP_S);
+ }
+ else if (uc == LATIN_SMALL_LETTER_SHARP_S) {
+ ANYOF_BITMAP_SET(data->start_class, 's');
+ ANYOF_BITMAP_SET(data->start_class, 'S');
+ }
+ }
}
}
else if (uc >= 0x100) {
@@ -3342,6 +3355,19 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
* run-time */
ANYOF_BITMAP_SET(data->start_class,
PL_fold_latin1[uc]);
+
+ /* All folds except under /iaa that include s, S,
+ * and sharp_s also may include the others */
+ if (OP(scan) != EXACTFA) {
+ if (uc == 's' || uc == 'S') {
+ ANYOF_BITMAP_SET(data->start_class,
+ LATIN_SMALL_LETTER_SHARP_S);
+ }
+ else if (uc == LATIN_SMALL_LETTER_SHARP_S) {
+ ANYOF_BITMAP_SET(data->start_class, 's');
+ ANYOF_BITMAP_SET(data->start_class, 'S');
+ }
+ }
}
}
data->start_class->flags &= ~ANYOF_EOS;