summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2022-09-09 14:00:27 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2022-09-09 14:00:27 +0900
commitdb0e0dad1171456253ebd899e7e878823923d3d8 (patch)
treeb508300c459b536d0bb8e92ca5c0a9e32710de3a /parse.y
parent59eadf3d25b0f53e7570f98f1801737af642f328 (diff)
Fix unexpected "duplicated key name" error in paren-less one line pattern matching
[Bug #18990]
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y16
1 files changed, 12 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index e6fee29595..38f7690ccc 100644
--- a/parse.y
+++ b/parse.y
@@ -1774,14 +1774,18 @@ expr : command_call
p->ctxt.in_kwarg = 1;
$<tbl>$ = push_pvtbl(p);
}
+ {
+ $<tbl>$ = push_pktbl(p);
+ }
p_top_expr_body
{
+ pop_pktbl(p, $<tbl>4);
pop_pvtbl(p, $<tbl>3);
p->ctxt.in_kwarg = $<ctxt>2.in_kwarg;
/*%%%*/
- $$ = NEW_CASE3($1, NEW_IN($4, 0, 0, &@4), &@$);
+ $$ = NEW_CASE3($1, NEW_IN($5, 0, 0, &@5), &@$);
/*% %*/
- /*% ripper: case!($1, in!($4, Qnil, Qnil)) %*/
+ /*% ripper: case!($1, in!($5, Qnil, Qnil)) %*/
}
| arg keyword_in
{
@@ -1792,14 +1796,18 @@ expr : command_call
p->ctxt.in_kwarg = 1;
$<tbl>$ = push_pvtbl(p);
}
+ {
+ $<tbl>$ = push_pktbl(p);
+ }
p_top_expr_body
{
+ pop_pktbl(p, $<tbl>4);
pop_pvtbl(p, $<tbl>3);
p->ctxt.in_kwarg = $<ctxt>2.in_kwarg;
/*%%%*/
- $$ = NEW_CASE3($1, NEW_IN($4, NEW_TRUE(&@4), NEW_FALSE(&@4), &@4), &@$);
+ $$ = NEW_CASE3($1, NEW_IN($5, NEW_TRUE(&@5), NEW_FALSE(&@5), &@5), &@$);
/*% %*/
- /*% ripper: case!($1, in!($4, Qnil, Qnil)) %*/
+ /*% ripper: case!($1, in!($5, Qnil, Qnil)) %*/
}
| arg %prec tLBRACE_ARG
;