mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
fix stuck parser
This commit is contained in:
parent
44334f6f56
commit
bd3a26493f
7 changed files with 719 additions and 2 deletions
|
@ -140,9 +140,14 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
|
|||
}
|
||||
while !p.at(EOF) && !p.at(R_BRACK) {
|
||||
p.expect(COMMA);
|
||||
if !p.at(R_BRACK) {
|
||||
expr(p);
|
||||
if p.at(R_BRACK) {
|
||||
break;
|
||||
}
|
||||
if !EXPR_FIRST.contains(p.current()) {
|
||||
p.error("expected expression");
|
||||
break;
|
||||
}
|
||||
expr(p);
|
||||
}
|
||||
p.expect(R_BRACK);
|
||||
m.complete(p, ARRAY_EXPR)
|
||||
|
|
|
@ -376,6 +376,10 @@ fn arg_list(p: &mut Parser) {
|
|||
let m = p.start();
|
||||
p.bump();
|
||||
while !p.at(R_PAREN) && !p.at(EOF) {
|
||||
if !EXPR_FIRST.contains(p.current()) {
|
||||
p.error("expected expression");
|
||||
break;
|
||||
}
|
||||
expr(p);
|
||||
if !p.at(R_PAREN) && !p.expect(COMMA) {
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue