summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-28 09:57:47 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-28 09:57:47 +0000
commitee09f19fdbf047a31ec1c85e6f53ea4a67ded48c (patch)
tree11333e1be6057ca1395d6e10a87e5e090a84e1da /regcomp.c
parent809615987141a9faab189b3b9b74b0f9bd8a2508 (diff)
* regcomp.c (optimize_node_left, set_optimize_info_from_tree): right
handling for look behind anchor. * regexec.c (onig_search): ditto. [Backport #8076] this patch is derived from Onigmo base tree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@39983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 7c29fb5203..154e2d798f 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4735,6 +4735,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
case ANCHOR_END_BUF:
case ANCHOR_SEMI_END_BUF:
case ANCHOR_END_LINE:
+ case ANCHOR_LOOK_BEHIND: /* just for (?<=x).* */
add_opt_anc_info(&opt->anc, NANCHOR(node)->type);
break;
@@ -4758,7 +4759,6 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
break;
case ANCHOR_PREC_READ_NOT:
- case ANCHOR_LOOK_BEHIND: /* Sorry, I can't make use of it. */
case ANCHOR_LOOK_BEHIND_NOT:
break;
}
@@ -5010,7 +5010,8 @@ set_optimize_info_from_tree(Node* node, regex_t* reg, ScanEnv* scan_env)
if (r) return r;
reg->anchor = opt.anc.left_anchor & (ANCHOR_BEGIN_BUF |
- ANCHOR_BEGIN_POSITION | ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML);
+ ANCHOR_BEGIN_POSITION | ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML |
+ ANCHOR_LOOK_BEHIND);
reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF);