lib/ruby30_parser.y in ruby_parser-3.16.0 vs lib/ruby30_parser.y in ruby_parser-3.17.0
- old
+ new
@@ -1007,11 +1007,29 @@
paren_args: tLPAREN2 opt_call_args rparen
{
_, args, _ = val
result = args
}
+ | tLPAREN2 args tCOMMA args_forward rparen
+ {
+ yyerror "Unexpected ..." unless
+ self.lexer.is_local_id(:"*") &&
+ self.lexer.is_local_id(:"**") &&
+ self.lexer.is_local_id(:"&")
+ result = call_args val
+ }
+ | tLPAREN2 args_forward rparen
+ {
+ yyerror "Unexpected ..." unless
+ self.lexer.is_local_id(:"*") &&
+ self.lexer.is_local_id(:"**") &&
+ self.lexer.is_local_id(:"&")
+
+ result = call_args val
+ }
+
opt_paren_args: none
| paren_args
opt_call_args: none
| call_args
@@ -2287,10 +2305,24 @@
{
result = val[1]
self.lexer.lex_state = EXPR_BEG
self.lexer.command_start = true
}
+ | tLPAREN2 f_arg tCOMMA args_forward rparen
+ {
+ result = args val
+
+ self.lexer.lex_state = EXPR_BEG
+ self.lexer.command_start = true
+ }
+ | tLPAREN2 args_forward rparen
+ {
+ result = args val
+
+ self.lexer.lex_state = EXPR_BEG
+ self.lexer.command_start = true
+ }
| {
result = self.in_kwarg
self.in_kwarg = true
self.lexer.lex_state |= EXPR_LABEL
}
@@ -2386,10 +2418,15 @@
|
{
result = args val
}
+ args_forward: tBDOT3
+ {
+ result = s(:forward_args).line lexer.lineno
+ }
+
f_bad_arg: tCONSTANT
{
yyerror "formal argument cannot be a constant"
}
| tIVAR
@@ -2514,9 +2551,10 @@
result = :"**#{name}"
}
| kwrest_mark
{
result = :"**"
+ self.env[result] = :lvar
}
f_opt: f_arg_asgn tEQL arg_value
{
result = self.assignable val[0], val[2]