ruby-changes:17405
From: nobu <ko1@a...>
Date: Mon, 4 Oct 2010 12:47:28 +0900 (JST)
Subject: [ruby-changes:17405] Ruby:r29410 (trunk): * parse.y (regexp): dregexp has literal string only at the head
nobu 2010-10-04 12:43:50 +0900 (Mon, 04 Oct 2010) New Revision: 29410 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29410 Log: * parse.y (regexp): dregexp has literal string only at the head and successors are array. [ruby-core:32682] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_literal.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 29409) +++ ChangeLog (revision 29410) @@ -1,3 +1,8 @@ +Mon Oct 4 12:43:47 2010 Nobuyoshi Nakada <nobu@r...> + + * parse.y (regexp): dregexp has literal string only at the head + and successors are array. [ruby-core:32682] + Mon Oct 4 10:22:21 2010 NARUSE, Yui <naruse@r...> * random.c (rand_init): This checks the value is in 32bit or not, Index: parse.y =================================================================== --- parse.y (revision 29409) +++ parse.y (revision 29410) @@ -3897,7 +3897,8 @@ 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; } Index: test/ruby/test_literal.rb =================================================================== --- test/ruby/test_literal.rb (revision 29409) +++ test/ruby/test_literal.rb (revision 29410) @@ -110,6 +110,8 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/