public function getLocation($position)
    {
        $pattern = '/\r\n|[\n\r\u2028\u2029]/g';
        $subject = mb_substr($this->body, 0, $position, 'UTF-8');

        preg_match_all($pattern, $subject, $matches, PREG_OFFSET_CAPTURE);
        $location = array_reduce($matches[0], function ($carry, $match) use ($position) {
            return [
                $carry[0] + 1,
                $position + 1 - ($match[1] + mb_strlen($match[0], 'UTF-8'))
            ];
        }, [1, $position + 1]);

        return new SourceLocation($location[0], $location[1]);
    }