Home | Libraries | People | FAQ | More |
template <class P, class S> struct debug_parsing_error { debug_parsing_error(); };
This is a template class.
Utility to debug errors generated by a compile-time parser. An instance
of the instantiated template class has to be created and initialised using
the default constructor. When parsing the input string using the parser
generates an error, the default constructor of debug_parsing_error
prints the error message to the standard output at run-time and calls
exit
.
Note | |
---|---|
Note that more powerful debugging utilities, like Metashell are also available. |
#include <boost/metaparse/debug_parsing_error.hpp>
For any p
compile-time
parser and s
compile-time
string
debug_parsing_error<p, s>()
Tries to parse s
using
p
at compile-time. At run-time
the constructor prints the result of parsing to the standard output and
calls exit
.
#include <boost/metaparse/debug_parsing_error.hpp> #include <boost/metaparse/int_.hpp> #include <boost/metaparse/string.hpp> #include <type_traits> using namespace boost::metaparse; debug_parsing_error<int_, BOOST_METAPARSE_STRING("not an int")> do_debugging; int main() {}
By running the compiled executable you get the following:
Compile-time parsing results ---------------------------- Input text: not an int
Parsing failed: line 1, col 1: Digit expected