This parser is forgiving and allows leading whitespace.

def parse_loops_file(self, contents, ignore_whitespace = True, ignore_errors = False):
        '''This parser is forgiving and allows leading whitespace.'''
        for l in [l for l in contents.strip().split('\n') if l]:
            try:
                if ignore_whitespace:
                    l = l.strip()
                tokens = l.split()
                if len(tokens) < 3:
                    raise RosettaFileParsingException('Lines in a loops file must have at least three entries.')
                if len(tokens) < 4:
                    tokens.append(None)
                self.data.append(self.parse_loop_line(tokens))
            except:
                if ignore_errors:
                    continue
                else:
                    raise