Skip to content

Commit

Permalink
Include the entire lambda expression in lambda rule
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jun 2, 2020
1 parent 79a8ed0 commit 27bef64
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions parse.y
Expand Up @@ -2912,17 +2912,7 @@ primary : literal
/*% %*/
/*% ripper: method_add_block!($1, $2) %*/
}
| tLAMBDA
{
token_info_push(p, "->", &@1);
}
lambda
{
$$ = $3;
/*%%%*/
nd_set_first_loc($$, @1.beg_pos);
/*% %*/
}
| lambda
| k_if expr_value then
compstmt
if_tail
Expand Down Expand Up @@ -3605,10 +3595,10 @@ bvar : tIDENTIFIER
}
;

lambda : {
$<vars>$ = dyna_push(p);
}
lambda : tLAMBDA
{
token_info_push(p, "->", &@1);
$<vars>1 = dyna_push(p);
$<num>$ = p->lex.lpar_beg;
p->lex.lpar_beg = p->lex.paren_nest;
}
Expand Down Expand Up @@ -3636,6 +3626,7 @@ lambda : {
$$ = NEW_LAMBDA($5, $7, &loc);
nd_set_line($$->nd_body, @7.end_pos.lineno);
nd_set_line($$, @5.end_pos.lineno);
nd_set_first_loc($$, @1.beg_pos);
}
/*% %*/
/*% ripper: lambda!($5, $7) %*/
Expand Down Expand Up @@ -4347,17 +4338,7 @@ p_primitive : literal
/*% %*/
/*% ripper: var_ref!($1) %*/
}
| tLAMBDA
{
token_info_push(p, "->", &@1);
}
lambda
{
$$ = $3;
/*%%%*/
nd_set_first_loc($$, @1.beg_pos);
/*% %*/
}
| lambda
;

p_variable : tIDENTIFIER
Expand Down

0 comments on commit 27bef64

Please sign in to comment.