Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dandandan committed Feb 7, 2021
1 parent f09f302 commit 40c8737
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,17 @@ impl<'a> Tokenizer<'a> {
)
}
}
// numbers
// numbers and period
'0'..='9' | '.' => {
let mut s = peeking_take_while(chars, |ch| matches!(ch, '0'..='9'));
// match one period
if let Some('.') = chars.peek() {
s.push('.');
chars.next();
}
s += &peeking_take_while(chars, |ch| matches!(ch, '0'..='9'));

// No number -> Token::Period
if s == "." {
return Ok(Some(Token::Period));
}
Expand Down

0 comments on commit 40c8737

Please sign in to comment.