def get_line_syntax_intervals(comment_text):
    """Return list containing interval/syntax name pairs.

    For the defintion of interval and syntax (category)
    name, check the docstring of the get_comment_syntax_map
    function in this module.
    """
    ### create list to gather todo intervals, that is,
    ### 2-tuples representing the boundaries of slices
    ### of the comment_text string which contain todo words
    ### (when they do)
    todo_intervals = []

    ### iterate over the todo words storing the intervals
    ### where they can be found in the comment_text string
    ### (if there are such words)

    for word in TODO_WORDS:

        ## store the length of the word
        length = len(word)

        ## store the index from where we should look
        ## for the word in the comment_text string
        start_search_index = 0

        ## now we repeat the block below as many times as
        ## there are substrings of the todo word in the
        ## comment_text string

        for _ in range(comment_text.count(word)):

            ## define the boundaries of the interval
            ## containing the todo word in the string

            # pick the first index where the todo substring
            # can be found in the comment_text searching
            # from the start search index on
            including_start = comment_text.index(word, start_search_index)

            # then calculate the end by adding the length
            # to it
            excluding_end = including_start + length

            ## now calculate the index of the characters
            ## before and after the substring;
            ##
            ## (note the index of the character after the
            ## substring is the same value as the end
            ## index of the substring; this is so because
            ## the "end" calculated above is an excluding
            ## end point, not making part of the substring
            ## interval, just being used to define the
            ## right boundary of the interval)

            index_char_before = including_start - 1
            index_char_after = excluding_end

            ## here we check whether the substring really
            ## represents a proper todo word or not: by
            ## checking whether both the character before
            ## and after the todo substring are both valid
            ## characters according to rules defined on a
            ## specific function;
            ##
            ## if the todo substring is indeed a valid todo
            ## word, its interval is stored

            if all(
                is_char_allowed(comment_text, index)
                for index in (index_char_before, index_char_after)
            ):

                todo_intervals.append((including_start, excluding_end))

            ## we then update the start search index, so
            ## the next search is performed from such index
            start_search_index = excluding_end

    ### now that we know which intervals contains todo words
    ### (if we did find substrings which really qualify as
    ### todo words), we do the opposite here: we define
    ### which intervals of the comment_text string contain
    ### normal text by removing the todo word intervals

    normal_intervals = get_remaining_intervals(
        all_indices=range(len(comment_text)), intervals_to_subtract=todo_intervals
    )

    ### now that we have the intervals for each kind of
    ### text, we pair the intervals with the corresponding
    ### color setting for them in new lists

    ## normal pairs;
    ##
    ## the try/except clause is needed for compatibility
    ## with Python 3.7+ (see PEP 479)

    try:
        normal_pairs = [(item, "normal") for item in normal_intervals]

    except RuntimeError:
        normal_pairs = []

    ## todo pairs

    todo_pairs = [(item, "todo_word") for item in todo_intervals]

    ### then we concatenate all the pairs together into a
    ### a new list then return it

    interval_name_pairs = normal_pairs + todo_pairs

    return interval_name_pairs
Return list containing interval/syntax name pairs.

    For the defintion of interval and syntax (category)
    name, check the docstring of the get_comment_syntax_map
    function in this module.
    
nodezator/syntaxman/syntaxes/comment.py