Use user defined parameterizing rules args_tail_basic
This commit is contained in:
parent
f2483c79fe
commit
84f51eb02a
Notes:
git
2025-03-13 15:20:52 +00:00
64
parse.y
64
parse.y
@ -2921,6 +2921,28 @@ rb_parser_ary_free(rb_parser_t *p, rb_parser_ary_t *ary)
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
%rule args_tail_basic(value) <node_args>
|
||||||
|
: f_kwarg(value) ',' f_kwrest opt_f_block_arg
|
||||||
|
{
|
||||||
|
$$ = new_args_tail(p, $1, $3, $4, &@3);
|
||||||
|
/*% ripper: [$:1, $:3, $:4] %*/
|
||||||
|
}
|
||||||
|
| f_kwarg(value) opt_f_block_arg
|
||||||
|
{
|
||||||
|
$$ = new_args_tail(p, $1, 0, $2, &@1);
|
||||||
|
/*% ripper: [$:1, Qnil, $:2] %*/
|
||||||
|
}
|
||||||
|
| f_any_kwrest opt_f_block_arg
|
||||||
|
{
|
||||||
|
$$ = new_args_tail(p, 0, $1, $2, &@1);
|
||||||
|
/*% ripper: [Qnil, $:1, $:2] %*/
|
||||||
|
}
|
||||||
|
| f_block_arg
|
||||||
|
{
|
||||||
|
$$ = new_args_tail(p, 0, 0, $1, &@1);
|
||||||
|
/*% ripper: [Qnil, Qnil, $:1] %*/
|
||||||
|
}
|
||||||
|
|
||||||
%rule def_endless_method(bodystmt) <node>
|
%rule def_endless_method(bodystmt) <node>
|
||||||
: defn_head[head] f_opt_paren_args[args] '=' bodystmt
|
: defn_head[head] f_opt_paren_args[args] '=' bodystmt
|
||||||
{
|
{
|
||||||
@ -4932,26 +4954,7 @@ f_any_kwrest : f_kwrest
|
|||||||
|
|
||||||
f_eq : {p->ctxt.in_argdef = 0;} '=';
|
f_eq : {p->ctxt.in_argdef = 0;} '=';
|
||||||
|
|
||||||
block_args_tail : f_kwarg(primary_value) ',' f_kwrest opt_f_block_arg
|
block_args_tail : args_tail_basic(primary_value)
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, $1, $3, $4, &@3);
|
|
||||||
/*% ripper: [$:1, $:3, $:4] %*/
|
|
||||||
}
|
|
||||||
| f_kwarg(primary_value) opt_f_block_arg
|
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, $1, 0, $2, &@1);
|
|
||||||
/*% ripper: [$:1, Qnil, $:2] %*/
|
|
||||||
}
|
|
||||||
| f_any_kwrest opt_f_block_arg
|
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, 0, $1, $2, &@1);
|
|
||||||
/*% ripper: [Qnil, $:1, $:2] %*/
|
|
||||||
}
|
|
||||||
| f_block_arg
|
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, 0, 0, $1, &@1);
|
|
||||||
/*% ripper: [Qnil, Qnil, $:1] %*/
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
excessed_comma : ','
|
excessed_comma : ','
|
||||||
@ -6295,26 +6298,7 @@ f_arglist : f_paren_args
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
args_tail : f_kwarg(arg_value) ',' f_kwrest opt_f_block_arg
|
args_tail : args_tail_basic(arg_value)
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, $1, $3, $4, &@3);
|
|
||||||
/*% ripper: [$:1, $:3, $:4] %*/
|
|
||||||
}
|
|
||||||
| f_kwarg(arg_value) opt_f_block_arg
|
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, $1, 0, $2, &@1);
|
|
||||||
/*% ripper: [$:1, Qnil, $:2] %*/
|
|
||||||
}
|
|
||||||
| f_any_kwrest opt_f_block_arg
|
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, 0, $1, $2, &@1);
|
|
||||||
/*% ripper: [Qnil, $:1, $:2] %*/
|
|
||||||
}
|
|
||||||
| f_block_arg
|
|
||||||
{
|
|
||||||
$$ = new_args_tail(p, 0, 0, $1, &@1);
|
|
||||||
/*% ripper: [Qnil, Qnil, $:1] %*/
|
|
||||||
}
|
|
||||||
| args_forward
|
| args_forward
|
||||||
{
|
{
|
||||||
ID fwd = $args_forward;
|
ID fwd = $args_forward;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user