Tokenizer: simplify also __FILE__ together with __LINE__.

This commit is contained in:
Edoardo Prezioso 2012-12-01 00:37:10 +01:00
parent 47f1220367
commit 3d1d983251
2 changed files with 6 additions and 4 deletions

View File

@ -1625,7 +1625,7 @@ bool Tokenizer::tokenize(std::istream &code,
simplifySQL();
// replace __LINE__ macro with line number
simplifyLineMacro();
simplifyFileAndLineMacro();
// Concatenate double sharp: 'a ## b' -> 'ab'
concatenateDoubleSharp();
@ -2118,10 +2118,12 @@ void Tokenizer::concatenateDoubleSharp()
}
}
void Tokenizer::simplifyLineMacro()
void Tokenizer::simplifyFileAndLineMacro()
{
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (tok->str() == "__LINE__")
if (tok->str() == "__FILE__")
tok->str(list.file(tok));
else if (tok->str() == "__LINE__")
tok->str(MathLib::longToString(tok->linenr()));
}
}

View File

@ -425,7 +425,7 @@ public:
void concatenateDoubleSharp();
void simplifyLineMacro();
void simplifyFileAndLineMacro();
void simplifyNull();