Tokenizer: The tokenizer didn't handle '0x0E-7' correctly
This commit is contained in:
parent
5f712cc213
commit
83cdf734fe
|
@ -358,6 +358,7 @@ void Tokenizer::createTokens(std::istream &code)
|
|||
} else if (strchr("+-", ch) &&
|
||||
CurrentToken.length() > 0 &&
|
||||
std::isdigit(CurrentToken[0]) &&
|
||||
CurrentToken.compare(0,2,"0x") != 0 &&
|
||||
(CurrentToken[CurrentToken.length()-1] == 'e' ||
|
||||
CurrentToken[CurrentToken.length()-1] == 'E')) {
|
||||
// Don't separate doubles "4.2e+10"
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
TEST_CASE(tokenize18); // tokenize "(X&&Y)" into "( X && Y )" instead of "( X & & Y )"
|
||||
TEST_CASE(tokenize19); // #3006 (segmentation fault)
|
||||
TEST_CASE(tokenize20); // replace C99 _Bool => bool
|
||||
TEST_CASE(tokenize21); // tokenize 0x0E-7
|
||||
|
||||
// don't freak out when the syntax is wrong
|
||||
TEST_CASE(wrong_syntax);
|
||||
|
@ -601,6 +602,10 @@ private:
|
|||
ASSERT_EQUALS("bool a ; a = true ;", tokenizeAndStringify("_Bool a = true;"));
|
||||
}
|
||||
|
||||
void tokenize21() { // tokenize 0x0E-7
|
||||
ASSERT_EQUALS("14 - 7", tokenizeAndStringify("0x0E-7"));
|
||||
}
|
||||
|
||||
void wrong_syntax() {
|
||||
{
|
||||
errout.str("");
|
||||
|
|
Loading…
Reference in New Issue