1
0
Fork 0

Merge pull request #3292 from foralost/3134_Highlight_mode_NOP

#3134: Avoiding having space in MnemonicNop instruction
This commit is contained in:
Duncan Ogilvie 2023-12-21 21:31:23 +01:00 committed by GitHub
commit 62129b426e
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 8 deletions

View File

@ -351,21 +351,31 @@ 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();
mInst.tokens.push_back(SingleToken(mIsNop ? TokenType::MnemonicNop : type, text, value));
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)