From 8ab3ea991da3f41b3b6e558cbdbb5ff25549c60a Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Thu, 30 Aug 2018 14:05:57 +0200 Subject: [PATCH] fix in drn parser --- CHANGELOG.md | 1 + src/storm-parsers/parser/DirectEncodingParser.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd207331..eb2345e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Version 1.2.x ### Version 1.2.4 (2018/08) - New binary `storm-conv` that handles conversions between model files (currently: prism to jani) - Added support for expected time properties for discrete time models +- Bug fix in the parser for DRN (MDPs and MAs might have been affected). - Several bug fixes related to jani - `storm-gspn`: Improved .pnpro parser - `storm-gspn`: Added support for single/infinite/k-server semantics for GSPNs given in the .pnpro format diff --git a/src/storm-parsers/parser/DirectEncodingParser.cpp b/src/storm-parsers/parser/DirectEncodingParser.cpp index da4cd5228..13be6d62d 100644 --- a/src/storm-parsers/parser/DirectEncodingParser.cpp +++ b/src/storm-parsers/parser/DirectEncodingParser.cpp @@ -126,7 +126,7 @@ namespace storm { size_t row = 0; size_t state = 0; bool firstState = true; - bool firstAction = true; + bool firstActionForState = true; while (std::getline(file, line)) { STORM_LOG_TRACE("Parsing: " << line); if (boost::starts_with(line, "state ")) { @@ -135,7 +135,9 @@ namespace storm { firstState = false; } else { ++state; + ++row; } + firstActionForState = true; STORM_LOG_TRACE("New state " << state); // Parse state id @@ -209,8 +211,8 @@ namespace storm { } else if (boost::starts_with(line, "\taction ")) { // New action - if (firstAction) { - firstAction = false; + if (firstActionForState) { + firstActionForState = false; } else { ++row; } @@ -232,7 +234,7 @@ namespace storm { } else { // New transition size_t posColon = line.find(":"); - STORM_LOG_ASSERT(posColon != std::string::npos, "':' not found."); + STORM_LOG_THROW(posColon != std::string::npos, storm::exceptions::WrongFormatException, "':' not found."); size_t target = NumberParser::parse(line.substr(2, posColon-3)); std::string valueStr = line.substr(posColon+2); ValueType value = valueParser.parseValue(valueStr);