Added NULL, RBrace, LBrace tokens
This commit is contained in:
parent
c84e73756f
commit
561c4c6089
|
@ -94,6 +94,7 @@ impl Iterator for Lexer {
|
|||
')' => Some(Token::RParen),
|
||||
'[' => Some(Token::LBrace),
|
||||
']' => Some(Token::RBrace),
|
||||
'0' => Some(Token::EOF),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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::<Vec<Token>>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user