Parser - Consume ';' after return statements

This commit is contained in:
Emmanuel BENOîT 2023-01-02 20:48:38 +01:00
parent 3dea0c9a45
commit 12b2855fb1

View file

@ -446,6 +446,7 @@ impl Parser {
} else { } else {
Some(self.parse_expression()?) Some(self.parse_expression()?)
}; };
self.consume(&TokenType::Semicolon, "';' expected after return statement")?;
Ok(ast::StmtNode::Return { Ok(ast::StmtNode::Return {
token: ret_token.clone(), token: ret_token.clone(),
value, value,