
Hi
On 12/12/2013 20:13, Michael Caisse wrote: On 12/12/2013 10:47 AM, Francois Mauger wrote:
On 12/12/2013 15:24, TONGARI J wrote:
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).
ok. now that's clearer (while the syntax is rather obfuscating)
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.
well, this will be my approach after this first discovery round. I like it because post-processing will give me more freedom to manipulate the sink object.
Perhaps this will help some.
I know this (good) tutorial (yours... congratulation!). unfortunately I was really confused by the example with BOOST_FUSION_ADAPT_CLASS_NAMED in a first attempt to bind one of my class with Spirit/Qi/karma. I cannot find this macro in Boost 1.53. But see: <pre> $ tail -3 boost/version.hpp #define BOOST_LIB_VERSION "1_53" #endif $ tail -3 boost/fusion/include/adapt_assoc_class.hpp #include <boost/fusion/adapted/class/adapt_assoc_class.hpp> #endif $ ls boost/fusion/adapted/class/adapt_assoc_class.hpp ls: cannot access boost/fusion/adapted/class/adapt_assoc_class.hpp: No such file or directory </pre> Seems something is broken or badly cleaned in new versions of Boost. Then I found some *_AST_* macros. But it is too early for me to fight with it. I have found almost no simple examples to use it. Now I realize that AST probably refers to Abstract Syntax Tree and a probably a new underlying technique used in Spirit... Many thanks for your help. frc -- François Mauger Groupe "Interactions Fondamentales et Nature du Neutrino" NEMO-3/SuperNEMO Collaboration LPC Caen-CNRS/IN2P3-UCBN-ENSICAEN Département de Physique -- Université de Caen Basse-Normandie Adresse/address: Laboratoire de Physique Corpusculaire de Caen (UMR 6534) ENSICAEN 6, Boulevard du Marechal Juin 14050 CAEN Cedex FRANCE Courriel/e-mail: mauger@lpccaen.in2p3.fr Tél./phone: 02 31 45 25 12 / (+33) 2 31 45 25 12 Fax: 02 31 45 25 49 / (+33) 2 31 45 25 49