// We don't need to check whether this option exists or not, because this is already checked when
// parsing the configuration file.
// Now go through all the matching options and set them according to the values.
for(autooption:options->second){
if(option->getHasOptionBeenSet()){
// If the option was already set from the command line, we issue a warning and ignore the
// settings from the configuration file.
STORM_LOG_WARN("The option '"<<option->getLongName()<<" of module '"<<option->getModuleName()<<"' has been set in the configuration file, but was overriden on the command line.");
}else{
// If, however, the option has not been set yet, we try to assign values ot its arguments
STORM_LOG_THROW(argumentCache.size()<=option->getArgumentCount(),storm::exceptions::OptionParserException,"Too many arguments for option '"<<optionName<<"'.");
// Now set the provided argument values one by one.
STORM_LOG_THROW(conversionOk,storm::exceptions::OptionParserException,"Conversion of value of argument '"<<argument.getName()<<"' to its type failed.");
}
// In case there are optional arguments that were not set, we set them to their default value.
// Iterate over all options and set the arguments.
for(auto&option:optionIterator->second){
option->setHasOptionBeenSet();
STORM_LOG_THROW(argumentCache.size()<=option->getArgumentCount(),storm::exceptions::OptionParserException,"Too many arguments for option '"<<optionName<<"'.");
// Now set the provided argument values one by one.
STORM_LOG_THROW(conversionOk,storm::exceptions::OptionParserException,"Conversion of value of argument '"<<argument.getName()<<"' to its type failed.");
}
// In case there are optional arguments that were not set, we set them to their default value.
// If the first character of the line is a "[", we expect the settings of a new module to start and
// the line to be of the shape [<module>].
if(line.at(0)=='['){
STORM_LOG_THROW(line.at(0)=='['&&line.find("]")==line.length()-1&&line.find("[",1)==line.npos,storm::exceptions::OptionParserException,"Illegal module name header in configuration file '"<<filename<<" in line "<<std::to_string(lineNumber)<<". Expected [<module>] where <module> is a placeholder for a known module.");
// Extract the module name and check whether it's a legal one.
STORM_LOG_THROW(moduleName!=""&&(moduleName=="global"||(this->modules.find(moduleName)!=this->modules.end())),storm::exceptions::OptionParserException,"Module header in configuration file '"<<filename<<" in line "<<std::to_string(lineNumber)<<" refers to unknown module '"<<moduleName<<".");
// If the module name is "global", we unset the currently active module and treat all options to follow as unprefixed.
if(moduleName=="global"){
globalScope=true;
}else{
activeModule=moduleName;
globalScope=false;
}
}else{
// In this case, we expect the line to be of the shape o or o=a b c, where o is an option and a, b
// and c are the values that are supposed to be assigned to the arguments of the option.
std::size_tassignmentSignIndex=line.find("=");
boolcontainsAssignment=false;
if(assignmentSignIndex!=line.npos){
containsAssignment=true;
}
std::stringoptionName;
if(containsAssignment){
optionName=line.substr(0,assignmentSignIndex);
}else{
optionName=line;
}
if(globalScope){
STORM_LOG_THROW(this->longNameToOptions.find(optionName)!=this->longNameToOptions.end(),storm::exceptions::OptionParserException,"Option assignment in configuration file '"<<filename<<" in line "<<lineNumber<<" refers to unknown option '"<<optionName<<"'.");
}else{
STORM_LOG_THROW(this->longNameToOptions.find(activeModule+":"+optionName)!=this->longNameToOptions.end(),storm::exceptions::OptionParserException,"Option assignment in configuration file '"<<filename<<" in line "<<lineNumber<<" refers to unknown option '"<<activeModule<<":"<<optionName<<"'.");
}
// If the current line is an assignment, split the right-hand side of the assignment into parts
// If the input could not be matched, we have a parsing error.
STORM_LOG_THROW(hasMatch,storm::exceptions::OptionParserException,"Parsing error in configuration file '"<<filename<<"' in line "<<lineNumber<<". Unexpected input '"<<assignedValues<<"'.");
// Extract the matched argument and cut off the quotation marks if necessary.