From 31391b872e15833523b1dae7d7e7e06b25b0a089 Mon Sep 17 00:00:00 2001 From: Simon Eriksson Date: Sun, 22 Sep 2019 12:31:39 +0200 Subject: [PATCH] Avoid tokenizing literals with e followed by +/- as hexadecimals --- Parser/Tokenizer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Parser/Tokenizer.cpp b/Parser/Tokenizer.cpp index f6a58c07..90aaf4db 100644 --- a/Parser/Tokenizer.cpp +++ b/Parser/Tokenizer.cpp @@ -538,6 +538,7 @@ Token FileTokenizer::loadToken() bool isValid = true; bool foundPoint = false; bool foundExp = false; + bool foundExpSign = false; bool isHex = start+1 < currentLine.size() && currentLine[start] == '0' && towlower(currentLine[start+1]) == 'x'; while (end < currentLine.size() && (iswalnum(currentLine[end]) || currentLine[end] == '.')) @@ -547,7 +548,7 @@ Token FileTokenizer::loadToken() if (isHex || foundExp || foundPoint) isValid = false; foundPoint = true; - } else if (towlower(currentLine[end]) == 'h') { + } else if (towlower(currentLine[end]) == 'h' && !foundExpSign) { isHex = true; } else if (towlower(currentLine[end]) == 'e' && !isHex) { @@ -558,6 +559,7 @@ Token FileTokenizer::loadToken() end++; if (end+1 >= currentLine.size() || !iswalnum(currentLine[end+1])) isValid = false; + foundExpSign = true; } foundExp = true; }