Skip to content

Commit

Permalink
Use option('\n') instead of opt_nl
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Feb 22, 2024
1 parent 6a0b05f commit 81dabb4
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -3234,7 +3234,7 @@ endless_command : command
$$ = rescued_expr(p, $1, $4, &@1, &@2, &@4);
/*% ripper: rescue_mod!($:1, $:4) %*/
}
| keyword_not opt_nl endless_command
| keyword_not option('\n') endless_command
{
$$ = call_uni_op(p, method_cond(p, $3, &@3), METHOD_NOT, &@1, &@$);
/*% ripper: unary!(ID2VAL(idNOT), $:3) %*/
Expand Down Expand Up @@ -3268,7 +3268,7 @@ expr : command_call
$$ = logop(p, idOR, $1, $3, &@2, &@$);
/*% ripper: binary!($:1, ID2VAL(idOR), $:3) %*/
}
| keyword_not opt_nl expr
| keyword_not option('\n') expr
{
$$ = call_uni_op(p, method_cond(p, $3, &@3), METHOD_NOT, &@1, &@$);
/*% ripper: unary!(ID2VAL(idNOT), $:3) %*/
Expand Down Expand Up @@ -3988,13 +3988,13 @@ arg : lhs '=' lex_ctxt arg_rhs
$$ = logop(p, idOROP, $1, $3, &@2, &@$);
/*% ripper: binary!($:1, ID2VAL(idOROP), $:3) %*/
}
| keyword_defined opt_nl begin_defined arg
| keyword_defined option('\n') begin_defined arg
{
p->ctxt.in_defined = $3.in_defined;
$$ = new_defined(p, $4, &@$);
/*% ripper: defined!($:4) %*/
}
| arg '?' arg opt_nl ':' arg
| arg '?' arg option('\n') ':' arg
{
value_expr($1);
$$ = new_if(p, $1, $3, $6, &@$);
Expand Down Expand Up @@ -4044,7 +4044,7 @@ endless_arg : arg %prec modifier_rescue
$$ = rescued_expr(p, $1, $4, &@1, &@2, &@4);
/*% ripper: rescue_mod!($:1, $:4) %*/
}
| keyword_not opt_nl endless_arg
| keyword_not option('\n') endless_arg
{
$$ = call_uni_op(p, method_cond(p, $3, &@3), METHOD_NOT, &@1, &@$);
/*% ripper: unary!(ID2VAL(idNOT), $:3) %*/
Expand Down Expand Up @@ -4408,7 +4408,7 @@ primary : literal
$$ = NEW_YIELD(0, &@$);
/*% ripper: yield0! %*/
}
| keyword_defined opt_nl '(' begin_defined expr rparen
| keyword_defined option('\n') '(' begin_defined expr rparen
{
p->ctxt.in_defined = $4.in_defined;
$$ = new_defined(p, $5, &@$);
Expand Down Expand Up @@ -5095,12 +5095,12 @@ block_param_def : '|' opt_bv_decl '|'
;


opt_bv_decl : opt_nl
opt_bv_decl : option('\n')
{
$$ = 0;
/*% ripper: Qfalse %*/
}
| opt_nl ';' bv_decls opt_nl
| option('\n') ';' bv_decls option('\n')
{
$$ = 0;
/*% ripper: get_value($:3) %*/
Expand Down Expand Up @@ -6942,22 +6942,18 @@ call_op2 : call_op
| tCOLON2
;

opt_nl : /* none */
| '\n'
;
rparen : option('\n') ')'
;

rparen : opt_nl ')'
;
rbracket : option('\n') ']'
;

rbracket : opt_nl ']'
;
rbrace : option('\n') '}'
;

rbrace : opt_nl '}'
;

trailer : opt_nl
| ','
;
trailer : option('\n')
| ','
;

term : ';' {yyerrok;token_flush(p);}
| '\n'
Expand Down

0 comments on commit 81dabb4

Please sign in to comment.