parse.c
static ParseTreeNode *MakeUnaryOpNode(ParseContext *c, int op, ParseTreeNode *expr)
{
    ParseTreeNode *node;
    ResolveVariableRef(c, expr);
    if (IsIntegerLit(expr)) {
        node = expr;
        switch (op) {
        case OP_NEG:
            node->u.integerLit.value = -expr->u.integerLit.value;
            break;
        case OP_NOT:
            node->u.integerLit.value = !expr->u.integerLit.value;
            break;
        case OP_BNOT:
            node->u.integerLit.value = ~expr->u.integerLit.value;
            break;
        }
    }
    else if (expr->type == &c->integerType) {
        node = NewParseTreeNode(c, NodeTypeUnaryOp);
        node->type = &c->integerType;
        node->u.unaryOp.op = op;
        node->u.unaryOp.expr = expr;
    }
    else {
        ParseError(c, "Expecting a numeric expression");
        node = NULL; /* not reached */
    }
    return node;
}
/* MakeUnaryOpNode - allocate a unary operation parse tree node */
allocate a unary operation parse tree node
allocate a unary operation parse tree node
static ParseTreeNode *MakeUnaryOpNode(ParseContext *c, int op, ParseTreeNode *expr)
{
    ParseTreeNode *node;
    ResolveVariableRef(c, expr);
    if (IsIntegerLit(expr)) {
        node = expr;
        switch (op) {
        case OP_NEG:
            node->u.integerLit.value = -expr->u.integerLit.value;
            break;
        case OP_NOT:
            node->u.integerLit.value = !expr->u.integerLit.value;
            break;
        case OP_BNOT:
            node->u.integerLit.value = ~expr->u.integerLit.value;
            break;
        }
    }
    else if (expr->type == &c->integerType) {
        node = NewParseTreeNode(c, NodeTypeUnaryOp);
        node->type = &c->integerType;
        node->u.unaryOp.op = op;
        node->u.unaryOp.expr = expr;
    }
    else {
        ParseError(c, "Expecting a numeric expression");
        node = NULL; 
    }
    return node;
}
static ParseTreeNode * MakeUnaryOpNode ( ParseContext * c , int op , ParseTreeNode * expr ) { ParseTreeNode * node ; ResolveVariableRef ( c , expr ) ; if ( IsIntegerLit ( expr ) ) { node = expr ; switch ( op ) { case OP_NEG : node -> u . integerLit . value = - expr -> u . integerLit . value ; break ; case OP_NOT : node -> u . integerLit . value = ! expr -> u . integerLit . value ; break ; case OP_BNOT : node -> u . integerLit . value = ~ expr -> u . integerLit . value ; break ; } } else if ( expr -> type == & c -> integerType ) { node = NewParseTreeNode ( c , NodeTypeUnaryOp ) ; node -> type = & c -> integerType ; node -> u . unaryOp . op = op ; node -> u . unaryOp . expr = expr ; } else { ParseError ( c , " " ) ; node = NULL ; } return node ; }
MakeUnaryOpNode - allocate a unary operation parse tree node
MakeUnaryOpNode - allocate a unary operation parse tree node
/* not reached */