Skip to content

Commit

Permalink
Expected main func left brace
Browse files Browse the repository at this point in the history
  • Loading branch information
octavonce committed Sep 10, 2023
1 parent 14c047a commit b3d481e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
}

Expand All @@ -169,6 +177,7 @@ pub enum CompilerErr {
ExpectedIdentifier(Position),
ExpectedLeftParanthesis(Position),
ExpectedColonCommaOrRightParanthesis(Position),
ExpectedLeftBrace(Position),
}

enum CompilerState {
Expand Down

0 comments on commit b3d481e

Please sign in to comment.