parse scientific notation

This commit is contained in:
Folkert 2021-02-26 16:09:17 +01:00
parent fb460ce984
commit 94fc5a1935
2 changed files with 26 additions and 0 deletions

View file

@ -118,6 +118,22 @@ fn chomp_number<'a>(mut bytes: &'a [u8]) -> (bool, usize) {
is_float = true;
bytes = &bytes[1..];
}
b'e' => {
// maybe scientific notation?
match bytes.get(1) {
Some(b'-') => {
is_float = true;
bytes = &bytes[2..];
}
Some(c) if (*c as char).is_ascii_digit() => {
is_float = true;
bytes = &bytes[2..];
}
_ => {
bytes = &bytes[1..];
}
}
}
b'_' => {
// skip
bytes = &bytes[1..];