summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-30 06:56:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-30 06:56:18 +0000
commit3e9e2bd4ed14de63e8e18e779a5e8c1060ea5bcf (patch)
tree873570181bc80e61f01eca31effb94af645c188c /regcomp.c
parentad2c05f1c0947cbcc5dd86b00dda06bf4c391692 (diff)
* eval.c (rb_eval): NODE_XSTR should pass copy of literal string.
* array.c (rb_ary_update): a[n,m]=nil no longer works as element deletion. * enum.c (enum_sort_by): protect continuation jump in. [ruby-dev:24642] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index de44cfe037..b1a7b0ad14 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -684,7 +684,16 @@ compile_range_repeat_node(QualifierNode* qn, int target_len, int empty_info,
r = compile_tree_empty_check(qn->target, reg, empty_info);
if (r) return r;
- r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG);
+ if (
+ #ifdef USE_SUBEXP_CALL
+ reg->num_call > 0 ||
+ #endif
+ IS_QUALIFIER_IN_REPEAT(qn)) {
+ r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC_SG : OP_REPEAT_INC_NG_SG);
+ }
+ else {
+ r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG);
+ }
if (r) return r;
r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */
return r;
@@ -3057,6 +3066,10 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
QualifierNode* qn = &(NQUALIFIER(node));
Node* target = qn->target;
+ if ((state & IN_REPEAT) != 0) {
+ qn->state |= NST_IN_REPEAT;
+ }
+
if (IS_REPEAT_INFINITE(qn->upper) || qn->upper >= 1) {
r = get_min_match_length(target, &d, env);
if (r) break;