summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-13 11:17:18 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-13 11:17:18 +0000
commit99ac392284108802b57722dcd7d0fb5e1942206f (patch)
tree90e004ab28a3301206e1e5a35f10d5668fb4d4d7
parent5f0324e52ddb861eb760716abae63120c3ec5643 (diff)
* 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
-rw-r--r--ChangeLog6
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_syntax.rb6
3 files changed, 13 insertions, 1 deletions
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 <yugui@yugui.jp>
+
+ * 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 <hsbt@ruby-lang.org>
* 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 }