- if len(tokens) == 0:
- self.send_to(connection_id, 'EMPTY COMMAND')
- elif len(tokens) == 1 and tokens[0] == 'INC_P':
- self.cmd_inc_p(connection_id)
- elif len(tokens) == 1 and tokens[0] == 'GET_TURN':
- self.cmd_get_turn(connection_id)
- elif len(tokens) == 1 and tokens[0] == 'WAIT':
- self.cmd_wait(connection_id)
- elif len(tokens) == 2 and tokens[0] == 'MOVE':
- self.cmd_move(tokens[1], connection_id)
- elif len(tokens) >= 1 and tokens[0] == 'ECHO':
- self.cmd_echo(tokens, input_, connection_id)
- elif len(tokens) >= 1 and tokens[0] == 'ALL':
- self.cmd_all(tokens, input_)
- elif len(tokens) >= 1 and tokens[0] == 'FIB':
- # TODO: Should this really block the whole loop?
- self.cmd_fib(tokens, connection_id)
+ command = self.parser.parse(input_)
+ if command is None:
+ self.send_to(connection_id, 'UNHANDLED INPUT')