From 5623e66566353b32913059aa41f00f40b3b0176b Mon Sep 17 00:00:00 2001 From: David_Korzeniewski Date: Sat, 30 May 2015 17:21:28 +0200 Subject: [PATCH] Ignore empty lines in property file and only warn if a line could not be parsed Former-commit-id: 1d2767e90dd95240a0870e26600758919f70dc4b --- src/utility/cli.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/utility/cli.h b/src/utility/cli.h index 9d21378c4..608635c53 100644 --- a/src/utility/cli.h +++ b/src/utility/cli.h @@ -607,7 +607,9 @@ namespace storm { while (inputFileStream.good()) { std::string prop; std::getline(inputFileStream, prop); - properties.push_back(prop); + if (!prop.empty()) { + properties.push_back(prop); + } } } catch (std::exception& e) { @@ -621,14 +623,19 @@ namespace storm { for (std::string prop : properties) { boost::optional> formula; - if (program) { - storm::parser::FormulaParser formulaParser(program.get().getManager().getSharedPointer()); - formula = formulaParser.parseFromString(prop); - } else { - storm::parser::FormulaParser formulaParser; - formula = formulaParser.parseFromString(prop); + try { + if (program) { + storm::parser::FormulaParser formulaParser(program.get().getManager().getSharedPointer()); + formula = formulaParser.parseFromString(prop); + } else { + storm::parser::FormulaParser formulaParser; + formula = formulaParser.parseFromString(prop); + } + formulas.push_back(formula); + } + catch (storm::exceptions::WrongFormatException &e) { + STORM_LOG_WARN("Unable to parse line as formula: " << prop); } - formulas.push_back(formula); } std::cout << "Parsed " << formulas.size() << " properties from file " << settings.getPropertiesFilename() << std::endl; }