Boost Users :
Date: 2003-09-02 02:13:47
Larry Knain wrote:
> I inserted the code change you suggested and it picks up the
> 2 but there is no indication of the "missing" list element.
> I'll do some more reading and see what I can come up with.
> (I have a number of CSV files created by various spreadsheets
> and DB programs that I need to read that have "missing" list
> items and was trying for a more elegant solution in Spirit. I
> have done this with the tokenizer by keeping the delimiter tokens.)
Honestly, I've already thought, that you'll bring up this issue :-)
It's simply a matter of operator precedence in C++. If you write:
you make the whole item construct optional:
!(list_csv_item[append(vec_item)]), i.e. the attached semantic action is
optional too and will be executed only, if/when the parser matches.
But if you'd write:
(please note the additional parenthesis pair), you'd make optional the
parser part only. The action is executed always (even if the parser does
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net