minor fixes
This commit is contained in:
parent
3db49aee71
commit
6e175053c1
|
@ -1026,8 +1026,13 @@ void Preprocessor::simplifyCondition(const std::map<std::string, std::string> &v
|
||||||
{
|
{
|
||||||
const std::map<std::string, std::string>::const_iterator it = variables.find(tok->str());
|
const std::map<std::string, std::string>::const_iterator it = variables.find(tok->str());
|
||||||
if (it != variables.end())
|
if (it != variables.end())
|
||||||
|
{
|
||||||
|
if (it->second.empty())
|
||||||
|
tok->deleteThis();
|
||||||
|
else
|
||||||
tok->str(it->second);
|
tok->str(it->second);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// simplify calculations..
|
// simplify calculations..
|
||||||
tokenizer.simplifyCalculations();
|
tokenizer.simplifyCalculations();
|
||||||
|
@ -1272,8 +1277,7 @@ std::string Preprocessor::getcode(const std::string &filedata, std::string cfg,
|
||||||
// We must not remove #file tags or line numbers
|
// We must not remove #file tags or line numbers
|
||||||
// are corrupted. File tags are removed by the tokenizer.
|
// are corrupted. File tags are removed by the tokenizer.
|
||||||
}
|
}
|
||||||
else if (!match ||
|
else if (!match || line.compare(0,1,"#") == 0)
|
||||||
line[0] == '#')
|
|
||||||
{
|
{
|
||||||
// Remove #if, #else, #pragma etc, leaving only
|
// Remove #if, #else, #pragma etc, leaving only
|
||||||
// #define, #undef, #file and #endfile. and also lines
|
// #define, #undef, #file and #endfile. and also lines
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Token::str(const std::string &s)
|
||||||
|
|
||||||
if (std::isdigit(_str[0]))
|
if (std::isdigit(_str[0]))
|
||||||
_isNumber = true;
|
_isNumber = true;
|
||||||
else if (_str.length() > 1 && _str[0] == '-' && std::isdigit(_str[0]))
|
else if (_str.length() > 1 && _str[0] == '-' && std::isdigit(_str[1]))
|
||||||
_isNumber = true;
|
_isNumber = true;
|
||||||
else
|
else
|
||||||
_isNumber = false;
|
_isNumber = false;
|
||||||
|
|
Loading…
Reference in New Issue