Skip to content

Commit 48140bb

Browse files
committed
Lexer: Fix lexing of floats written in scientific notation
1 parent 9ff7c81 commit 48140bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lexer/Lexer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ std::optional<size_t> Lexer::exp_float_number(size_t n) const
379379
// [0-9](?:_?[0-9])*)
380380
if (!(peek(n) >= '0' && peek(n) <= '9')) { return {}; }
381381
n++;
382+
if (peek(n) == '.') { n++; }
382383
auto result = parse_digits(n, [](const char c) { return std::isdigit(c); });
383384
if (result) { return exp_number(*result); }
384385
return {};
@@ -413,9 +414,9 @@ std::optional<size_t> Lexer::imag_number(size_t n) const
413414

414415
std::optional<size_t> Lexer::float_number(size_t n) const
415416
{
416-
if (auto end = point_float_number(n)) {
417+
if (auto end = exp_float_number(n)) {
417418
return *end;
418-
} else if (auto end = exp_float_number(n)) {
419+
} else if (auto end = point_float_number(n)) {
419420
return *end;
420421
} else {
421422
return {};

0 commit comments

Comments
 (0)