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();
        }
    }