improve lexing of numbers

This commit is contained in:
pantor committed 2021-11-17 12:13:22 +01:00
1 parent b41524f129
commit b2c0dddafe
3 files changed
+13 -2

No files matched your search

+1 -1
View File
@@ -1184,7 +1184,7 @@ class Lexer {
}
const char ch = m_in[pos];
// be very permissive in lexer (we'll catch errors when conversion happens)
if (!std::isdigit(ch) && ch != '.' && ch != 'e' && ch != 'E' && ch != '+' && ch != '-') {
if (!(std::isdigit(ch) || ch == '.' || ch == 'e' || ch == 'E' || (ch == '+' && (pos == 0 || m_in[pos-1] == 'e' || m_in[pos-1] == 'E')) || (ch == '-' && (pos == 0 || m_in[pos-1] == 'e' || m_in[pos-1] == 'E')))) {
break;
}
pos += 1;