Skip to content

Commit

Permalink
Warn if property string could potentially be a non-existing property …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
volkm committed Dec 10, 2024
1 parent ab859aa commit 7f2e133
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/storm-parsers/api/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ std::vector<storm::jani::Property> parseProperties(storm::parser::FormulaParser&
STORM_LOG_INFO("Loading properties from file: " << inputString << '\n');
properties = formulaParser.parseFromFile(inputString);
} else {
// File does not exists -> parse as property string
// Provide warning if string could potentially be a property file
if (inputString.find(".prop") != std::string::npos || inputString.find(".pctl") != std::string::npos ||
inputString.find(".prctl") != std::string::npos || inputString.find(".csl") != std::string::npos) {
STORM_LOG_WARN("File with name '" << inputString << "' does not exist. Trying to parse as property string.");
}
properties = formulaParser.parseFromString(inputString);
}

Expand All @@ -46,8 +52,7 @@ std::vector<storm::jani::Property> parseProperties(std::string const& inputStrin
} catch (storm::exceptions::WrongFormatException const& e) {
STORM_LOG_THROW(false, storm::exceptions::WrongFormatException,
e.what() << "Note that the used API function does not have access to model variables. If the property you tried to parse contains "
"model variables, it will not "
"be parsed correctly.");
"model variables, it will not be parsed correctly.");
}
}

Expand Down

0 comments on commit 7f2e133

Please sign in to comment.