[lexer] Add state for finding Dots at the beginning of input

This happens to be a valid token by itself and the beginning of a decimal number.
This commit is contained in:
Eryn Wells 2018-09-06 18:07:40 -07:00
parent 15e275513d
commit 34d612a832
6 changed files with 56 additions and 11 deletions

View file

@ -88,3 +88,10 @@ fn integers_in_alternative_bases() {
assert_eq!(lex.next(), Some(Ok(Lex::new(Token::Num(0b11001), "#b11001", 0, 5))));
assert_eq!(lex.next(), None);
}
#[test]
fn dot() {
let mut lex = Lexer::new(".".chars());
assert_eq!(lex.next(), Some(Ok(Lex::new(Token::Dot, ".", 0, 0))));
assert_eq!(lex.next(), None);
}