Added + and - unary operators.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@551 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-12-03 16:08:43 +00:00
parent b025b87225
commit b628d14df0

View file

@ -3804,6 +3804,42 @@ QCC_def_t *QCC_PR_Term (void)
e2->type = e->type->aux_type; e2->type = e->type->aux_type;
return e2; return e2;
} }
else if (QCC_PR_Check ("-"))
{
e = QCC_PR_Expression (NOT_PRIORITY);
switch(e->type->aux_type->type)
{
case ev_float:
e2 = QCC_PR_Statement (&pr_opcodes[OP_SUB_F], QCC_MakeFloatDef(0), e, NULL);
break;
case ev_integer:
e2 = QCC_PR_Statement (&pr_opcodes[OP_SUB_I], QCC_MakeIntDef(0), e, NULL);
break;
default:
QCC_PR_ParseError (ERR_BADNOTTYPE, "type mismatch for -");
break;
}
return e2;
}
else if (QCC_PR_Check ("+"))
{
e = QCC_PR_Expression (NOT_PRIORITY);
switch(e->type->aux_type->type)
{
case ev_float:
e2 = QCC_PR_Statement (&pr_opcodes[OP_ADD_F], QCC_MakeFloatDef(0), e, NULL);
break;
case ev_integer:
e2 = QCC_PR_Statement (&pr_opcodes[OP_ADD_I], QCC_MakeIntDef(0), e, NULL);
break;
default:
QCC_PR_ParseError (ERR_BADNOTTYPE, "type mismatch for +");
break;
}
return e2;
}
if (QCC_PR_Check ("(")) if (QCC_PR_Check ("("))
{ {