hi all,
i'm trying to ignore unecognized lines of input (so following lines can be processed without the
parse failing).
eg: very simple scenario as follows:
///===================================================
{
using namespace boost::spirit;
typedef file_iterator<char> iterator_t;
typedef scanner scanner_t;
typedef rule rule_t;
int red=0, green=0, blue=0;
rule_t option =
(str_p("red") >> '=' >> int_p[assign(red)])
|
(str_p("green") >> '=' >> int_p[assign(green)])
|
(str_p("blue") >> '=' >> int_p[assign(blue)])
|
;
iterator_t first(filename.c_str());
if (!first) return;
iterator_t last = first.make_end();
parse(first, last, *option, space_p);
}
///===================================================
wiw is a parser that will skip over the unrecognized line with input like this:
------------------
red = 255
kermit = green
green = 128
blue = 128
------------------
and correctly interpret the green and blue values..
i played around with eol_p as i want to skip whole lines of unrecognized content. i thought it
would be easy, but i can't seem to get it right.
can anybody do my job for me?
cheers
Jono