kerncraft/iaca.py
def strip_unreferenced_labels(asm_lines):
    """Strip all labels, which are never referenced."""
    asm_stripped = []
    for line in asm_lines:
        if re.match(r'^\S+:', line):
            # Found label
            label = line[0:line.find(':')]
            # Search for references to current label
            if not any([re.match(r'^[^#]*\s' + re.escape(label) + '[\s,]?.*$', l) for l in asm_lines]):
                # Skip labels without seen reference
                line = ''
        asm_stripped.append(line)
    return asm_stripped
def strip_unreferenced_labels(asm_lines):
    asm_stripped = []
    for line in asm_lines:
        if re.match(r'^\S+:', line):
            # Found label
            label = line[0:line.find(':')]
            # Search for references to current label
            if not any([re.match(r'^[^#]*\s' + re.escape(label) + '[\s,]?.*$', l) for l in asm_lines]):
                # Skip labels without seen reference
                line = ''
        asm_stripped.append(line)
    return asm_stripped
def strip_unreferenced_labels ( asm_lines ) : asm_stripped = [ ] for line in asm_lines : if re . match ( r'^\S+:' , line ) : # Found label label = line [ 0 : line . find ( ':' ) ] # Search for references to current label if not any ( [ re . match ( r'^[^#]*\s' + re . escape ( label ) + '[\s,]?.*$' , l ) for l in asm_lines ] ) : # Skip labels without seen reference line = '' asm_stripped . append ( line ) return asm_stripped
Strip all labels, which are never referenced.
Strip all labels which are never referenced .