From d0d80cf5e1986596ee0b06e663021fd048c0f6f3 Mon Sep 17 00:00:00 2001 From: dehnert Date: Thu, 1 May 2014 11:49:49 +0200 Subject: [PATCH] Started on making the PrismParser more robust. Former-commit-id: 7ce1351d0c7221ef303052d9ab1264f2baaa5f50 --- src/parser/PrismParser.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/parser/PrismParser.h b/src/parser/PrismParser.h index 4a0eec392..6a31ef367 100644 --- a/src/parser/PrismParser.h +++ b/src/parser/PrismParser.h @@ -27,9 +27,11 @@ typedef BOOST_TYPEOF(qi::lit("//") >> *(qi::char_ - qi::eol) >> qi::eol | boost: #include "src/storage/expressions/Expression.h" #include "src/storage/expressions/Expressions.h" #include "src/exceptions/ExceptionMacros.h" +#include "src/exceptions/WrongFormatException.h" namespace storm { namespace parser { + // A class that stores information about the parsed program. class GlobalProgramInformation { public: // Default construct the header information. @@ -117,13 +119,7 @@ namespace storm { template qi::error_handler_result operator()(T1 b, T2 e, T3 where, T4 const& what) const { - // LOG4CPLUS_ERROR(logger, "Error: expecting " << what << " in line " << get_line(where) << " at column " << get_column(b, where, 4) << "."); - std::cerr << "Error: expecting " << what << " in line " << get_line(where) << "." << std::endl; - T3 end(where); - while (end != e && *end != '\r' && *end != '\n') { - ++end; - } - std::cerr << "Error: expecting " << what << " in line " << get_line(where) << ": \n" << std::string(get_line_start(b, where), end) << " ... \n" << std::setw(std::distance(b, where)) << '^' << "---- here\n"; + LOG_THROW(false, storm::exceptions::WrongFormatException, "Parsing error in line " << get_line(where) << ": " << " expecting " << what << "."); return qi::fail; } };