@param null                 $operator
@param AbstractBuilder|null $leftExpression
@param AbstractBuilder|null $rightExpression

@return BinaryOperator
162758
public function binary($operator = null, AbstractBuilder $leftExpression = null, AbstractBuilder $rightExpression = null)
    {
        return new BinaryOperator($operator, $leftExpression, $rightExpression);
    }
155059
public static function whereColumn($a, $operator, $b = null)
    {
        list($operator, $b) = static::prepareOperatorAndValue(
            $operator, $b, func_num_args() === 2
        );

        return new ColumnConstraint($a, $operator, $b);
    }
645286
protected function processTokenLogicalOperator($operator)
    {
        if (null === $this->scope->getNode()) {
            $this->addError('Logical operator must be preceded by a valid operation.', self::ERROR_CODE_LOGICAL_OPERATOR_PRECEDED);
        } else {
            if (self::LOGICAL_OR === $operator) {
                if (null !== $this->scope->getLastOrNode()) {
                    /*
                     * If a `or` node was already registered, we create a new
                     * boolean node to join the two nodes.
                     */
                    $node = new BooleanNode($this->scope->getLastOrNode(), $this->scope->getNode(), $operator);
                    $this->scope->setNode($node);
                }

                $this->scope->setLastOrNode($this->scope->getNode());
            } else {
                $this->scope
                    ->setCurrentLeftNode($this->scope->getNode())
                    ->deleteNode();
            }

            $this->scope
                ->setCurrentOperator($operator)
                ->shiftExpression();
        }
    }
1180374
protected function numericFactors($leftOperand, $rightOperand)
    {
        if ($this->isNumeric($rightOperand) && $rightOperand->getValue() == 0) {
            throw new DivisionByZeroException();
        }
        if ($this->isNumeric($rightOperand) && $rightOperand->getValue() == 1)
        {
            return $leftOperand;
        }
        if ($this->isNumeric($leftOperand) && $leftOperand->getValue() == 0)
        {
            return new IntegerNode(0);
        }

        if (!$this->isNumeric($leftOperand) || !$this->isNumeric($rightOperand)) {
            return null;
        }
        $type = $this->resultingType($leftOperand, $rightOperand);

        switch($type) {
            case Node::NumericFloat:
            return new NumberNode($leftOperand->getValue() / $rightOperand->getValue());

            case Node::NumericRational:
            case Node::NumericInteger:
            $p = $leftOperand->getNumerator() * $rightOperand->getDenominator();
            $q = $leftOperand->getDenominator() * $rightOperand->getNumerator();
            return new RationalNode($p, $q);
        }

        return null;
    }
1056895
private function operator(string $operator, $expression) : self
    {
        if ($this->currentField) {
            $this->expr[$this->currentField][$operator] = $this->ensureArray($expression);
        } else {
            $this->expr[$operator] = $this->ensureArray($expression);
        }

        return $this;
    }
370584
public function setOperator($operator)
    {
        if (! array_key_exists($operator, $this->sqlOperators)) {
            throw new FilterOperatorException("Operator [$operator] not found");
        }

        $this->operator = $operator;

        return $this;
    }
170466
public function onArithmeticExpression($expressionType, $left, $right) {
        switch ($expressionType) {
            case ExpressionType::MULTIPLY:
                return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
                break;
            case ExpressionType::DIVIDE:
                return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right);
                break;
            case ExpressionType::MODULO:
                return $this->_prepareBinaryExpression(self::MODULO, $left, $right);
                break;
            case ExpressionType::ADD:
                return $this->_prepareBinaryExpression(self::ADD, $left, $right);
                break;
            case ExpressionType::SUBTRACT:
                return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right);
                break;
            default:
                throw new \InvalidArgumentException('onArithmeticExpression');
        }
    }
1207699
public function setMainOperator($operator)
    {
        switch ($operator) {
            case self::OPERATOR_AND :
                $this->mainOperator = self::OPERATOR_AND;
                break;
            case self::OPERATOR_OR :
                $this->mainOperator = self::OPERATOR_OR;
                break;
            default :
                throw new \InvalidArgumentException(__CLASS__ . '::' . __FUNCTION__ . '() First argument should be ' . __CLASS__ . '::OPERATOR_AND or ' . __CLASS__ . '::OPERATOR_OR constant');
                break;
        }
        $this->rootOperation->setOperator($this->mainOperator);
    }
763566
public static function createOperator($token_type, $static_only = FALSE) {
    if (array_key_exists($token_type, self::$operators)) {
      list($assoc, $precedence, $static, $binary_class_name, $unary_class_name) = self::$operators[$token_type];
      if ($static_only && !$static) {
        return NULL;
      }
      $operator = new Operator();
      $operator->type = $token_type;
      $operator->associativity = $assoc;
      $operator->precedence = $precedence;
      $operator->hasBinaryMode = $binary_class_name !== NULL;
      $operator->hasUnaryMode = $unary_class_name !== NULL;
      $operator->binaryClassName = $binary_class_name;
      $operator->unaryClassName = $unary_class_name;
      return $operator;
    }
    return NULL;
  }
181940
public ExpressionBuilder operator(Operator operator) {
        this.checkOperatorSymbol(operator);
        this.userOperators.put(operator.getSymbol(), operator);
        return this;
    }
765089
private function numericExponent($leftOperand, $rightOperand)
    {
        // 0^0 throws an exception
        if ($this->isNumeric($leftOperand) && $this->isNumeric($rightOperand)) {
            if ($leftOperand->getValue() == 0 && $rightOperand->getValue() == 0)
            throw new DivisionByZeroException();
        }

        // x^0 = 1
        if ($rightOperand->getValue() == 0) return new IntegerNode(1);
        // x^1 = x
        if ($rightOperand->getValue() == 1) return $leftOperand;

        if (!$this->isNumeric($leftOperand) || !$this->isNumeric($rightOperand)) {
            return null;
        }
        $type = $this->resultingType($leftOperand, $rightOperand);

        // Compute x^y if both are numbers.
        switch($type) {
            case Node::NumericFloat:
            return new NumberNode(pow($leftOperand->getValue(), $rightOperand->getValue()));

            case Node::NumericInteger:
            if ($rightOperand->getValue() > 0)
            {
                return new IntegerNode(pow($leftOperand->getValue(), $rightOperand->getValue()));
            }
        }

        // No simplification found
        return null;
    }
827718
public static Or or(Expression<Boolean> left, Expression<Boolean> right) {
        return new Or(left, right);
    }
777892
private Expression joinOperations(Expression result, String operation, Expression next) {
        if (!(result instanceof Operation)) {
            return new Operation(operation, result, next);
        }
        Operation farRight = (Operation) result;
        while (farRight.getRight() instanceof Operation) {
            farRight = (Operation) farRight.getRight();
        }
        if (!farRight.isProtect() && ("+".equals(farRight.getOperation()) || "-".equals(farRight.getOperation()))) {
            farRight.setRight(new Operation(operation, farRight.getRight(), next));
            return result;
        }

        return new Operation(operation, result, next);
    }
1006438
public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) {
	return new OpDecision(left, right, operation);
    }
640681
public static ExpressionArithmeticOp add(Expression left, Expression right) {
		return new ExpressionArithmeticOp(ArithmeticOperation.ADD, left, right);
	}
983261
private FieldTextBuilder binaryOp(final String operator, final FieldTextBuilder fieldText) {
        // Special case when we're empty
        if(componentCount == 0) {
            // Just copy the argument
            fieldTextString.append(fieldText.fieldTextString);
            lastOperator = fieldText.lastOperator;
            not = fieldText.not;
            componentCount = fieldText.componentCount;
        } else {
            // Add the NOTs, parentheses and operator
            addOperator(operator);

            if(fieldText.lastOperator == null || fieldText.lastOperator.equals(operator) || fieldText.not) {
                fieldTextString.append(fieldText.toString());
            } else {
                fieldTextString.append('(').append(fieldText.toString()).append(')');
            }

            componentCount += fieldText.size();
            not = false;
        }

        return this;
    }
117657
public static function greaterThanOrEqual(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::GREATER_THAN_OR_EQUAL, $right);
    }