mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 55562: [Backport #12454]
* regcomp.c (noname_disable_map): don't optimize out group 0 Ruby's Regexp doesn't allow normal numbered groups if the regexp has named groups. On such case it optimizes out related NT_ENCLOSE. But even on the case it can use \g<0>. This fix not to remove NT_ENCLOSE whose regnum is 0. [ruby-core:75828] [Bug #12454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b7c5eba722
commit
ab61e5c932
4 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Tue Aug 16 04:16:14 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* regcomp.c (noname_disable_map): don't optimize out group 0
|
||||||
|
Ruby's Regexp doesn't allow normal numbered groups if the regexp
|
||||||
|
has named groups. On such case it optimizes out related NT_ENCLOSE.
|
||||||
|
But even on the case it can use \g<0>.
|
||||||
|
This fix not to remove NT_ENCLOSE whose regnum is 0.
|
||||||
|
[ruby-core:75828] [Bug #12454]
|
||||||
|
|
||||||
Tue Aug 16 04:06:52 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Aug 16 04:06:52 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* missing/crypt.c: fix size macros to use configured values
|
* missing/crypt.c: fix size macros to use configured values
|
||||||
|
|
|
@ -1876,16 +1876,15 @@ noname_disable_map(Node** plink, GroupNumRemap* map, int* counter)
|
||||||
(*counter)++;
|
(*counter)++;
|
||||||
map[en->regnum].new_val = *counter;
|
map[en->regnum].new_val = *counter;
|
||||||
en->regnum = *counter;
|
en->regnum = *counter;
|
||||||
r = noname_disable_map(&(en->target), map, counter);
|
|
||||||
}
|
}
|
||||||
else {
|
else if (en->regnum != 0) {
|
||||||
*plink = en->target;
|
*plink = en->target;
|
||||||
en->target = NULL_NODE;
|
en->target = NULL_NODE;
|
||||||
onig_node_free(node);
|
onig_node_free(node);
|
||||||
r = noname_disable_map(plink, map, counter);
|
r = noname_disable_map(plink, map, counter);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
r = noname_disable_map(&(en->target), map, counter);
|
r = noname_disable_map(&(en->target), map, counter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -391,6 +391,7 @@ class TestRegexp < Test::Unit::TestCase
|
||||||
assert_raise(RegexpError) { Regexp.new(")(") }
|
assert_raise(RegexpError) { Regexp.new(")(") }
|
||||||
assert_raise(RegexpError) { Regexp.new('[\\40000000000') }
|
assert_raise(RegexpError) { Regexp.new('[\\40000000000') }
|
||||||
assert_raise(RegexpError) { Regexp.new('[\\600000000000.') }
|
assert_raise(RegexpError) { Regexp.new('[\\600000000000.') }
|
||||||
|
assert_raise(RegexpError) { Regexp.new("((?<v>))\\g<0>") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_unescape
|
def test_unescape
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.3.2"
|
#define RUBY_VERSION "2.3.2"
|
||||||
#define RUBY_RELEASE_DATE "2016-08-16"
|
#define RUBY_RELEASE_DATE "2016-08-16"
|
||||||
#define RUBY_PATCHLEVEL 158
|
#define RUBY_PATCHLEVEL 159
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2016
|
#define RUBY_RELEASE_YEAR 2016
|
||||||
#define RUBY_RELEASE_MONTH 8
|
#define RUBY_RELEASE_MONTH 8
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue