def root(self, pattern, current):
        """Start parsing the pattern."""

        self.set_after_start()
        i = util.StringIter(pattern)
        iter(i)
        root_specified = False
        if self.win_drive_detect:
            m = RE_WIN_PATH.match(pattern)
            if m:
                drive = m.group(0).replace('\\\\', '\\')
                if drive.endswith('\\'):
                    slash = True
                drive = drive[:-1]
                current.append(re.escape(drive))
                if slash:
                    current.append(self.get_path_sep() + _ONE_OR_MORE)
                i.advance(m.end(0))
                self.consume_path_sep(i)
                root_specified = True
            elif pattern.startswith('\\\\'):
                root_specified = True
        elif not self.win_drive_detect and self.pathname and pattern.startswith('/'):
            root_specified = True

        if not root_specified and self.realpath:
            current.append(_NO_WIN_ROOT if self.win_drive_detect else _NO_ROOT)
            current.append('')

        for c in i:

            index = i.index
            if self.extend and c in EXT_TYPES and self.parse_extend(c, i, current, True):
                # Nothing to do
                pass
            elif c == '*':
                self._handle_star(i, current)
            elif c == '?':
                current.append(self._restrict_sequence() + _QMARK)
            elif c == '/':
                if self.pathname:
                    self.set_start_dir()
                    self.clean_up_inverse(current)
                    current.append(self.get_path_sep() + _ONE_OR_MORE)
                    self.consume_path_sep(i)
                else:
                    current.append(re.escape(c))
            elif c == '\\':
                index = i.index
                try:
                    value = self._references(i)
                    if self.dir_start:
                        self.clean_up_inverse(current)
                        self.consume_path_sep(i)
                    current.append(value)
                except StopIteration:
                    i.rewind(i.index - index)
                    current.append(re.escape(c))
            elif c == '[':
                index = i.index
                try:
                    current.append(self._sequence(i))
                except StopIteration:
                    i.rewind(i.index - index)
                    current.append(re.escape(c))
            else:
                current.append(re.escape(c))

            self.update_dir_state()

        self.clean_up_inverse(current)
        if self.pathname:
            current.append(_PATH_TRAIL % self.get_path_sep())
Start parsing the pattern.