def parse_list_cmd(proc, args, listsize=<NUM_LIT:10>):
text = proc.current_command[len(args[<NUM_LIT:0>])+<NUM_LIT:1>:].strip()<EOL>if text in frozenset(('<STR_LIT>', '<STR_LIT:.>', '<STR_LIT:+>', '<STR_LIT:->')):<EOL><INDENT>if text == '<STR_LIT:.>':<EOL><INDENT>location = resolve_location(proc, '<STR_LIT:.>')<EOL>return location.path, location.line_number, listsize<EOL><DEDENT>else:<EOL><INDENT>if proc.list_lineno is None:<EOL><INDENT>proc.errmsg("<STR_LIT>")<EOL>return INVALID_PARSE_LIST<EOL><DEDENT>filename = proc.list_filename<EOL>if text == '<STR_LIT:+>':<EOL><INDENT>first = max(<NUM_LIT:1>, proc.list_lineno + listsize)<EOL><DEDENT>elif text == '<STR_LIT:->':<EOL><INDENT>if proc.list_lineno == <NUM_LIT:1> + listsize:<EOL><INDENT>proc.errmsg("<STR_LIT>" % proc.list_filename)<EOL>return INVALID_PARSE_LIST<EOL><DEDENT>first = max(<NUM_LIT:1>, proc.list_lineno - (<NUM_LIT:2>*listsize) - <NUM_LIT:1>)<EOL><DEDENT>elif text == '<STR_LIT>':<EOL><INDENT>first = proc.list_lineno + <NUM_LIT:1><EOL><DEDENT><DEDENT>last = first + listsize - <NUM_LIT:1><EOL>return filename, first, last<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>list_range = build_range(text)<EOL><DEDENT>except LocationError as e:<EOL><INDENT>proc.errmsg("<STR_LIT>")<EOL>proc.errmsg(e.text)<EOL>proc.errmsg(e.text_cursor)<EOL>return INVALID_PARSE_LIST<EOL><DEDENT>except ScannerError as e:<EOL><INDENT>proc.errmsg("<STR_LIT>")<EOL>proc.errmsg(e.text)<EOL>proc.errmsg(e.text_cursor)<EOL>return INVALID_PARSE_LIST<EOL><DEDENT>if list_range.first is None:<EOL><INDENT>assert isinstance(list_range.last, Location)<EOL>location = resolve_location(proc, list_range.last)<EOL>if not location:<EOL><INDENT>return INVALID_PARSE_LIST<EOL><DEDENT>last     = location.line_number<EOL>first    = max(<NUM_LIT:1>, last - listsize)<EOL>return location.path, first, last<EOL><DEDENT>elif isinstance(list_range.first, int):<EOL><INDENT>first    = list_range.first<EOL>location = resolve_location(proc, list_range.last)<EOL>if not location:<EOL><INDENT>return INVALID_PARSE_LIST<EOL><DEDENT>filename = location.path<EOL>last     = location.line_number<EOL>if last < first:<EOL><INDENT>last = first + last<EOL><DEDENT>return location.path, first, last<EOL><DEDENT>else:<EOL><INDENT>assert isinstance(list_range.first, Location)<EOL>location = resolve_location(proc, list_range.first)<EOL>if not location:<EOL><INDENT>return INVALID_PARSE_LIST<EOL><DEDENT>first    = location.line_number<EOL>last     = list_range.last<EOL>if location.method:<EOL><INDENT>first -= listsize // <NUM_LIT:2><EOL><DEDENT>if isinstance(last, str):<EOL><INDENT>assert last[<NUM_LIT:0>] == '<STR_LIT:+>'<EOL>last = first + int(last[<NUM_LIT:1>:])<EOL><DEDENT>elif not last:<EOL><INDENT>last = first + listsize<EOL><DEDENT>elif last < first:<EOL><INDENT>last = first + last<EOL><DEDENT>return location.path, first, last<EOL><DEDENT>pass<EOL><DEDENT>return<EOL>
Parses arguments for the "list" command and returns the tuple:
    (filename, first line number, last line number)
    or sets these to None if there was some problem.