c++ - Error reporting in Boost Spirit -
i have following error handler @ bottom of parser grammar: qi::on_error<qi::fail>( launch, std::cerr << phoenix::val("paring error in ") << spirit::_4 << std::endl << phoenix::construct<std::string>(spirit::_3, spirit::_2) << std::endl ); the problem parser's input isn't broken-up new lines beforehand, resulting error statement all lines in source code error point until end. there straightforward alternative phoenix::construct<std::string>(spirit::_3, spirit::_2) to print 1 line error occurs on? phoenix semantics giving me trouble if try search '\n' . we need create phoenix function can take spirit parameters. // lazy function error reporting struct reporterror { // result type must explicit phoenix template<typename, typename, typename, typename> struct result { typedef void type; }; // contract string surrounding new-line characters ...