summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-10 08:44:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-10 08:44:29 +0000
commit997ff23758884944f28a089eaa50ac7eb1c026c6 (patch)
treef99563ed31c2f6a8facc7160cccde602d39af79b /regex.c
parentd148ffef297193fe5f6639a8bd8c9ee3d3374479 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@397 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 f504ff8a0f..20b3d2d66a 100644
--- a/regex.c
+++ b/regex.c
@@ -2069,7 +2069,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;
@@ -3692,8 +3701,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: