'This parses the lines of a batchfile according to the following
rules:
1) # at the beginning of a line marks the end of the command before
it. It is also a comment and any number of # can exist on
subsequent lines (but not inside comments).
2) #INSERT at the beginning of a line imports another
batch-cmd file file and pastes it into the batch file as if
it was written there.
3) Commands are placed alone at the beginning of a line and their
arguments are considered to be everything following (on any
number of lines) until the next comment line beginning with #.
4) Newlines are ignored in command definitions
5) A completely empty line in a command line definition is condered
a newline (so two empty lines is a paragraph).
6) Excess spaces and indents inside arguments are stripped.'

def parse_file(self, pythonpath):

    text = ''.join(read_batchfile(pythonpath, file_ending='.ev'))
    def replace_insert(match):
        'Map    replace    entries'
        return '\n#'.join(self.parse_file(match.group(1)))
    text = _RE_INSERT.sub(replace_insert, text)
    commands = _RE_CMD_SPLIT.split(text)
    commands = [c.strip('\r\n') for c in commands]
    commands = [c for c in commands if c]
    return commands
