expr : PLUS expr
            | MINUS expr
            | NOT expr
            | BOOLEAN_NOT expr
13070
def p_expr_unary_op(p):
    ''''''
    p[0] = ast.UnaryOp(p[1], p[2], lineno=p.lineno(1))
369944
def Or(*xs, simplify=True):
    
    xs = [Expression.box(x).node for x in xs]
    y = exprnode.or_(*xs)
    if simplify:
        y = y.simplify()
    return _expr(y)
179650
def p_new_expr_nobf(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = ast.NewExpr(p[2])
350273
def simplify(self):
        
        if self.iscanonical:
            return self

        expr = self.cancel()
        if not isinstance(expr, self.__class__):
            return expr.simplify()

        if expr.args[0] in (self.TRUE, self.FALSE,):
            return expr.args[0].dual

        expr = self.__class__(expr.args[0].simplify())
        expr.iscanonical = True
        return expr
21169
def _isnull(expr):
    

    if isinstance(expr, SequenceExpr):
        return IsNull(_input=expr, _data_type=types.boolean)
    elif isinstance(expr, Scalar):
        return IsNull(_input=expr, _value_type=types.boolean)
1228808
static public BooleanExpression NOT(BooleanExpression operand){
		BooleanExpression result = new BooleanExpression(OPERATOR_NOT);
		result.addOperand(operand);
		return result;
	}
974075
private Expression parseBooleanExpression(Expression expr) {
    if (tokens.positiveLookahead(AND)) {
      tokens.consume();
      expr = new And(expr, parseSemVerExpression());
    } else if (tokens.positiveLookahead(OR)) {
      tokens.consume();
      expr = new Or(expr, parseSemVerExpression());
    }
    return expr;
  }
485932
def p_multiplicative_expr(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = self.asttypes.BinOp(op=p[2], left=p[1], right=p[3])
            p[0].setpos(p, 2)
622224
private boolean validBooleanExpression(Node expr) {
    if (isBooleanOperation(expr)) {
      return validBooleanOperation(expr);
    }

    if (!isOperation(expr)) {
      warnInvalidExpression("boolean", expr);
      return false;
    }
    if (!isValidPredicate(getCallName(expr))) {
      warnInvalid("boolean predicate", expr);
      return false;
    }
    Keywords keyword = nameToKeyword(getCallName(expr));
    if (!checkParameterCount(expr, keyword)) {
      return false;
    }
    switch (keyword.kind) {
      case TYPE_PREDICATE:
        return validTypePredicate(expr, getCallParamCount(expr));
      case STRING_PREDICATE:
        return validStringPredicate(expr, getCallParamCount(expr));
      case TYPEVAR_PREDICATE:
        return validTypevarPredicate(expr, getCallParamCount(expr));
      default:
        throw new IllegalStateException("Invalid boolean expression");
    }
  }
192088
def p_expr_minus_expr(p):
    
    p[0] = make_binary(p.lineno(2), 'MINUS', p[1], p[3], lambda x, y: x - y)
283723
def expr(self):
        
        node = self.term()

        while self.token.nature in (Nature.PLUS, Nature.MINUS):
            token = self.token
            if token.nature == Nature.PLUS:
                self._process(Nature.PLUS)
            elif token.nature == Nature.MINUS:
                self._process(Nature.MINUS)
            else:
                self._error()

            node = BinaryOperation(left=node, op=token, right=self.term())

        return node
1009009
def logical_or_expr(self):
        
        node = self.logical_and_expr()

        while self.token.nature == Nature.OR:
            token = self.token
            self._process(Nature.OR)

            node = BinaryOperation(left=node, op=token, right=self.logical_and_expr())

        return node
1018081
def p_expr_shl_expr(p):
    
    if p[1] is None or p[3] is None:
        p[0] = None
        return

    if p[1].type_ in (TYPE.float_, TYPE.fixed):
        p[1] = make_typecast(TYPE.ulong, p[1], p.lineno(2))

    p[0] = make_binary(p.lineno(2), 'SHL', p[1],
                       make_typecast(TYPE.ubyte, p[3], p.lineno(2)),
                       lambda x, y: x << y)
1111491
def p_not_expression(tok):
        """"""
        if len(tok) == 3:
            tok[0] = UnaryOperationRule(tok[1], tok[2])
        else:
            tok[0] = tok[1]
317401
def Implies(p, q, simplify=True):
    
    p = Expression.box(p).node
    q = Expression.box(q).node
    y = exprnode.impl(p, q)
    if simplify:
        y = y.simplify()
    return _expr(y)
997056
def p_expr_BXOR_expr(p):
    
    p[0] = make_binary(p.lineno(2), 'BXOR', p[1], p[3], lambda x, y: x ^ y)
733724
def +(other)
      case other
      when LinExpr
        # Add the terms of two expressions
        # For now, this assumes variables are not duplicated
        LinExpr.new(@terms.merge(other.terms) { |_, c1, c2| c1 + c2 })
      when Variable
        # Add the variable to the expression
        self + other * 1.0
      else
        fail TypeError
      end
    end