how to get progress indicator during phrase_parse() of boost::spirit::x3?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how to get progress indicator during phrase_parse() of boost::spirit::x3?

Boost - Users mailing list
I am using boost::spirit:x3, shown below. I use it to import/parse
some very large files and am trying to find a way to get some sort of
progress from it so that I can use for a progress bar in app, but so
far I've been unable to see a way.

    namespace parser {
        namespace x3 = boost::spirit::x3;
        using namespace x3;

        auto const string = lexeme[+graph];
        auto const point = rule<struct _p, ast::point> {"point"} =
            int_ >> double_ >> double_ >> double_;
        auto const element = rule<struct _e, ast::element> {"element"} =
            int_ >> string >> int_ >> int_ >> int_ >> eol >>
            *(int_ >> int_ >> int_);

        auto lines = [](auto p) { return *(p >> eol); };

        auto const input =
            lines(point) >>
            lines(element);
    }

And I import a file like so.

{
    namespace x3 = boost::spirit::x3;

    mapped_file_source map(filePath);
    std::istringstream iss(map.data());
    map.close();

    boost::spirit::istream_iterator iter(iss >> std::noskipws), eof;

    bool ok = phrase_parse(iter, eof, smf::parser::input, x3::blank, types);

    if (iter != eof) {
        // ...
    }
}

Would anyone have thoughts on how to get some sort of indicator during
the parsing?
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users