From 34a95669dad8843e3e9a4af683682ab2f50856dd Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 12 Mar 2013 13:20:50 +0000 Subject: required keyword arguments * compile.c (iseq_set_arguments, iseq_compile_each): support required keyword arguments. [ruby-core:51454] [Feature #7701] * iseq.c (rb_iseq_parameters): ditto. * parse.y (f_kw, f_block_kw): ditto. this syntax is still experimental, the notation may change. * vm_core.h (rb_iseq_struct): ditto. * vm_insnhelper.c (vm_callee_setup_keyword_arg): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 915db67631..62782709f8 100644 --- a/parse.y +++ b/parse.y @@ -4613,6 +4613,16 @@ f_kw : tLABEL arg_value $$ = rb_assoc_new($$, $2); %*/ } + | tLABEL + { + arg_var(formal_argument(get_id($1))); + $$ = assignable($1, (NODE *)-1); + /*%%%*/ + $$ = NEW_KW_ARG(0, $$); + /*% + $$ = rb_assoc_new($$, 0); + %*/ + } ; f_block_kw : tLABEL primary_value @@ -4625,6 +4635,16 @@ f_block_kw : tLABEL primary_value $$ = rb_assoc_new($$, $2); %*/ } + | tLABEL + { + arg_var(formal_argument(get_id($1))); + $$ = assignable($1, (NODE *)-1); + /*%%%*/ + $$ = NEW_KW_ARG(0, $$); + /*% + $$ = rb_assoc_new($$, 0); + %*/ + } ; f_block_kwarg : f_block_kw -- cgit v1.2.3