protected function filterIgnoredSpaces(array $parts)
    {
        $partsFiltered = array_values(array_filter($parts));
        $retParts = [];
        $spacePart = null;
        $count = count($partsFiltered);
        for ($i = 0; $i < $count; ++$i) {
            $part = $partsFiltered[$i];
            if ($this->isSpaceToken($part)) {
                $spacePart = $part;
                continue;
            }
            $this->addSpaces($partsFiltered, $retParts, $i, $spacePart);
            $retParts[] = $part;
        }
        // ignore trailing spaces
        return $retParts;
    }