summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-17 16:53:25 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-17 16:53:25 (GMT)
commitce5827c6fb5f211a937282dcbda3b857f8845a9b (patch)
treedb53076e8e44f3a8d2ee83b9f9e45f7cc7251e91 /regcomp.c
parent3eabe19ea9cdee6064231d298683701e7ba0056e (diff)
* regcomp.c: revert r26701; it introduces Bug #3681.
[ruby-core:31677] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/regcomp.c b/regcomp.c
index ef4c086..6b03019 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3671,7 +3671,6 @@ setup_comb_exp_check(Node* node, int state, ScanEnv* env)
#define IN_NOT (1<<1)
#define IN_REPEAT (1<<2)
#define IN_VAR_REPEAT (1<<3)
-#define IN_LAST (1<<4)
/* setup_tree does the following work.
1. check empty loop. (set qn->target_empty_info)
@@ -3693,8 +3692,7 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
{
Node* prev = NULL_NODE;
do {
- int s = IS_NOT_NULL(NCDR(node)) ? (state & ~IN_LAST) : state;
- r = setup_tree(NCAR(node), reg, s, env);
+ r = setup_tree(NCAR(node), reg, state, env);
if (IS_NOT_NULL(prev) && r == 0) {
r = next_setup(prev, NCAR(node), reg);
}
@@ -3825,20 +3823,6 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
}
}
#endif
-
- if ((state & IN_LAST) != 0 && qn->greedy && IS_REPEAT_INFINITE(qn->upper)) {
- /* automatic posseivation a* (at last) ==> (?>a*) */
- if (qn->lower <= 1) {
- int ttype = NTYPE(qn->target);
- if (IS_NODE_TYPE_SIMPLE(ttype)) {
- Node* en = onig_node_new_enclose(ENCLOSE_STOP_BACKTRACK);
- CHECK_NULL_RETURN_MEMERR(en);
- SET_ENCLOSE_STATUS(en, NST_STOP_BT_SIMPLE_REPEAT);
- swap_node(node, en);
- NENCLOSE(node)->target = en;
- }
- }
- }
}
break;
@@ -5393,7 +5377,7 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
reg->num_call = 0;
#endif
- r = setup_tree(root, reg, IN_LAST, &scan_env);
+ r = setup_tree(root, reg, 0, &scan_env);
if (r != 0) goto err_unset;
#ifdef ONIG_DEBUG_PARSE_TREE