
13 Sep
2011
13 Sep
'11
5:40 p.m.
Hello, can anyone of you give me a hint, how I can get the line number of the input file inside the on_error handler where the parsing error happens? Full source is atttached as file.cpp. bool test(Iterator first, Iterator last) { qi::rule<Iterator>start; start.name("start"); start=*(eps>char_('a')>>eol); on_error<fail> ( start , std::cout << val("Error! Expecting ") << _4 << val(" here(") //linenumber insert << val("): \"") << construct<std::string>(_3, _2) << val("\"") << std::endl ); bool r = qi::parse(first,last,start); if (r && first == last){ return true; } else{ return false; } } Best regards