Boost logo

Boost :

From: Paul Hamilton (paul_at_[hidden])
Date: 2003-08-21 20:24:49


hartmutkaiser_at_[hidden] (Hartmut Kaiser) wrote:

> The first *anychar_p eats up all your input (it matches zero or more
> occurences of any char :-). There are several ways to circumvent this
> problem:
> list_wo_item = (*(anychar_p - ','))[append (vec_list)]
>>> *( ',' >> (*(anychar_p - ','))[append (vec_list)] )
> ;

Thanks for that.

My complete expression (which works great!) is:

     list_wo_item = '[' >>
                        (*(anychar_p - (ch_p(',') | ch_p(']'))))[append(vec_list)] >>
                                *(',' >> (*(anychar_p - (ch_p(',') |
ch_p(']'))))[append(vec_list)]) >>
                        ']';

Which matches my "[x,y,z]" string perfectly.

Yours was the push that I needed to be able to work this stuff out.

> list_wo_item = list_p((*anychar_p)[append(vec_list)], ',');

I couldn't get this to do anything. How would it work in the more
complicated example above. Looking through the code, I couldn't really
understand what t actually does.

> parse_info<> result = parse (plist_wo_item, list_wo_item, space_p);

This gives me a compile error. If you look at the "parse" template, the
only version that seems to take the "space_p" parser is the one
accepting iterators, and since my actual argument is a std:;string, I
tried:

parse_info<> result = parse (str.begin(), str.end(), list_wo_item,
space_p);

Which also doesn't compile.

Paul.

---------------------
Paul Hamilton
pHamtec P/L - Software Makers
http://www.phamtec.com/
mailto:paul_at_[hidden]

The information transmitted is intended only for the person or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer.
-----------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk