From ac83fcdc8ea49cdf30174b452793510d16179642 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 23 Oct 2010 13:02:52 +0000 Subject: merges r29410 from trunk into ruby_1_9_2. -- * parse.y (regexp): dregexp has literal string only at the head and successors are array. [ruby-core:32682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ parse.y | 3 ++- test/ruby/test_literal.rb | 2 ++ version.h | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0dc004d6a..525122225d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 4 12:43:47 2010 Nobuyoshi Nakada + + * parse.y (regexp): dregexp has literal string only at the head + and successors are array. [ruby-core:32682] + Tue Aug 10 11:26:33 2010 NAKAMURA Usaku * lib/un.rb (httpd): SIGQUIT and SIGHUP are not guaranteed to exist. diff --git a/parse.y b/parse.y index 15fb4912ef..ff683a38b4 100644 --- a/parse.y +++ b/parse.y @@ -3890,7 +3890,8 @@ regexp : tREGEXP_BEG regexp_contents tREGEXP_END if (nd_type(list->nd_head) == NODE_STR) { VALUE tail = list->nd_head->nd_lit; if (reg_fragment_check(tail, options) && prev && !NIL_P(prev->nd_lit)) { - if (!literal_concat0(parser, prev->nd_lit, tail)) { + VALUE lit = prev == node ? prev->nd_lit : prev->nd_head->nd_lit; + if (!literal_concat0(parser, lit, tail)) { node = 0; break; } diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index b4480f725a..2c7065c422 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -107,6 +107,8 @@ class TestRubyLiteral < Test::Unit::TestCase def test_dregexp assert_instance_of Regexp, /re#{'ge'}xp/ assert_equal(/regexp/, /re#{'ge'}xp/) + bug3903 = '[ruby-core:32682]' + assert_raise(SyntaxError, bug3903) {eval('/[#{"\x80"}]/')} end def test_array diff --git a/version.h b/version.h index 17834f5a38..c476ecedc3 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 25 +#define RUBY_PATCHLEVEL 26 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit v1.2.3