Skip to content

Commit 088fd96

Browse files
committed
Add a new non-terminal symbol ternary to tidy up
1 parent e996699 commit 088fd96

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

parse.y

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@ rb_parser_ary_free(rb_parser_t *p, rb_parser_ary_t *ary)
27642764
%type <node_def_temp> defn_head defs_head k_def
27652765
%type <node_exits> block_open k_while k_until k_for allow_exits
27662766
%type <node> top_stmts top_stmt begin_block endless_arg endless_command
2767-
%type <node> bodystmt stmts stmt_or_begin stmt expr arg primary
2767+
%type <node> bodystmt stmts stmt_or_begin stmt expr arg ternary primary
27682768
%type <node> command command_call command_call_value method_call
27692769
%type <node> expr_value expr_value_do arg_value primary_value rel_expr
27702770
%type <node_fcall> fcall
@@ -4039,15 +4039,18 @@ arg : asgn(arg_rhs)
40394039
$$ = new_defined(p, $4, &@$);
40404040
/*% ripper: defined!($:4) %*/
40414041
}
4042-
| arg '?' arg '\n'? ':' arg
4042+
| def_endless_method(endless_arg)
4043+
| ternary
4044+
| primary
4045+
;
4046+
4047+
ternary : arg '?' arg '\n'? ':' arg
40434048
{
40444049
value_expr($1);
40454050
$$ = new_if(p, $1, $3, $6, &@$, &NULL_LOC, &@5, &NULL_LOC);
40464051
fixpos($$, $1);
40474052
/*% ripper: ifop!($:1, $:3, $:6) %*/
40484053
}
4049-
| def_endless_method(endless_arg)
4050-
| primary
40514054
;
40524055

40534056
endless_arg : arg %prec modifier_rescue

0 commit comments

Comments
 (0)