fix: correct number scan

i used peek_double instead of peek lol
This commit is contained in:
Seymur Bagirov 2024-11-19 06:25:22 +04:00
parent 02eb6bbc26
commit 2bac50ecba

View File

@ -187,14 +187,14 @@ impl Scanner {
if self.peek().is_some_and(|x| x == '.') && matches!(self.peek_double(), Some('0'..='9')) { if self.peek().is_some_and(|x| x == '.') && matches!(self.peek_double(), Some('0'..='9')) {
self.advance(); self.advance();
while matches!(self.peek_double(), Some('0'..='9')) { while matches!(self.peek(), Some('0'..='9')) {
self.advance(); self.advance();
} }
} }
let number: f64 = self let number: f64 = self
.source .source
.slice(self.start..=self.current) .slice(self.start..self.current)
.parse() .parse()
.expect("There shouldn't be any errors. Please check"); .expect("There shouldn't be any errors. Please check");