def process_expansion(self, expansion): parts = KEY_SPLIT_RE.split(expansion.string) for macro in self.macros: macro.process(parts) expansion.string = ''.join(parts)
def parsePositionTokens(self, expansion): # Check the string for cursor positioning token and apply lefts and ups as appropriate if CURSOR_POSITION_TOKEN in expansion.string: # TODO: Undefined local variable? firstpart, secondpart = expansion.string.split(CURSOR_POSITION_TOKEN) foundNavigationKey = False for key in NAVIGATION_KEYS: if key in expansion.string: expansion.lefts = 0 foundNavigationKey = True break if not foundNavigationKey: for section in KEY_SPLIT_RE.split(secondpart): if not Key.is_key(section) or section in [' ', '\n']: expansion.lefts += len(section) expansion.string = firstpart + secondpart
def _can_process(self, token): if KEY_SPLIT_RE.match(token): return token[1:-1].split(' ', 1)[0] == self.ID else: return False