Merge pull request #3292 from foralost/3134_Highlight_mode_NOP
#3134: Avoiding having space in MnemonicNop instruction
This commit is contained in:
commit
62129b426e
|
@ -351,22 +351,32 @@ bool ZydisTokenizer::TokenEquals(const SingleToken* a, const SingleToken* b, boo
|
|||
return tokenTextPoolEquals(a->text, b->text);
|
||||
}
|
||||
|
||||
|
||||
static bool tokenIsSpace(ZydisTokenizer::TokenType type)
|
||||
{
|
||||
return type == ZydisTokenizer::TokenType::Space || type == ZydisTokenizer::TokenType::ArgumentSpace || type == ZydisTokenizer::TokenType::MemoryOperatorSpace;
|
||||
}
|
||||
|
||||
void ZydisTokenizer::addToken(TokenType type, QString text, const TokenValue & value)
|
||||
{
|
||||
switch(type)
|
||||
bool isItSpaceType = tokenIsSpace(type);
|
||||
if(!isItSpaceType)
|
||||
{
|
||||
case TokenType::Space:
|
||||
case TokenType::ArgumentSpace:
|
||||
case TokenType::MemoryOperatorSpace:
|
||||
break;
|
||||
default:
|
||||
text = text.trimmed();
|
||||
break;
|
||||
}
|
||||
|
||||
if(mUppercase && !value.size)
|
||||
text = text.toUpper();
|
||||
|
||||
if(isItSpaceType)
|
||||
{
|
||||
mInst.tokens.push_back(SingleToken(type, text, value));
|
||||
}
|
||||
else
|
||||
{
|
||||
mInst.tokens.push_back(SingleToken(mIsNop ? TokenType::MnemonicNop : type, text, value));
|
||||
}
|
||||
}
|
||||
|
||||
void ZydisTokenizer::addToken(TokenType type, const QString & text)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue