Misc tiny cleanup bits in the lexer

This commit is contained in:
Eryn Wells 2017-01-07 19:31:22 -08:00
parent 2a680d07c7
commit 5f4b96e4e2

View file

@ -526,7 +526,7 @@ impl Iterator for Lexer {
}
let mut token: Option<Token> = None;
println!("Lexing '{}'", &self.input[self.begin ..]);
while token.is_none() {
loop {
let c = match self.input.char_at(self.forward) {
Some(c) => c,
None => '\0',
@ -605,12 +605,9 @@ mod tests {
}
#[test]
fn finds_characters_newline() {
fn finds_named_characters() {
check_single_token("#\\newline", Token::Character('\n'));
}
#[test]
fn finds_characters_space() {
check_single_token("#\\null", Token::Character('\0'));
check_single_token("#\\space", Token::Character(' '));
}