def __next__(self):
        """Retrieve the token at position pos."""
        if self._pos >= self._length:
            raise StopIteration

        remaining = self._content[self._pos:]
        for (rgx, func) in self._token_map:
            match = rgx.match(remaining)
            if match is not None:
                token = func(match.group(0), self._line)
                if token['type'] is TokenType.lbreak:
                    self._line += 1

                self._pos += match.end(0)
                return token

        raise LexError(self._line, self._content[self._pos])
def __next__ ( self ) : if self . _pos >= self . _length : raise StopIteration remaining = self . _content [ self . _pos : ] for ( rgx , func ) in self . _token_map : match = rgx . match ( remaining ) if match is not None : token = func ( match . group ( 0 ) , self . _line ) if token [ 'type' ] is TokenType . lbreak : self . _line += 1 self . _pos += match . end ( 0 ) return token raise LexError ( self . _line , self . _content [ self . _pos ] )
Retrieve the token at position pos.