Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] alpha numeric characters
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-12-05 20:51:47


Thanks for that answer. But as far as I see it no, Spirit.Qi is not part of
boost 1.36?
At least docs do not state anything, but I can find includes for Qi. I will
give it a try.

On Sun, Dec 6, 2009 at 2:24 AM, OvermindDL1 <overminddl1_at_[hidden]> wrote:

> On Sat, Dec 5, 2009 at 5:33 PM, Ovanes Markarian <om_boost_at_[hidden]>
> wrote:
>

> You should not be using Spirit.Classic though, instead use Spirit.Qi,
> which is much better tested and much faster. The same code in
> Spirit.Qi is:
>
> +((+alnum)[some_callback_func] >> "->")
>
> Or is you just want to stuff all the strings in a vector:
>
> std::string input("a->b->c->");
> std::vector result;
>
> parse(input.begin(),input.end(),+(+alnum >> "->"),result);
>
> result will be an array of: ["a","b","c"]
>
> Also, if you only want the -> to be between strings and not following, use
> this:
>
> (+alnum)%"->"
>
> I tried it as well, but it nether worked. Unfortunately I have to define a
grammar and cannot pass strings around.

What I wonder, even

(+range_p('a','z'))[some_callback] parses a->b->c-> as the whole sequence

Many thanks for the answer.

Best Regards,
Ovanes



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