public function parse($segment)
    {
        $generated = new PosGenerated();
        $source = new PosSource();
        $pos = new PosMap($generated, $source);
        try {
            $offsets = $this->encoder->decode($segment);
        } catch (VLQError $e) {
            throw new InvalidMappings('Invalid segment "'.$segment.'"', $e);
        }
        $count = count($offsets);
        if (!in_array($count, [1, 4, 5])) {
            throw new InvalidMappings('Invalid segment "'.$segment.'"');
        }
        $generated->line = $this->gLine;
        $this->gColumn += $offsets[0];
        $generated->column = $this->gColumn;
        if ($count >= 4) {
            $this->sFile += $offsets[1];
            $this->sLine += $offsets[2];
            $this->sColumn += $offsets[3];
            $source->fileIndex = $this->sFile;
            $source->line = $this->sLine;
            $source->column = $this->sColumn;
            if ($count === 5) {
                $this->sName += $offsets[4];
                $source->nameIndex = $this->sName;
            }
        }
        return $pos;
    }