Exemplo n.º 1
0
 def add_command(self, command, callback, cmd_desc, token_desc):
     """
     Add a command to the parse tree.
     :param command: A command string.
     :param cmd_desc:  The description of the command.
     :param token_desc: A dictionary for description of each token.
     :return: None
     """
     tokens = [Token.from_string(x) for x in command.split()]
     cur_node = self._root
     for token in tokens:
         cur_node = cur_node.add(token)
     cur_node.add(callback, cmd_desc)
Exemplo n.º 2
0
 def add_command(self, command, callback, cmd_desc, token_desc):
     """
     Add a command to the parse tree.
     :param command: A command string.
     :param cmd_desc:  The description of the command.
     :param token_desc: A dictionary for description of each token.
     :return: None
     """
     tokens = [Token.from_string(x) for x in command.split()]
     cur_node = self._root
     for token in tokens:
         cur_node = cur_node.add(token)
     cur_node.add(callback, cmd_desc)