fix stuck parser

This commit is contained in:
Aleksey Kladov 2018-09-08 10:13:32 +03:00
parent 44334f6f56
commit bd3a26493f
7 changed files with 719 additions and 2 deletions

View file

@ -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)