Permalink
Browse files

* 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
  • Loading branch information...
1 parent db83618 commit d6a977f667f9d824cfe95976f3afc31e55580edb @nobu nobu committed Mar 13, 2012
Showing with 27 additions and 0 deletions.
  1. +5 −0 ChangeLog
  2. +16 −0 parse.y
  3. +6 −0 test/ruby/test_syntax.rb
View
@@ -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
View
@@ -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
{
/*%%%*/
@@ -77,6 +77,12 @@ def test_newline_in_block_parameters
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)

0 comments on commit d6a977f

Please sign in to comment.