ruby-changes:26674
From: nobu <ko1@a...>
Date: Mon, 7 Jan 2013 15:42:37 +0900 (JST)
Subject: [ruby-changes:26674] nobu:r38725 (trunk): parse.y: bare kwrest_mark
nobu 2013-01-07 15:42:13 +0900 (Mon, 07 Jan 2013) New Revision: 38725 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38725 Log: parse.y: bare kwrest_mark * parse.y (f_kwrest): allow bare kwrest_mark as valid syntax. its semantics is still undefined. [Bug #7662] [ruby-core:51269] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_keyword.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38724) +++ ChangeLog (revision 38725) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jan 7 15:42:10 2013 Nobuyoshi Nakada <nobu@r...> + + * parse.y (f_kwrest): allow bare kwrest_mark as valid syntax. its + semantics is still undefined. [Bug #7662] [ruby-core:51269] + Mon Jan 7 15:31:58 2013 Nobuyoshi Nakada <nobu@r...> * parse.y (f_kwrest): reject duplicated kwrest argument name. Index: parse.y =================================================================== --- parse.y (revision 38724) +++ parse.y (revision 38725) @@ -4685,6 +4685,10 @@ f_kwrest : kwrest_mark tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L4685 shadowing_lvar(get_id($2)); $$ = $2; } + | kwrest_mark + { + $$ = internal_id(); + } ; f_opt : tIDENTIFIER '=' arg_value Index: test/ruby/test_keyword.rb =================================================================== --- test/ruby/test_keyword.rb (revision 38724) +++ test/ruby/test_keyword.rb (revision 38725) @@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L1 require 'test/unit' +require_relative 'envutil' class TestKeywordArguments < Test::Unit::TestCase def f1(str: "foo", num: 424242) @@ -266,4 +267,11 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L267 assert_equal(expect, rest_keyrest(*expect), bug7665) assert_equal(expect, proc {|*args, **opt| next *args, opt}.call(*expect), bug7665) end + + def test_bare_kwrest + # valid syntax, but its semantics is undefined + assert_valid_syntax("def bug7662(**) end") + assert_valid_syntax("def bug7662(*, **) end") + assert_valid_syntax("def bug7662(a, **) end") + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/