зеркало из https://github.com/github/ruby.git
* regcomp.c (setup_tree): restart setup_tree() for a node whose
AnchorNode's type is ANCHOR_PREC_BEHIND or ANCHOR_PREC_BEHIND_NOT and divide_look_behind_alternatives() divided it to NT_ALT or NT_LIST. [ruby-core:33370] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f55d567b59
Коммит
f8f3585416
|
@ -1,3 +1,10 @@
|
|||
Fri Nov 26 12:12:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* regcomp.c (setup_tree): restart setup_tree() for a node whose
|
||||
AnchorNode's type is ANCHOR_PREC_BEHIND or ANCHOR_PREC_BEHIND_NOT
|
||||
and divide_look_behind_alternatives() divided it to NT_ALT or
|
||||
NT_LIST. [ruby-core:33370]
|
||||
|
||||
Fri Nov 26 11:40:11 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* vm_dump.c (dump_thread): get only required rights of the target
|
||||
|
|
12
regcomp.c
12
regcomp.c
|
@ -3692,6 +3692,7 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
|
|||
int type;
|
||||
int r = 0;
|
||||
|
||||
restart:
|
||||
type = NTYPE(node);
|
||||
switch (type) {
|
||||
case NT_LIST:
|
||||
|
@ -3906,6 +3907,7 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
|
|||
if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN;
|
||||
r = setup_look_behind(node, reg, env);
|
||||
if (r != 0) return r;
|
||||
if (NTYPE(node) != NT_ANCHOR) goto restart;
|
||||
r = setup_tree(an->target, reg, state, env);
|
||||
}
|
||||
break;
|
||||
|
@ -3918,6 +3920,7 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
|
|||
if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN;
|
||||
r = setup_look_behind(node, reg, env);
|
||||
if (r != 0) return r;
|
||||
if (NTYPE(node) != NT_ANCHOR) goto restart;
|
||||
r = setup_tree(an->target, reg, (state | IN_NOT), env);
|
||||
}
|
||||
break;
|
||||
|
@ -5351,6 +5354,15 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
|
|||
r = onig_parse_make_tree(&root, pattern, pattern_end, reg, &scan_env);
|
||||
if (r != 0) goto err;
|
||||
|
||||
#ifdef ONIG_DEBUG_PARSE_TREE
|
||||
# if 0
|
||||
fprintf(stderr, "ORIGINAL PARSE TREE:\n");
|
||||
if (!onig_is_prelude()) {
|
||||
print_tree(stderr, root);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_NAMED_GROUP
|
||||
/* mixed use named group and no-named group */
|
||||
if (scan_env.num_named > 0 &&
|
||||
|
|
|
@ -583,6 +583,9 @@ class TestRegexp < Test::Unit::TestCase
|
|||
failcheck('(?<!.*)')
|
||||
check(/(?<=A|B.)C/, [%w(C AC), %w(C BXC)], %w(C BC))
|
||||
check(/(?<!A|B.)C/, [%w(C C), %w(C BC)], %w(AC BXC))
|
||||
|
||||
assert_not_match(/(?<!aa|b)c/i, "Aac")
|
||||
assert_not_match(/(?<!b|aa)c/i, "Aac")
|
||||
end
|
||||
|
||||
def test_parse_kg
|
||||
|
|
Загрузка…
Ссылка в новой задаче