summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c21
-rw-r--r--t/op/re_tests4
2 files changed, 18 insertions, 7 deletions
diff --git a/regcomp.c b/regcomp.c
index 7e80041d0b..50b0632529 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3727,11 +3727,22 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
data->whilem_c = data_fake.whilem_c;
}
if (f & SCF_DO_STCLASS_AND) {
- const int was = (data->start_class->flags & ANYOF_EOS);
-
- cl_and(data->start_class, &intrnl);
- if (was)
- data->start_class->flags |= ANYOF_EOS;
+ if (flags & SCF_DO_STCLASS_OR) {
+ /* OR before, AND after: ideally we would recurse with
+ * data_fake to get the AND applied by study of the
+ * remainder of the pattern, and then derecurse;
+ * *** HACK *** for now just treat as "no information".
+ * See [perl #56690].
+ */
+ cl_init(pRExC_state, data->start_class);
+ } else {
+ /* AND before and after: combine and continue */
+ const int was = (data->start_class->flags & ANYOF_EOS);
+
+ cl_and(data->start_class, &intrnl);
+ if (was)
+ data->start_class->flags |= ANYOF_EOS;
+ }
}
}
#if PERL_ENABLE_POSITIVE_ASSERTION_STUDY
diff --git a/t/op/re_tests b/t/op/re_tests
index 8c7381f900..10bee20f94 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -1371,8 +1371,8 @@ foo(\h)bar foo\tbar y $1 \t
.*?(?:(\w)|(\w))x abx y $1-$2 b-
0{50} 000000000000000000000000000000000000000000000000000 y - -
-^a?(?=b)b ab B $& ab # Bug #56690
-^a*(?=b)b ab B $& ab # Bug #56690
+^a?(?=b)b ab y $& ab # Bug #56690
+^a*(?=b)b ab y $& ab # Bug #56690
/>\d+$ \n/ix >10\n y $& >10
/>\d+$ \n/ix >1\n y $& >1
/\d+$ \n/ix >10\n y $& 10