|
Boost : |
From: Hartmut Kaiser (hartmutkaiser_at_[hidden])
Date: 2003-08-27 01:44:20
David B. Held wrote:
> The moral being:
>
> Using anychar_p all by itself is usually a Bad Thing(TM)
>
> That's because it's like the langoliers--it eats everything
> up. You usually want to say what it shouldn't eat up by
> subtracting the terminating character from the parser. I
> think this is a Spirit FAQ.
This isn't correct, sorry.
The anychar_p parser used by itself isn't a bad thing, because it eats
up only _one_ arbitrary character/token from the input stream, which may
be very useful. The problematic part is the kleene_star operator, which
requires some additional attention, because it "repeats" the attached
parser zero or more times. So the kleene_star in conjunction with the
anychar_p will eat up all your input sequence, regardless of what in
contains. But this may happen with other attached parsers too.
Regards Hartmut
BTW: this kleene_star behaviour _is_ a FAQ, see here:
http://www.boost.org/libs/spirit/doc/faq.html#kleene_star
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk