aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y13
1 files changed, 10 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index 355c9afa71..f7c2bb46a2 100644
--- a/parse.y
+++ b/parse.y
@@ -669,7 +669,7 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
%type <node> brace_block cmd_brace_block do_block lhs none fitem
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
%type <id> fsym variable sym symbol operation operation2 operation3
-%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg
+%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
/*%%%*/
/*%
%type <val> program reswords then do dot_or_colon
@@ -3250,7 +3250,7 @@ bv_decls : bvar
%*/
;
-bvar : f_norm_arg
+bvar : tIDENTIFIER
{
/*%%%*/
new_bv($1);
@@ -3258,6 +3258,10 @@ bvar : f_norm_arg
$$ = $1;
%*/
}
+ | f_bad_arg
+ {
+ $$ = 0;
+ }
;
lambda : {
@@ -4135,7 +4139,7 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
}
;
-f_norm_arg : tCONSTANT
+f_bad_arg : tCONSTANT
{
/*%%%*/
yyerror("formal argument cannot be a constant");
@@ -4171,6 +4175,9 @@ f_norm_arg : tCONSTANT
$$ = dispatch1(param_error, $1);
%*/
}
+ ;
+
+f_norm_arg : f_bad_arg
| tIDENTIFIER
{
/*%%%*/