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 {"point"} =
int_ >> double_ >> double_ >> double_;
auto const element = rule {"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?