Changeset 1188 for code/branches/console/src/core/CommandExecutor.cc
- Timestamp:
- Apr 26, 2008, 2:50:04 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CommandExecutor.cc
r1187 r1188 236 236 if (this->shortcut_) 237 237 { 238 if (this->shortcut_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " ")) 239 { 240 this->bEvaluatedParams_ = true; 241 this->evaluatedExecutor_ = this->shortcut_; 238 if (this->tokens_.size() <= 1) 239 { 240 if (this->shortcut_->evaluate(this->getAdditionalParameter(), this->param_, " ")) 241 { 242 this->bEvaluatedParams_ = true; 243 this->evaluatedExecutor_ = this->shortcut_; 244 } 245 } 246 else if (this->tokens_.size() > 1) 247 { 248 if (this->shortcut_->evaluate(this->tokens_.subSet(1).join() + this->getAdditionalParameter(), this->param_, " ")) 249 { 250 this->bEvaluatedParams_ = true; 251 this->evaluatedExecutor_ = this->shortcut_; 252 } 242 253 } 243 254 } … … 247 258 if (this->function_) 248 259 { 249 if (this->function_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " ")) 250 { 251 this->bEvaluatedParams_ = true; 252 this->evaluatedExecutor_ = this->function_; 260 if (this->tokens_.size() <= 2) 261 { 262 if (this->function_->evaluate(this->getAdditionalParameter(), this->param_, " ")) 263 { 264 this->bEvaluatedParams_ = true; 265 this->evaluatedExecutor_ = this->function_; 266 } 267 } 268 else if (this->tokens_.size() > 2) 269 { 270 if (this->function_->evaluate(this->tokens_.subSet(2).join() + this->getAdditionalParameter(), this->param_, " ")) 271 { 272 this->bEvaluatedParams_ = true; 273 this->evaluatedExecutor_ = this->function_; 274 } 253 275 } 254 276 } … … 354 376 bool CommandExecutor::execute(const std::string& command) 355 377 { 378 std::cout << "CE_execute: " << command << "\n"; 356 379 if ((CommandExecutor::getEvaluation().processedCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)) 357 CommandExecutor::parse(command); 380 {std::cout << "CE_execute->parse\n"; 381 CommandExecutor::parse(command);} 358 382 359 383 return CommandExecutor::execute(CommandExecutor::getEvaluation()); … … 368 392 { 369 393 (*evaluation.evaluatedExecutor_)(evaluation.param_[0], evaluation.param_[1], evaluation.param_[2], evaluation.param_[3], evaluation.param_[4]); 394 return true; 370 395 } 371 396 … … 612 637 { 613 638 CommandExecutor::parse(command, true); 639 std::cout << "1_1: " << command << std::endl; 640 if (CommandExecutor::getEvaluation().tokens_.size() > 0) 641 { 642 std::string lastToken; 643 lastToken = CommandExecutor::getEvaluation().tokens_[CommandExecutor::getEvaluation().tokens_.size() - 1]; 644 lastToken = lastToken.substr(0, lastToken.size() - 1); 645 CommandExecutor::getEvaluation().tokens_.pop_back(); 646 CommandExecutor::getEvaluation().tokens_.append(SubString(lastToken, " ")); 647 } 648 std::cout << "1_2: " << CommandExecutor::getEvaluation().tokens_[CommandExecutor::getEvaluation().tokens_.size() - 1] << std::endl; 614 649 CommandExecutor::getEvaluation().evaluateParams(); 615 650 return CommandExecutor::getEvaluation(); … … 1049 1084 CommandExecutor::getEvaluation().additionalParameter_ = ""; 1050 1085 1086 CommandExecutor::getEvaluation().bEvaluatedParams_ = false; 1087 CommandExecutor::getEvaluation().evaluatedExecutor_ = 0; 1088 1051 1089 CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.clear(); 1052 1090 CommandExecutor::getEvaluation().listOfPossibleShortcuts_.clear();
Note: See TracChangeset
for help on using the changeset viewer.