mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: opt_arg_append
* parse.y (opt_arg_append): extract optional arguments append. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf2ddcf8c1
commit
c56ac08636
1 changed files with 16 additions and 14 deletions
30
parse.y
30
parse.y
|
@ -494,6 +494,7 @@ static NODE *const_decl_gen(struct parser_params *parser, NODE* path, const YYLT
|
||||||
#define var_field(n) (n)
|
#define var_field(n) (n)
|
||||||
#define backref_assign_error(n, a, location) (rb_backref_error(n), new_begin(0, location))
|
#define backref_assign_error(n, a, location) (rb_backref_error(n), new_begin(0, location))
|
||||||
|
|
||||||
|
static NODE *opt_arg_append(NODE*, NODE*);
|
||||||
static NODE *kwd_append(NODE*, NODE*);
|
static NODE *kwd_append(NODE*, NODE*);
|
||||||
|
|
||||||
static NODE *new_hash_gen(struct parser_params *parser, NODE *hash, const YYLTYPE *location);
|
static NODE *new_hash_gen(struct parser_params *parser, NODE *hash, const YYLTYPE *location);
|
||||||
|
@ -4797,13 +4798,7 @@ f_block_optarg : f_block_opt
|
||||||
| f_block_optarg ',' f_block_opt
|
| f_block_optarg ',' f_block_opt
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
NODE *opts = $1;
|
$$ = opt_arg_append($1, $3);
|
||||||
|
|
||||||
while (opts->nd_next) {
|
|
||||||
opts = opts->nd_next;
|
|
||||||
}
|
|
||||||
opts->nd_next = $3;
|
|
||||||
$$ = $1;
|
|
||||||
/*%
|
/*%
|
||||||
$$ = rb_ary_push($1, get_value($3));
|
$$ = rb_ary_push($1, get_value($3));
|
||||||
%*/
|
%*/
|
||||||
|
@ -4821,13 +4816,7 @@ f_optarg : f_opt
|
||||||
| f_optarg ',' f_opt
|
| f_optarg ',' f_opt
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
NODE *opts = $1;
|
$$ = opt_arg_append($1, $3);
|
||||||
|
|
||||||
while (opts->nd_next) {
|
|
||||||
opts = opts->nd_next;
|
|
||||||
}
|
|
||||||
opts->nd_next = $3;
|
|
||||||
$$ = $1;
|
|
||||||
/*%
|
/*%
|
||||||
$$ = rb_ary_push($1, get_value($3));
|
$$ = rb_ary_push($1, get_value($3));
|
||||||
%*/
|
%*/
|
||||||
|
@ -9350,6 +9339,19 @@ gettable_gen(struct parser_params *parser, ID id, const YYLTYPE *location)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NODE *
|
||||||
|
opt_arg_append(NODE *opt_list, NODE *opt)
|
||||||
|
{
|
||||||
|
NODE *opts = opt_list;
|
||||||
|
|
||||||
|
while (opts->nd_next) {
|
||||||
|
opts = opts->nd_next;
|
||||||
|
}
|
||||||
|
opts->nd_next = opt;
|
||||||
|
|
||||||
|
return opt_list;
|
||||||
|
}
|
||||||
|
|
||||||
static NODE *
|
static NODE *
|
||||||
kwd_append(NODE *kwlist, NODE *kw)
|
kwd_append(NODE *kwlist, NODE *kw)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue