diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-02 09:40:27 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-02 09:40:27 +0000 |
commit | 76a5c00be6ee10310571f6dac5147c212f5be5d9 (patch) | |
tree | a8789b8bd9f0f9d796f04288625ec09f8c2d1cea /regcomp.c | |
parent | 1c0dfeef41dd0386e9b1ab479b58eaf7d4eccab4 (diff) |
* regcomp.c (noname_disable_map): add NT_ANCHOR case.
Without this change, captured groups in anchors (look-ahead,
look-behind, and so on) are not removed and
unintended invalid backref error occur. [ruby-core:28235]
* regcomp.c (renumber_by_map): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -1794,6 +1794,20 @@ noname_disable_map(Node** plink, GroupNumRemap* map, int* counter) } break; + case NT_ANCHOR: + { + AnchorNode* an = NANCHOR(node); + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = noname_disable_map(&(an->target), map, counter); + break; + } + } + break; + default: break; } @@ -1852,6 +1866,20 @@ renumber_by_map(Node* node, GroupNumRemap* map) r = renumber_node_backref(node, map); break; + case NT_ANCHOR: + { + AnchorNode* an = NANCHOR(node); + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = renumber_by_map(an->target, map); + break; + } + } + break; + default: break; } |