Skip to content
Permalink
Browse files

Fix bug in exponential notation detection

  • Loading branch information...
sp1187 committed Sep 21, 2019
1 parent 7aa5cba commit 0292c939f3895779aadec1dd59b67403a2a30fa6
Showing with 8 additions and 6 deletions.
  1. +8 −6 Parser/Tokenizer.cpp
@@ -538,15 +538,19 @@ Token FileTokenizer::loadToken()
bool isValid = true;
bool foundPoint = false;
bool foundExp = false;
bool isHex = start+1 < currentLine.size() && currentLine[start] == '0' &&
(currentLine[start+1] == 'x' || currentLine[start+1] == 'X');

while (end < currentLine.size() && (iswalnum(currentLine[end]) || currentLine[end] == '.'))
{
if (currentLine[end] == '.')
{
if (foundExp || foundPoint)
if (isHex || foundExp || foundPoint)
isValid = false;
foundPoint = true;
}
else if (towlower(currentLine[end]) == 'e')
} else if (currentLine[end] == 'h' || currentLine[end] == 'H') {
isHex = true;
} else if (towlower(currentLine[end]) == 'e' && !isHex)
{
if (foundExp)
{
@@ -562,9 +566,7 @@ Token FileTokenizer::loadToken()
end++;
}

bool isFloat = foundPoint || (foundExp &&
towlower(currentLine[end-1]) != 'h' &&
!(towlower(currentLine[start]) == '0' && towlower(currentLine[start+1]) == 'x'));
bool isFloat = foundPoint || (foundExp && !isHex);

if (!isFloat)
{

0 comments on commit 0292c93

Please sign in to comment.
You can’t perform that action at this time.