protected function parsePoints(string $native, int &$pos, int $count, bool $allowSquare = false): array
    {
        $hasDelimiters = $squareDelimiter = false;

        $char = $this->nextChar($native, $pos);
        if ('[' === $char) {
            if (!$allowSquare) {
                throw TypeConversionException::parsingFailed($this, "'(' or numeric value", $native, $pos);
            }
            $hasDelimiters = $squareDelimiter = true;
            $pos++;

        } elseif ('(' === $char) {
            $nextPos = $pos + 1;
            if ($pos === strrpos($native, '(')
                || '(' === $this->nextChar($native, $nextPos)
            ) {
                $hasDelimiters = true;
                $pos++;
            }
        }

        $points = [];
        for ($i = 0; $i < $count; $i++) {
            if ($i > 0) {
                $this->expectChar($native, $pos, ',');
            }
            $points[] = $this->point->parseInput($native, $pos);
        }

        if ($hasDelimiters) {
            $this->expectChar($native, $pos, $squareDelimiter ? ']' : ')');
        }

        if ($allowSquare) {
            $points['open'] = $squareDelimiter;
        }

        return $points;
    }