private function parseValue($value, bool $isLeft, bool $isOpen)
    {
        if ($this->isInt($value)) {
            return new Integer((int)$value, $isLeft, $isOpen);
        }

        if ($this->isInfinity($value)) {
            $value = '-INF' === $value ? -\INF : \INF;
            return new Infinity($value, $isLeft, $isOpen);
        }

        if ($this->isFloat($value)) {
            return new Real((float)$value, $isLeft, $isOpen);
        }

        if ($this->isDate($value)) {
            $value = \DateTimeImmutable::createFromFormat('U', (string)\strtotime($value));
            $value = $value->setTimezone(new \DateTimeZone(\date_default_timezone_get()));
            return new DateTime($value, $isLeft, $isOpen);
        }

        throw new \InvalidArgumentException('Unexpected $value type');
    }