aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorVladimir Dementyev <dementiev.vm@gmail.com>2022-01-11 13:20:19 +0300
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-11 19:58:57 +0900
commitb633c9ac1cc06610c09aaeba1faa2bf3da7d2be0 (patch)
tree8d64b13f28f7af5553495f641d3e1e232b28b564 /parse.y
parentb5310b8975dffd18a90e149e00673b585101cab8 (diff)
downloadruby-b633c9ac1cc06610c09aaeba1faa2bf3da7d2be0.tar.gz
Reduce p_args rules with p_rest
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y16
1 files changed, 4 insertions, 12 deletions
diff --git a/parse.y b/parse.y
index ffef9955cc..b1b2c8860b 100644
--- a/parse.y
+++ b/parse.y
@@ -4319,21 +4319,13 @@ p_args : p_expr
$$ = new_array_pattern_tail(p, pre_args, 0, 0, Qnone, &@$);
%*/
}
- | p_args_head tSTAR tIDENTIFIER
+ | p_args_head p_rest
{
- $$ = new_array_pattern_tail(p, $1, 1, $3, Qnone, &@$);
+ $$ = new_array_pattern_tail(p, $1, 1, $2, Qnone, &@$);
}
- | p_args_head tSTAR tIDENTIFIER ',' p_args_post
+ | p_args_head p_rest ',' p_args_post
{
- $$ = new_array_pattern_tail(p, $1, 1, $3, $5, &@$);
- }
- | p_args_head tSTAR
- {
- $$ = new_array_pattern_tail(p, $1, 1, 0, Qnone, &@$);
- }
- | p_args_head tSTAR ',' p_args_post
- {
- $$ = new_array_pattern_tail(p, $1, 1, 0, $4, &@$);
+ $$ = new_array_pattern_tail(p, $1, 1, $2, $4, &@$);
}
| p_args_tail
;