Skip to content

Commit 5c70631

Browse files
committed
Take only numbers after .
Take only numbers not `_` after `.` Fixes #1498
1 parent 161f1d4 commit 5c70631

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

parser/src/lexer.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,12 @@ where
357357
if self.chr0 == Some('.') || self.at_exponent() {
358358
// Take '.':
359359
if self.chr0 == Some('.') {
360+
if self.chr1 == Some('_') {
361+
return Err(LexicalError {
362+
error: LexicalErrorType::OtherError("Invalid Syntax".to_string()),
363+
location: self.get_pos(),
364+
});
365+
}
360366
value_text.push(self.next_char().unwrap());
361367
value_text.push_str(&self.radix_run(10));
362368
}
@@ -416,6 +422,7 @@ where
416422
/// like this: '1_2_3_4' == '1234'
417423
fn radix_run(&mut self, radix: u32) -> String {
418424
let mut value_text = String::new();
425+
419426
loop {
420427
if let Some(c) = self.take_number(radix) {
421428
value_text.push(c);

0 commit comments

Comments
 (0)