private function getLineNumber(): int
    {
        $pos = $this->stringIterator->key();
        $this->stringIterator->rewind();
        $lineNo = 1;

        while ($this->stringIterator->key() < $pos) {
            if ($this->stringIterator->is(Tokens::LINE_FEED)) {
                ++$lineNo;
            }
            $this->stringIterator->next();
        }

        return $lineNo;
    }