summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-05 00:46:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-05 00:46:08 +0000
commitcbdac1eaf69e52d353e85951f6667b6332abcff7 (patch)
tree06f3729d376fe2bcdc16cca20f2d4ef43cb7c040
parent1e6a1012374367b812e98eedf940feb2e3068153 (diff)
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
-rw-r--r--ChangeLog6
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_hash.rb4
3 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a3eed039c..169638abe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/parse.y b/parse.y
index 13a0f480ec..924ec57260 100644
--- a/parse.y
+++ b/parse.y
@@ -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