Tokenizer: simplify also __FILE__ together with __LINE__.
This commit is contained in:
parent
47f1220367
commit
3d1d983251
|
@ -1625,7 +1625,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
simplifySQL();
|
simplifySQL();
|
||||||
|
|
||||||
// replace __LINE__ macro with line number
|
// replace __LINE__ macro with line number
|
||||||
simplifyLineMacro();
|
simplifyFileAndLineMacro();
|
||||||
|
|
||||||
// Concatenate double sharp: 'a ## b' -> 'ab'
|
// Concatenate double sharp: 'a ## b' -> 'ab'
|
||||||
concatenateDoubleSharp();
|
concatenateDoubleSharp();
|
||||||
|
@ -2118,10 +2118,12 @@ void Tokenizer::concatenateDoubleSharp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tokenizer::simplifyLineMacro()
|
void Tokenizer::simplifyFileAndLineMacro()
|
||||||
{
|
{
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
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()));
|
tok->str(MathLib::longToString(tok->linenr()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,7 @@ public:
|
||||||
|
|
||||||
void concatenateDoubleSharp();
|
void concatenateDoubleSharp();
|
||||||
|
|
||||||
void simplifyLineMacro();
|
void simplifyFileAndLineMacro();
|
||||||
|
|
||||||
void simplifyNull();
|
void simplifyNull();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue