From b3d481e01887c872f97d88c39c5ac39a7c8e1208 Mon Sep 17 00:00:00 2001 From: Octavian Oncescu Date: Sun, 10 Sep 2023 02:04:34 +0200 Subject: [PATCH] Expected main func left brace --- src/compiler.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler.rs b/src/compiler.rs index f83b8fc..b331d8b 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -152,6 +152,14 @@ impl Compiler { )); } + (&CompilerState::ExpectingMainFuncBrace, TokenKind::Symbol(Symbol::BraceLeft)) => { + self.state = CompilerState::ExpectingMainFuncBody; + } + + (&CompilerState::ExpectingMainFuncBrace, _) => { + return Err(CompilerErr::ExpectedLeftBrace(token.position.clone())); + } + _ => unimplemented!(), } @@ -169,6 +177,7 @@ pub enum CompilerErr { ExpectedIdentifier(Position), ExpectedLeftParanthesis(Position), ExpectedColonCommaOrRightParanthesis(Position), + ExpectedLeftBrace(Position), } enum CompilerState {