On 12/12/2013 10:47 AM, Francois Mauger wrote:
On 12/12/2013 15:24, TONGARI J wrote: Hi TJ,
<snip>
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). <snip>
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. slides: http://ciere.com/boostcon10/index.html video: http://wipkip.nikhef.nl/events/BoostCon/2010/Boostcon-MichaelCaisseUsingSpir... hth - michael -- Michael Caisse ciere consulting ciere.com