':type lines: list[str]'

def __init__(self, lines):

    self.lines = lines
    self.files = []
    self.action = self.process_start
    self.line_number = 0
    self.previous_line = None
    self.line = None
    self.file = None
    for self.line in self.lines:
        self.line_number += 1
        try:
            self.action()
        except Exception as ex:
            message = (textwrap.dedent('\n                                                                %s\n\n                                                                                    Line:    %d\n                                                                    Previous:    %s\n                                                                        Current:    %s\n                                                                %s\n                                                                ').strip() % (ex, self.line_number, (self.previous_line or ''), (self.line or ''), traceback.format_exc()))
            raise ApplicationError(message.strip())
        self.previous_line = self.line
    self.complete_file()
