diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-21 10:53:10 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-21 10:53:10 +0900 |
| commit | e7f5cd7d4e21fe70aac62297c97e4ae70fad1e5f (patch) | |
| tree | 32fc73abb5956ecfcac97f8256f90181b529f0b3 /src/parse.y | |
| parent | 4654db4fdc3c83c6feb7d6e49afa61d341a74af7 (diff) | |
| parent | 367118b1b678b83869a9106191cb85197c9ef525 (diff) | |
| download | mruby-e7f5cd7d4e21fe70aac62297c97e4ae70fad1e5f.tar.gz mruby-e7f5cd7d4e21fe70aac62297c97e4ae70fad1e5f.zip | |
Merge pull request #2097 from nobu/optional_arguments_in_rhs
fix optional arguments in rhs
Diffstat (limited to 'src/parse.y')
| -rw-r--r-- | src/parse.y | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/parse.y b/src/parse.y index 1a3dadd61..fab6397e6 100644 --- a/src/parse.y +++ b/src/parse.y @@ -1075,7 +1075,7 @@ heredoc_end(parser_state *p) %type <nd> brace_block cmd_brace_block do_block lhs none f_bad_arg %type <nd> mlhs mlhs_list mlhs_post mlhs_basic mlhs_item mlhs_node mlhs_inner %type <id> fsym sym basic_symbol operation operation2 operation3 -%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg +%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_opt_asgn %type <nd> heredoc words symbols %token tUPLUS /* unary+ */ @@ -3052,10 +3052,16 @@ f_arg : f_arg_item } ; -f_opt : tIDENTIFIER '=' arg_value +f_opt_asgn : tIDENTIFIER '=' { local_add_f(p, $1); - $$ = cons(nsym($1), $3); + $$ = $1; + } + ; + +f_opt : f_opt_asgn arg_value + { + $$ = cons(nsym($1), $2); } ; |
