Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SpiritErrorHandler.h
Go to the documentation of this file.
1#pragma once
2
4
7
8namespace storm {
9namespace parser {
10// Functor used for displaying error information.
12 typedef qi::error_handler_result result_type;
13
14 template<typename T1, typename T2, typename T3, typename T4>
15 qi::error_handler_result operator()(T1 b, T2 e, T3 where, T4 const& what) const {
16 auto lineStart = boost::spirit::get_line_start(b, where);
17 auto lineEnd = std::find(where, e, '\n');
18 std::string line(lineStart, lineEnd);
19
20 std::stringstream stream;
21 stream << "Parsing error at " << get_line(where) << ":" << boost::spirit::get_column(lineStart, where) << ": " << " expecting " << what << ", here:\n";
22 stream << "\t" << line << '\n';
23 auto caretColumn = boost::spirit::get_column(lineStart, where);
24 stream << "\t" << std::string(caretColumn - 1, ' ') << "^\n";
25
26 STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, stream.str());
27 return qi::fail;
28 }
29};
30} // namespace parser
31} // namespace storm
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
LabParser.cpp.
Definition cli.cpp:18
qi::error_handler_result operator()(T1 b, T2 e, T3 where, T4 const &what) const
qi::error_handler_result result_type