ruby-changes:43835
From: nagachika <ko1@a...>
Date: Tue, 16 Aug 2016 04:24:54 +0900 (JST)
Subject: [ruby-changes:43835] nagachika:r55908 (ruby_2_3): merge revision(s) 55562: [Backport #12454]
nagachika 2016-08-16 04:24:47 +0900 (Tue, 16 Aug 2016) New Revision: 55908 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55908 Log: 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] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/regcomp.c branches/ruby_2_3/test/ruby/test_regexp.rb branches/ruby_2_3/version.h Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 55907) +++ ruby_2_3/version.h (revision 55908) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-08-16" -#define RUBY_PATCHLEVEL 158 +#define RUBY_PATCHLEVEL 159 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_3/test/ruby/test_regexp.rb =================================================================== --- ruby_2_3/test/ruby/test_regexp.rb (revision 55907) +++ ruby_2_3/test/ruby/test_regexp.rb (revision 55908) @@ -391,6 +391,7 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_regexp.rb#L391 assert_raise(RegexpError) { Regexp.new(")(") } assert_raise(RegexpError) { Regexp.new('[\\40000000000') } assert_raise(RegexpError) { Regexp.new('[\\600000000000.') } + assert_raise(RegexpError) { Regexp.new("((?<v>))\\g<0>") } end def test_unescape Index: ruby_2_3/regcomp.c =================================================================== --- ruby_2_3/regcomp.c (revision 55907) +++ ruby_2_3/regcomp.c (revision 55908) @@ -1876,17 +1876,16 @@ noname_disable_map(Node** plink, GroupNu https://github.com/ruby/ruby/blob/trunk/ruby_2_3/regcomp.c#L1876 (*counter)++; map[en->regnum].new_val = *counter; en->regnum = *counter; - r = noname_disable_map(&(en->target), map, counter); } - else { + else if (en->regnum != 0) { *plink = en->target; en->target = NULL_NODE; onig_node_free(node); 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; Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 55907) +++ ruby_2_3/ChangeLog (revision 55908) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Tue Aug 16 04:16:14 2016 NARUSE, Yui <naruse@r...> + + * 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@r...> * missing/crypt.c: fix size macros to use configured values Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55562 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/