import re


def first_clean_up(lines):
    """
    A function to remove line delimiters, comments, tabs, etc. from the
    .sas dictionary file.

    Parameters
    ----------
    lines    :   list of strings; the raw file

    """
    #Remove all tabs from the string
    for i in range(0, len(lines)):
        lines[i] = re.sub('\t', ' ', lines[i])
        lines[i] = re.sub('\r', '', lines[i])
        lines[i] = re.sub('\n', '', lines[i])

    #Remove all comments from the code
    start_comment = 0
    for i in range(0, len(lines)):
        if lines[i].find('/*') >= 0:
            start_comment = i
        elif lines[i].find('*/') >= 0:
            lines[start_comment] = lines[start_comment]\
                .replace('/*', '')
            lines[start_comment] = lines[start_comment]\
                .replace('*', '')
            lines[i] = lines[i].replace('*/', '')
            lines[i] = lines[i].replace('*', '')
            if i > start_comment + 1:
                lines[start_comment + 1:i] = ['' for x in
                                              range(start_comment+1, i)]
    for i in range(0, len(lines)):
        lines[i] = lines[i].replace('*', '')
    return lines