Parser - Improved recovery after break/continue w/ unknown label

This commit is contained in:
Emmanuel BENOîT 2023-01-02 12:07:10 +01:00
parent ca76b3ab3f
commit c407fcd546

View file

@ -355,6 +355,7 @@ impl Parser {
let loop_name = if let TokenType::Identifier(_) = self.peek().token_type {
let name_token = self.advance().clone();
if !self.find_named_loop(&name_token.lexeme) {
self.expect(&[TokenType::Semicolon]);
return Err(ParserError::new(
&name_token,
&format!("no reachable loop named '{}'", name_token.lexeme),