diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index 9739c91..7c1e999 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs @@ -94,6 +94,7 @@ impl Iterator for Lexer { ')' => Some(Token::RParen), '[' => Some(Token::LBrace), ']' => Some(Token::RBrace), + '0' => Some(Token::EOF), _ => None, } } diff --git a/src/main.rs b/src/main.rs index 291eb48..b392176 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,8 @@ mod tests { Token::Plus, Token::LParen, Token::RParen, + Token::LBrace, + Token::RBrace, Token::Comma, Token::Semicolon, Token::EOF, @@ -23,12 +25,11 @@ mod tests { let tokenized_output = Lexer::new(input).collect::>(); - println!("{:?}", tokenized_output); assert_eq!(expected.len(), tokenized_output.len()); + println!("{:?}", tokenized_output); for (exp, actual) in expected.into_iter().zip(tokenized_output) { assert_eq!(actual, exp); - println!("{:?} {:?}", actual, exp); } } }