Allow trailing comma in hash pattern
This commit is contained in:
parent
356e032e1a
commit
d25a4f413d
4
parse.y
4
parse.y
@ -4071,6 +4071,10 @@ p_kwargs : p_kwarg ',' p_kwrest
|
|||||||
{
|
{
|
||||||
$$ = new_hash_pattern_tail(p, new_unique_key_hash(p, $1, &@$), 0, &@$);
|
$$ = new_hash_pattern_tail(p, new_unique_key_hash(p, $1, &@$), 0, &@$);
|
||||||
}
|
}
|
||||||
|
| p_kwarg ','
|
||||||
|
{
|
||||||
|
$$ = new_hash_pattern_tail(p, new_unique_key_hash(p, $1, &@$), 0, &@$);
|
||||||
|
}
|
||||||
| p_kwrest
|
| p_kwrest
|
||||||
{
|
{
|
||||||
$$ = new_hash_pattern_tail(p, new_hash(p, Qnone, &@$), $1, &@$);
|
$$ = new_hash_pattern_tail(p, new_hash(p, Qnone, &@$), $1, &@$);
|
||||||
|
@ -1042,6 +1042,15 @@ END
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert_block do
|
||||||
|
case {a: 0, b: 1}
|
||||||
|
in {a: 1,}
|
||||||
|
false
|
||||||
|
in {a:,}
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
assert_syntax_error(%q{
|
assert_syntax_error(%q{
|
||||||
case _
|
case _
|
||||||
in "a-b":
|
in "a-b":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user