diff options
Diffstat (limited to 'Source/cmArgumentParser.cxx')
-rw-r--r-- | Source/cmArgumentParser.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx index 355cfdc..df008a2 100644 --- a/Source/cmArgumentParser.cxx +++ b/Source/cmArgumentParser.cxx @@ -78,13 +78,12 @@ void Instance::Consume(cm::string_view arg) { auto const it = this->Bindings.Find(arg); if (it != this->Bindings.end()) { + this->FinishKeyword(); + this->Keyword = it->first; if (this->ParsedKeywords != nullptr) { this->ParsedKeywords->emplace_back(it->first); } it->second(*this); - if (this->ExpectValue && this->KeywordsMissingValue != nullptr) { - this->KeywordsMissingValue->emplace_back(it->first); - } return; } @@ -98,11 +97,18 @@ void Instance::Consume(cm::string_view arg) this->UnparsedArguments->emplace_back(arg); } + this->ExpectValue = false; +} + +void Instance::FinishKeyword() +{ + if (this->Keyword.empty()) { + return; + } if (this->ExpectValue) { if (this->KeywordsMissingValue != nullptr) { - this->KeywordsMissingValue->pop_back(); + this->KeywordsMissingValue->emplace_back(this->Keyword); } - this->ExpectValue = false; } } |