summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-12 13:20:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-12 13:20:50 +0000
commit34a95669dad8843e3e9a4af683682ab2f50856dd (patch)
tree165cd3bd3ed70a911853f55055bce1a86632a686 /parse.y
parent976a3041ef38711b84c6a35db25f189d31903e38 (diff)
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
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y20
1 files changed, 20 insertions, 0 deletions
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