Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/expressions/atom.rs')
| -rw-r--r-- | crates/parser/src/grammar/expressions/atom.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 3620a27c23..52dfb049aa 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -216,16 +216,19 @@ fn tuple_expr(p: &mut Parser<'_>) -> CompletedMarker { let mut saw_comma = false; let mut saw_expr = false; - // test_err tuple_expr_leading_comma - // fn foo() { - // (,); - // } - if p.eat(T![,]) { - p.error("expected expression"); - saw_comma = true; - } - while !p.at(EOF) && !p.at(T![')']) { + // test_err tuple_expr_leading_comma + // fn foo() { + // (,); + // (a, , b); + // } + if p.current() == T![,] { + p.error("expected expression"); + p.bump(T![,]); + saw_comma = true; + continue; + } + saw_expr = true; // test tuple_attrs |