'Marking occurrences of the currently selected word'

def __mark_occurrences(self):

    self.__clear_occurrences()
    if (not self.supported_language):
        return
    text = self.get_current_word()
    if (text is None):
        return
    if (self.has_selected_text() and (self.get_selected_text() != text)):
        return
    if (self.is_python_like() and (sourcecode.is_keyword(to_text_string(text)) or (to_text_string(text) == 'self'))):
        return
    cursor = self.__find_first(text)
    self.occurrences = []
    while cursor:
        self.occurrences.append(cursor.blockNumber())
        self.__highlight_selection('occurrences', cursor, background_color=self.occurrence_color)
        cursor = self.__find_next(text, cursor)
    self.update_extra_selections()
    if ((len(self.occurrences) > 1) and (self.occurrences[(-1)] == 0)):
        self.occurrences.pop((-1))
    self.scrollflagarea.update()
