Spirit has a built-in construct for lists:
~*char( ':' ) % ':'
If you use attribute parsing you can simply perform the following:
std::vector< std::string > list_of_strings;
parse( begin, end, ~*char( ':' ) % ':', list_of_strings );
Nice huh?
Nice, but IUUC, it won't take into account the type of the elements, right? I tried to do the following (but it doesn't match the input string):
template <typename Iterator> struct sensor_parser : qi::grammar
{ sensor_parser() : sensor_parser::base_type(start) { using qi::int_; using qi::lit; using qi::double_; using qi::lexeme; using qi::eol; using ascii::char_; text %= lexeme[+(char_ - ':')];
start %= int_ >> ':' >> text >> ':' >> int_ >> ':' >> int_ >> ':' >> text >> -(':' >> int_) >> -(':' >> text) >> eol ; }
Your last 'text' parser eats your '\r\n' characters. As a result the eol parser fails. Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com