'Handles pre-parsing
Editor commands are on the form
:cmd [li] [w] [txt]
Where all arguments are optional.
li  - line number (int), starting from 1. This could also
be a range given as <l>:<l>.
w   - word(s) (string), could be encased in quotes.
txt - extra text (string), could be encased in quotes.'

def parse(self):

    editor = self.caller.ndb._eveditor
    if (not editor):
        _load_editor(self.caller)
        editor = self.caller.ndb._eveditor
    self.editor = editor
    linebuffer = self.editor.get_buffer().split('\n')
    nlines = len(linebuffer)
    arglist = [part for part in _RE_GROUP.findall(self.args) if part]
    temp = []
    for arg in arglist:
        if arg.startswith('"'):
            arg.strip('"')
        elif arg.startswith("'"):
            arg.strip("'")
        temp.append(arg)
    arglist = temp
    words = self.args.split()
    cline = (nlines - 1)
    (lstart, lend) = (cline, (cline + 1))
    linerange = False
    if (arglist and (arglist[0].count(':') == 1)):
        (part1, part2) = arglist[0].split(':')
        if (part1 and part1.isdigit()):
            lstart = min((max(0, int(part1)) - 1), nlines)
            linerange = True
        if (part2 and part2.isdigit()):
            lend = (min((lstart + 1), int(part2)) + 1)
            linerange = True
    elif (arglist and arglist[0].isdigit()):
        lstart = min(max(0, (int(arglist[0]) - 1)), nlines)
        lend = (lstart + 1)
        linerange = True
    if linerange:
        arglist = arglist[1:]
    lstr = (('line    %i' % (lstart + 1)) if ((not linerange) or ((lstart + 1) == lend)) else ('lines    %i-%i' % ((lstart + 1), lend)))
    args = '    '.join(arglist)
    (arg1, arg2) = ('', '')
    if (len(arglist) > 1):
        (arg1, arg2) = (arglist[0], '    '.join(arglist[1:]))
    else:
        arg1 = '    '.join(arglist)
    self.linebuffer = linebuffer
    self.nlines = nlines
    self.arglist = arglist
    self.cline = cline
    self.lstart = lstart
    self.lend = lend
    self.linerange = linerange
    self.lstr = lstr
    self.words = words
    self.args = args
    self.arg1 = arg1
    self.arg2 = arg2
