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;
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 ("("))
{
@ -6754,7 +6790,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope,
case ev_string:
case ev_vector:
case ev_entity:
case ev_field:
case ev_field:
case ev_pointer:
case ev_integer:
if (*name)