Add binary not operator to inline assembler operand parsing

This commit is contained in:
drmortalwombat 2024-06-04 09:07:50 +02:00
parent 41ba2e73f2
commit 46b52a57f7

View File

@ -10467,6 +10467,22 @@ Expression* Parser::ParseAssemblerBaseOperand(Declaration* pcasm, int pcoffset)
mErrors->Error(exp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Cannot negate expression");
break;
case TK_BINARY_NOT:
mScanner->NextToken();
exp = ParseAssemblerBaseOperand(pcasm, pcoffset);
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
{
dec = new Declaration(mScanner->mLocation, DT_CONST_INTEGER);
dec->mInteger = ~exp->mDecValue->mInteger;
dec->mBase = TheUnsignedIntTypeDeclaration;
exp = new Expression(mScanner->mLocation, EX_CONSTANT);
exp->mDecValue = dec;
exp->mDecType = dec->mBase;
}
else
mErrors->Error(exp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Cannot negate expression");
break;
case TK_MUL:
mScanner->NextToken();
exp = new Expression(mScanner->mLocation, EX_CONSTANT);