From 99ac392284108802b57722dcd7d0fb5e1942206f Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 13 Dec 2015 11:17:18 +0000 Subject: * parse.y (parse_percent): Allow %-literals in labeled arg as r51624 did for parentheses. Fixes [ruby-core:72084] [Bug #11812]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ parse.y | 2 +- test/ruby/test_syntax.rb | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c57e7d9516..79d22a4a9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Dec 13 20:12:14 2015 Yuki Yugui Sonoda + + * parse.y (parse_percent): Allow %-literals in labeled arg as + r51624 did for parentheses. + Fixes [ruby-core:72084] [Bug #11812]. + Sun Dec 13 20:02:15 2015 SHIBATA Hiroshi * ChangeLog: fix a typo diff --git a/parse.y b/parse.y index 1ed56ac165..c3b5bb13d0 100644 --- a/parse.y +++ b/parse.y @@ -7696,7 +7696,7 @@ parse_percent(struct parser_params *parser, const int space_seen, const enum lex { register int c; - if (IS_lex_state(EXPR_BEG_ANY)) { + if (IS_BEG()) { int term; int paren; diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 82af7817e7..2ed3859860 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -335,6 +335,12 @@ WARN assert_valid_syntax("{foo: /=/}", bug11456) end + def test_percent_string_after_label + bug11812 = ['ruby-core:72084'] + assert_valid_syntax('{label:%w(*)}', bug11812) + assert_valid_syntax('{label: %w(*)}', bug11812) + end + def test_duplicated_arg assert_syntax_error("def foo(a, a) end", /duplicated argument name/) assert_nothing_raised { def foo(_, _) end } -- cgit v1.2.3