def expand(excmd): global exaliases if not exaliases: for line in data.lines('excommands.txt'): line = line[1:].rstrip() if '[' not in line: exaliases[line] = line else: current, _, end = line.partition('[') complete = current + end.rstrip(']') for ch in list(end): exaliases[current] = complete current += ch return exaliases.get(excmd.lower(), None)
import ex import re import data variants = {} types = {} for line in data.lines('options.txt'): aliases, type = re.match('(\S+)\s(\S+)', line).groups() aliases = aliases.split(':') base = aliases[0] for alias in aliases: variants[alias] = base types[base] = type def parse(optionstr): options = [] option = '' skipnext = False quoted = None for ch in list(optionstr): if skipnext: option += ch skipnext = False elif ch == '\\': option += ch skipnext = True elif ch in list('\'"'):
import ex import re import data variants = {} types = {} for line in data.lines('options.txt'): aliases, type = re.match('(\S+)\s(\S+)', line).groups() aliases = aliases.split(':') base = aliases[0] for alias in aliases: variants[alias] = base types[base] = type def parse(optionstr): options = [] option = '' skipnext = False quoted = None for ch in list(optionstr): if skipnext: option += ch skipnext = False elif ch == '\\': option += ch skipnext = True elif ch in list('\'"'): if quoted: if ch == quoted: