summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-12-23 12:24:09 -0700
committerKarl Williamson <public@khwilliamson.com>2011-12-23 19:09:41 -0700
commit5791593ce7a0466e027f8f0be7e9ab80c1fc22e4 (patch)
treeb8d4852e65b4ae29b7562bc857aa595f7968d42b
parent1e4ce0b4ef6f349abb2cc48006c4823839665d23 (diff)
downloadperl-5791593ce7a0466e027f8f0be7e9ab80c1fc22e4.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.
-rw-r--r--regcomp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 16d2962e29..6917ee5520 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;