diff options
Diffstat (limited to 'compiler/src/lexer/mod.rs')
| -rw-r--r-- | compiler/src/lexer/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/src/lexer/mod.rs b/compiler/src/lexer/mod.rs index 464d88e..f3c8b76 100644 --- a/compiler/src/lexer/mod.rs +++ b/compiler/src/lexer/mod.rs | |||
| @@ -146,8 +146,12 @@ impl<'a> Iterator for Lexer<'a> { | |||
| 146 | 146 | ||
| 147 | // Number | 147 | // Number |
| 148 | ch if ch.is_ascii_digit() | 148 | ch if ch.is_ascii_digit() |
| 149 | || matches!(ch, '+' | '-' | '.') | 149 | || ch == '.' && self.peek_nth(1).is_some_and(|ch| ch.is_ascii_digit()) |
| 150 | && self.peek_nth(1).is_some_and(|ch| ch.is_ascii_digit()) => | 150 | || matches!(ch, '+' | '-') |
| 151 | && self.peek_nth(1).is_some_and(|ch| ch.is_ascii_digit()) | ||
| 152 | || matches!(ch, '+' | '-') | ||
| 153 | && self.peek_nth(1).is_some_and(|ch| ch == '.') | ||
| 154 | && self.peek_nth(2).is_some_and(|ch| ch.is_ascii_digit()) => | ||
| 151 | { | 155 | { |
| 152 | Token::Number(self.next_atom()) | 156 | Token::Number(self.next_atom()) |
| 153 | } | 157 | } |
