diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ruby/test_hash.rb | 4 |
3 files changed, 9 insertions, 3 deletions
@@ -1,3 +1,9 @@ +Fri Dec 5 09:46:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * ext/extmk.rb: as all extension objects including initializations @@ -7842,7 +7842,7 @@ parser_yylex(struct parser_params *parser) 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; diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index d769ef89e7..86305ee958 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1274,9 +1274,9 @@ class TestHash < Test::Unit::TestCase 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 |