def _parse_free_uri_scheme(self):
        """Parse the URI scheme of a free (no brackets) external link."""
        valid = "abcdefghijklmnopqrstuvwxyz0123456789+.-"
        scheme = []
        try:
            # We have to backtrack through the textbuffer looking for our
            # scheme since it was just parsed as text:
            for chunk in reversed(self._textbuffer):
                for char in reversed(chunk):
                    if char.isspace() or char in self.MARKERS:
                        raise StopIteration()
                    if char not in valid:
                        raise BadRoute()
                    scheme.append(char)
        except StopIteration:
            pass
        scheme = "".join(reversed(scheme))
        slashes = self._read() == self._read(1) == "/"
        if not is_scheme(scheme, slashes):
            raise BadRoute()
        self._push(self._context | contexts.EXT_LINK_URI)
        self._emit_text(scheme)
        self._emit_text(":")
        if slashes:
            self._emit_text("//")
            self._head += 2
def _parse_free_uri_scheme ( self ) : valid = "abcdefghijklmnopqrstuvwxyz0123456789+.-" scheme = [ ] try : for chunk in reversed ( self . _textbuffer ) : for char in reversed ( chunk ) : if char . isspace ( ) or char in self . MARKERS : raise StopIteration ( ) if char not in valid : raise BadRoute ( ) scheme . append ( char ) except StopIteration : pass scheme = "" . join ( reversed ( scheme ) ) slashes = self . _read ( ) == self . _read ( 1 ) == "/" if not is_scheme ( scheme , slashes ) : raise BadRoute ( ) self . _push ( self . _context | contexts . EXT_LINK_URI ) self . _emit_text ( scheme ) self . _emit_text ( ":" ) if slashes : self . _emit_text ( "//" ) self . _head += 2
Parse the URI scheme of a free (no brackets) external link.