diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-13 06:17:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-13 06:17:08 +0000 |
commit | d6a977f667f9d824cfe95976f3afc31e55580edb (patch) | |
tree | 405767602558aeb10a1dcd3f7c7096eed2ad73c1 | |
parent | db83618d2c49cbab8b78e31ecf5a8979895bc5d6 (diff) | |
download | ruby-d6a977f667f9d824cfe95976f3afc31e55580edb.tar.gz |
* parse.y (block_param, f_args): add rules for the case arguments
begin with kwrest. [ruby-core:42455][Bug #5989]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 16 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 6 |
3 files changed, 27 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Tue Mar 13 15:17:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (block_param, f_args): add rules for the case arguments + begin with kwrest. [ruby-core:42455][Bug #5989] + Tue Mar 13 12:37:53 2012 NARUSE, Yui <naruse@ruby-lang.org> * io.c (io_encoding_set): always warn if external encoding and internal @@ -3672,6 +3672,14 @@ block_param : f_arg ',' f_block_optarg ',' f_rest_arg ',' f_block_kwarg f_kwrest $$ = params_new(Qnil, Qnil, Qnil, Qnil, $1, Qnil, escape_Qundef($2)); %*/ } + | tPOW tIDENTIFIER opt_f_block_arg + { + /*%%%*/ + $$ = new_args(0, 0, 0, 0, 0, $2, $3); + /*% + $$ = params_new(Qnil, Qnil, Qnil, Qnil, Qnil, $2, escape_Qundef($3)); + %*/ + } | f_block_arg { /*%%%*/ @@ -4994,6 +5002,14 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg ',' f_kwarg f_kwrest opt_f_block_arg $$ = params_new(Qnil, Qnil, Qnil, Qnil, $1, Qnil, escape_Qundef($2)); %*/ } + | tPOW tIDENTIFIER opt_f_block_arg + { + /*%%%*/ + $$ = new_args(0, 0, 0, 0, 0, $2, $3); + /*% + $$ = params_new(Qnil, Qnil, Qnil, Qnil, Qnil, $2, escape_Qundef($3)); + %*/ + } | f_block_arg { /*%%%*/ diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index f247b4c6dc..532b989bbd 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -77,6 +77,12 @@ class TestSyntax < Test::Unit::TestCase end end + def test_keyword_rest + bug5989 = '[ruby-core:42455]' + assert_valid_syntax("def kwrest_test(**a) end", __FILE__) + assert_valid_syntax("def kwrest_test(**a, &b) end", __FILE__) + end + private def make_tmpsrc(f, src) |