engine/source/preprocessorlib/pp_expr.c
/**
 * @return the precedence from 1 (lowest) to 10 (highest) of a binary operator,
 *         or 0 if the operation is not binary
 */
@return the precedence from 1 (lowest) to 10 (highest) of a binary operator,
or 0 if the operation is not binary
@return the precedence from 1 ( lowest ) to 10 ( highest ) of a binary operator or 0 if the operation is not binary
int precedence(PP_TOKEN_TYPE op)
{
    switch(op)
    {
    case PP_TOKEN_MUL:
    case PP_TOKEN_DIV:
    case PP_TOKEN_MOD:
        return 10;
    case PP_TOKEN_ADD:
    case PP_TOKEN_SUB:
        return 9;
    case PP_TOKEN_LEFT_OP:
    case PP_TOKEN_RIGHT_OP:
        return 8;
    case PP_TOKEN_LT:
    case PP_TOKEN_GT:
    case PP_TOKEN_LE_OP:
    case PP_TOKEN_GE_OP:
        return 7;
    case PP_TOKEN_EQ_OP:
    case PP_TOKEN_NE_OP:
        return 6;
    case PP_TOKEN_BITWISE_AND:
        return 5;
    case PP_TOKEN_XOR:
        return 4;
    case PP_TOKEN_BITWISE_OR:
        return 3;
    case PP_TOKEN_AND_OP:
        return 2;
    case PP_TOKEN_OR_OP:
        return 1;
    default:
        return 0;
    }
}
int precedence ( PP_TOKEN_TYPE op ) { switch ( op ) { case PP_TOKEN_MUL : case PP_TOKEN_DIV : case PP_TOKEN_MOD : return 10 ; case PP_TOKEN_ADD : case PP_TOKEN_SUB : return 9 ; case PP_TOKEN_LEFT_OP : case PP_TOKEN_RIGHT_OP : return 8 ; case PP_TOKEN_LT : case PP_TOKEN_GT : case PP_TOKEN_LE_OP : case PP_TOKEN_GE_OP : return 7 ; case PP_TOKEN_EQ_OP : case PP_TOKEN_NE_OP : return 6 ; case PP_TOKEN_BITWISE_AND : return 5 ; case PP_TOKEN_XOR : return 4 ; case PP_TOKEN_BITWISE_OR : return 3 ; case PP_TOKEN_AND_OP : return 2 ; case PP_TOKEN_OR_OP : return 1 ; default : return 0 ; } }
@return the precedence from 1 (lowest) to 10 (highest) of a binary operator,
         or 0 if the operation is not binary
@return the precedence from 1 ( lowest ) to 10 ( highest ) of a binary operator or 0 if the operation is not binary