def lex_document(self, document):
        """
        Call the lexer and return a get_tokens_for_line function.
        """
        location = self.editor_buffer.location

        if location:
            if self.editor_buffer.in_file_explorer_mode:
                return PygmentsLexer(DirectoryListingLexer, sync_from_start=False).lex_document(document)

            return PygmentsLexer.from_filename(location, sync_from_start=False).lex_document(document)

        return SimpleLexer().lex_document(document)
def lex_document ( self , document ) : location = self . editor_buffer . location if location : if self . editor_buffer . in_file_explorer_mode : return PygmentsLexer ( DirectoryListingLexer , sync_from_start = False ) . lex_document ( document ) return PygmentsLexer . from_filename ( location , sync_from_start = False ) . lex_document ( document ) return SimpleLexer ( ) . lex_document ( document )
Call the lexer and return a get_tokens_for_line function.