summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-16 03:42:20 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-16 03:42:20 +0000
commitec82e48deb8fb294bda58afb5a93b0b69817e305 (patch)
tree5d8277bfa20f0d9fe102d68bd9211008e8ae446b /regex.c
parentbcec81835dc263b933f2629aa5329f6c943da60d (diff)
1.2.3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/regex.c b/regex.c
index 045f2a9287..5d93c47811 100644
--- a/regex.c
+++ b/regex.c
@@ -2035,7 +2035,16 @@ re_compile_pattern(pattern, size, bufp)
laststart++;
EXTRACT_NUMBER_AND_INCR(mcnt, laststart);
if (mcnt == 4 && *laststart == anychar) {
- bufp->options |= RE_OPTIMIZE_ANCHOR;
+ switch ((enum regexpcode)laststart[4]) {
+ case jump_n:
+ case finalize_jump:
+ case maybe_finalize_jump:
+ case jump:
+ case jump_past_alt:
+ case dummy_failure_jump:
+ bufp->options |= RE_OPTIMIZE_ANCHOR;
+ break;
+ }
}
else if (*laststart == charset || *laststart == charset_not) {
p0 = laststart;
@@ -3667,8 +3676,13 @@ re_match(bufp, string_arg, size, pos, regs)
because didn't fail. Also remove the register information
put on by the on_failure_jump. */
case finalize_jump:
- POP_FAILURE_POINT();
- /* Note fall through. */
+ if (stackp[-2] == d) {
+ p = stackp[-3];
+ POP_FAILURE_POINT();
+ continue;
+ }
+ POP_FAILURE_POINT();
+ /* Note fall through. */
/* Jump without taking off any failure points. */
case jump: