1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-05 00:46:08 +00:00
parent 1e6a101237
commit cbdac1eaf6
3 changed files with 9 additions and 3 deletions

View file

@ -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

View file

@ -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;

View file

@ -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