[前][次][番号順一覧][スレッド一覧]

ruby-changes:36631

From: nobu <ko1@a...>
Date: Fri, 5 Dec 2014 09:46:20 +0900 (JST)
Subject: [ruby-changes:36631] nobu:r48712 (trunk): parse.y: fix lex_state after tLABEL_END

nobu	2014-12-05 09:46:08 +0900 (Fri, 05 Dec 2014)

  New Revision: 48712

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48712

  Log:
    parse.y: fix lex_state after tLABEL_END
    
    * parse.y (parser_yylex): fix lex_state after tLABEL_END, should
      be EXPR_LABELARG to be followed by "paren with arg".
      [ruby-core:66705] [Feature #4935]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_hash.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48711)
+++ ChangeLog	(revision 48712)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Dec  5 09:46:05 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parser_yylex): fix lex_state after tLABEL_END, should
+	  be EXPR_LABELARG to be followed by "paren with arg".
+	  [ruby-core:66705] [Feature #4935]
+
 Fri Dec  5 02:27:47 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/extmk.rb: as all extension objects including initializations
Index: parse.y
===================================================================
--- parse.y	(revision 48711)
+++ parse.y	(revision 48712)
@@ -7842,7 +7842,7 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L7842
 	    if (token == tSTRING_END || token == tREGEXP_END || token == tLABEL_END) {
 		rb_gc_force_recycle((VALUE)lex_strterm);
 		lex_strterm = 0;
-		lex_state = EXPR_END;
+		lex_state = token == tLABEL_END ? EXPR_LABELARG : EXPR_END;
 	    }
 	}
 	return token;
Index: test/ruby/test_hash.rb
===================================================================
--- test/ruby/test_hash.rb	(revision 48711)
+++ test/ruby/test_hash.rb	(revision 48712)
@@ -1274,9 +1274,9 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L1274
     feature4935 = '[ruby-core:37553] [Feature #4935]'
     x = 'world'
     hash = assert_nothing_raised(SyntaxError) do
-      break eval(%q({foo: 1, "foo-bar": 2, "hello-#{x}": 3, 'hello-#{x}': 4}))
+      break eval(%q({foo: 1, "foo-bar": 2, "hello-#{x}": 3, 'hello-#{x}': 4, 'bar': {}}))
     end
-    assert_equal({:foo => 1, :'foo-bar' => 2, :'hello-world' => 3, :'hello-#{x}' => 4}, hash)
+    assert_equal({:foo => 1, :'foo-bar' => 2, :'hello-world' => 3, :'hello-#{x}' => 4, :bar => {}}, hash)
   end
 
   class TestSubHash < TestHash

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]