Ejemplo n.º 1
0
 def __init__(self, commandList, actorName="ACTOR"):
     """! Generate a command set
     @param[in] commandList: a list of Command objects
     @param[in] actorName: string name of the actor
     """
     # turn list of commands into a dictionary
     self.commandDict = collections.OrderedDict()
     self.actorName = actorName
     for command in commandList:
         self.commandDict[command.commandName] = command
     self.createHelpCmd()
     self.commandMatchList = MatchList(valueList = self.commandDict.keys())
Ejemplo n.º 2
0
 def uniqueMatch(self, matchList):
     """matchList: A RO MatchList object
     """
     matchList = MatchList(matchList)
     def onParse(tolken):
         kw = str(tolken[0])
         # see if keyword is in list, else raise a parse error
         try:
             fullKW = matchList.getUniqueMatch(kw)
         except ValueError:
             raise ParseError("%s not uniquely defined in %s"%(kw, str(matchList.valueList)))
         return fullKW
     return self._word.setParseAction(onParse)
Ejemplo n.º 3
0
 def argMatchList(self):
     return MatchList(valueList = self.floatingArgDict.keys())