diff --git a/src/schala_lang/parsing.rs b/src/schala_lang/parsing.rs index 1ca16c4..3516067 100644 --- a/src/schala_lang/parsing.rs +++ b/src/schala_lang/parsing.rs @@ -25,7 +25,6 @@ pub enum TokenType { Identifier(Rc), Keyword(Kw), - EOF, Error(String), } @@ -287,8 +286,12 @@ impl Parser { Parser { tokens: input.into_iter().peekable() } } - fn peek(&mut self) -> TokenType { - self.tokens.peek().map(|ref t| { t.token_type.clone() }).unwrap_or(TokenType::EOF) + fn peek(&mut self) -> Option { + self.tokens.peek().map(|ref t| { t.token_type.clone() }) + } + + fn next(&mut self) -> Option { + self.tokens.next().map(|ref t| { t.token_type.clone() }) } fn program(&mut self) -> ParseResult {