def __isCommand(self, key, word2): """ decide if a keyword and next word are of the form 'command arg, ...' which will get translated to 'command(arg, ...)' to allow 'command syntax' """ # this could be in one long test, but we simplify: # first test key: if (not isValidName(key) or key in self.friends or key.startswith('#') or len(key) < 1 or len(word2) < 1): return False if self._larch is not None: comms = self._larch.symtable.get_symbol('_sys.valid_commands', create=True) if key not in comms: return False # next test word2 return (isValidName(word2) or isNumber(word2) or isLiteralStr(word2) )
def __isCommand(self, key, word2): """ decide if a keyword and next word are of the form 'command arg, ...' which will get translated to 'command(arg, ...)' to allow 'command syntax' """ # this could be in one long test, but we simplify: # first test key: if (not isValidName(key) or key in self.friends or key.startswith('#') or len(key) < 1 or len(word2) < 1): return False # next test word2 return (isValidName(word2) or isNumber(word2) or isLiteralStr(word2))
def __isCommand(self, key, word2): """ decide if a keyword and next word are of the form 'command arg, ...' which will get translated to 'command(arg, ...)' to allow 'command syntax' """ # this could be in one long test, but we simplify: # first test key: if (not isValidName(key) or key in self.friends or key.startswith('#') or len(key) < 1 or len(word2) < 1): return False # next test word2 return (isValidName(word2) or isNumber(word2) or isLiteralStr(word2) )