
On Sun, Sep 29, 2013 at 2:12 PM, Olivier Austina
this tutorial : http://en.highscore.de/cpp/boost/parser.html
I would like to traverse the parsed tree like classical tree (Pre-order, In-order, Post-order) to have data in a given order. Any suggestion will be appreciated. Thank you.
So if I understand correctly, this is no longer a question about parsing, it's a question about tree traversal. Are you saying you want to flatten the tree to process its elements by iteration, in a particular order? Consider the same_fringe.cpp example in the coroutine library in the Subversion trunk: http://svn.boost.org/svn/boost/trunk/libs/coroutine/example/cpp03/same_fring... Look at the traverse() function. This is bound to a particular tree of nodes and launched as a coroutine. You can then use boost::begin() and boost::end() on the coroutine object. This permits use with BOOST_FOREACH, standard algorithms, ... You can alter processing order simply by writing a traversal function whose body processes the node's value in different places relative to the subtrees. Apologies if I've completely misunderstood your question.