minor fixes

This commit is contained in:
Daniel Marjamäki 2009-11-28 11:47:44 +01:00
parent 3db49aee71
commit 6e175053c1
2 changed files with 8 additions and 4 deletions

8
lib/preprocessor.cpp Normal file → Executable file
View File

@ -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());
if (it != variables.end())
{
if (it->second.empty())
tok->deleteThis();
else
tok->str(it->second);
}
}
// simplify calculations..
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
// are corrupted. File tags are removed by the tokenizer.
}
else if (!match ||
line[0] == '#')
else if (!match || line.compare(0,1,"#") == 0)
{
// Remove #if, #else, #pragma etc, leaving only
// #define, #undef, #file and #endfile. and also lines

View File

@ -53,7 +53,7 @@ void Token::str(const std::string &s)
if (std::isdigit(_str[0]))
_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;
else
_isNumber = false;