Preprocessor: fixed 8.0E+007 in macros

This commit is contained in:
Daniel Marjamäki 2014-01-08 18:05:14 +01:00
parent 7c4a7ac3d5
commit 644004573b
2 changed files with 10 additions and 1 deletions

View File

@ -3161,6 +3161,11 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
i++;
if (i<macrocode.size() && std::isdigit(macrocode[i]))
i++;
if (i+1U < macrocode.size() &&
(macrocode[i] == 'e' || macrocode[i] == 'E') &&
(macrocode[i+1] == '+' || macrocode[i+1] == '-')) {
i+=2;
}
}
} else if (std::isalnum(macrocode[i]) || macrocode[i] == '_') {
if ((i > 0U) &&
@ -3183,7 +3188,7 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
if (i+2U < macrocode.size() &&
std::isdigit(macrocode[i]) &&
macrocode[i+1] == '.' &&
std::isalnum(macrocode[i+2])) {
std::isalpha(macrocode[i+2])) {
i += 2U;
if (i+2U < macrocode.size() &&
(macrocode[i+0] == 'e' || macrocode[i+0] == 'E') &&

View File

@ -2010,6 +2010,10 @@ private:
const char filedata7[] = "#define A (1.)\n"
"a=A;";
ASSERT_EQUALS("\na=$($1.);", OurPreprocessor::expandMacros(filedata7));
const char filedata8[] = "#define A (8.0E+007)\n"
"a=A;";
ASSERT_EQUALS("\na=$($8.0E+007);", OurPreprocessor::expandMacros(filedata8));
}
void macroInMacro1() {