Boost logo

Boost Users :

Subject: [Boost-users] [qi] Get line number of an on_error handler from an ifstream iterator
From: boost_mailinglist_at_[hidden]
Date: 2011-09-13 13:40:20


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)



    , 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;
        return false;

Best regards

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at