expect semicolons wherever required

This commit is contained in:
SparkyPotato
2023-01-31 21:38:20 +05:30
committed by Teodor Tanasoaia
parent e6bd2e9071
commit 231af68386

View File

@@ -1661,14 +1661,17 @@ impl Parser {
let span = span.until(&peeked_span);
return Err(Error::InvalidBreakIf(span));
}
lexer.expect(Token::Separator(';'))?;
ast::StatementKind::Break
}
"continue" => {
let _ = lexer.next();
lexer.expect(Token::Separator(';'))?;
ast::StatementKind::Continue
}
"discard" => {
let _ = lexer.next();
lexer.expect(Token::Separator(';'))?;
ast::StatementKind::Kill
}
// assignment or a function call
@@ -1685,6 +1688,7 @@ impl Parser {
}
_ => {
self.assignment_statement(lexer, ctx.reborrow(), block)?;
lexer.expect(Token::Separator(';'))?;
self.pop_rule_span(lexer);
}
}