summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-28 03:44:10 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-28 03:44:10 +0000
commitde0c8cb881313fb53ccecc309c3a182787a8a527 (patch)
tree3dd2617011981415428ffda5a7a8f36f7bd8c4c9 /regcomp.c
parentf70c35af95b032bef7265d8d8029831a16708010 (diff)
downloadperl-de0c8cb881313fb53ccecc309c3a182787a8a527.tar.gz
fix for /(^|a)b/ breakage from Ilya Zakharevich
p4raw-id: //depot/perl@4724
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index f93519010a..3e7c012332 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -545,9 +545,21 @@ S_study_chunk(pTHX_ regnode **scanp, I32 *deltap, regnode *last, scan_data_t *da
}
}
else if (flags & SCF_DO_STCLASS_AND) {
- cl_and(data->start_class, &accum);
- if (min1)
+ if (min1) {
+ cl_and(data->start_class, &accum);
flags &= ~SCF_DO_STCLASS;
+ }
+ else {
+ /* Switch to OR mode: cache the old value of
+ * data->start_class */
+ StructCopy(data->start_class, &and_with,
+ struct regnode_charclass_class);
+ flags &= ~SCF_DO_STCLASS_AND;
+ StructCopy(&accum, data->start_class,
+ struct regnode_charclass_class);
+ flags |= SCF_DO_STCLASS_OR;
+ data->start_class->flags |= ANYOF_EOS;
+ }
}
}
else if (code == BRANCHJ) /* single branch is optimized. */