def join_extended_lines(lines):
    """Join together any lines which end in an escaped newline.

    This function modifies the given lines object in place.

    lines - List of list of Tagged objects, where each embedded list is a
    separate line in the input program.
    """
    i = 0
    while i < len(lines):
        if lines[i] and lines[i][-1].c == '\\':
            if i + 1 < len(lines):
                del lines[i][-1]
                lines[i] += lines[i + 1]
                del lines[i + 1]
                i -= 1
            else:
                del lines[i][-1]
        i += 1
