Skip to content

Commit

Permalink
+ ruby28.y: unify kwrest and no-kwrest rules. (#694)
Browse files Browse the repository at this point in the history
This commit tracks upstream commit ruby/ruby@276859e.
  • Loading branch information
iliabylich committed May 22, 2020
1 parent de200f1 commit 742db78
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions lib/parser/ruby28.y
Expand Up @@ -1419,6 +1419,9 @@ rule
result = @builder.restarg(val[0])
}
f_any_kwrest: f_kwrest
| f_no_kwarg
block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
{
result = val[0].concat(val[2]).concat(val[3])
Expand All @@ -1427,11 +1430,7 @@ rule
{
result = val[0].concat(val[1])
}
| f_kwrest opt_f_block_arg
{
result = val[0].concat(val[1])
}
| f_no_kwarg opt_f_block_arg
| f_any_kwrest opt_f_block_arg
{
result = val[0].concat(val[1])
}
Expand Down Expand Up @@ -2030,7 +2029,7 @@ opt_block_args_tail:
p_arg: p_expr
p_kwargs: p_kwarg tCOMMA p_kwrest
p_kwargs: p_kwarg tCOMMA p_any_kwrest
{
result = [ *val[0], *val[2] ]
}
Expand All @@ -2042,18 +2041,10 @@ opt_block_args_tail:
{
result = val[0]
}
| p_kwrest
| p_any_kwrest
{
result = val[0]
}
| p_kwarg tCOMMA p_kwnorest
{
result = [ *val[0], *val[2] ]
}
| p_kwnorest
{
result = [ *val[0], *val[2] ]
}
p_kwarg: p_kw
{
Expand Down Expand Up @@ -2097,6 +2088,9 @@ opt_block_args_tail:
result = [ @builder.match_nil_pattern(val[0], val[1]) ]
}
p_any_kwrest: p_kwrest
| p_kwnorest
p_value: p_primitive
| p_primitive tDOT2 p_primitive
{
Expand Down Expand Up @@ -2597,11 +2591,7 @@ keyword_variable: kNIL
{
result = val[0].concat(val[1])
}
| f_kwrest opt_f_block_arg
{
result = val[0].concat(val[1])
}
| f_no_kwarg opt_f_block_arg
| f_any_kwrest opt_f_block_arg
{
result = val[0].concat(val[1])
}
Expand Down

0 comments on commit 742db78

Please sign in to comment.