Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit/Qi/Phoenix] non compiling rules...
From: Michael Caisse (mcaisse-lists_at_[hidden])
Date: 2013-12-12 14:13:37

On 12/12/2013 10:47 AM, Francois Mauger wrote:
>>>>On 12/12/2013 15:24, TONGARI J wrote:
> Hi TJ,


> However I don't understand the "()" after the "std::vector<char>". what
> does it mean ? Does it refer to the std::vector constructor ?

It is function declaration syntax. It is specifying a function that
returns a std::vector<char> and takes no parameters. Qi uses this syntax
to specify what the rule will synthesize (produce or return) and the
inherited parameters (arguments to the rule).


> Do you mean I should discard "...[boost::phoenix::ref(...) = ...]" stuff
> in my rules and use a "sink" data structure (some kind of fusion
> "container")
> <pre>
> Foo bar;
> bool r = phrase_parse(
> strbegin,
> s.end(),
> my_rule,
> bar);
> </pre>
> where Foo could be a sort of tuple aggregating more basic attributes ?

Attribute parsing is the way to go. Avoid semantic actions as much as
possible. Parse into a data structure and then post process that
structure if needed. Foo might be a tuple or it might be some complex,
recursive data structure... it will depend on what you are parsing.

> Maybe can you show me an URL where I will find some "simple" code
> snippet... I'm ready to RTFM but first I should find it (at least the
> right one... there are so many confusing informations about Spirit for a
> newbie).

Perhaps this will help some.


hth -

Michael Caisse
ciere consulting

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at