From: Larry E. <cpp...@su...> - 2007-11-29 12:35:39
|
On 11/29/07 06:02, Larry Evans wrote: > On 11/29/07 05:17, Flogromp N. wrote: > [snip] >> The data is specifically in a linked list of tagged-unions. >> > So if the lex_iterator::token_type found on: > > http://www.boost.org/libs/wave/doc/class_reference_lexer.html > > were changed to be your 'tagged union' (or maybe > something like boost::variant<T1,T2,...,Tn>): > > http://www.boost.org/doc/html/boost/variant.html > > and, obviously, the iterator would just iterate through > this linked list of 'tagged unions', then would that meet > your needs? The file, proto_static_disp.cpp in: http://www.boost-consulting.com/vault/index.php?directory=Strings%20-%20Text%20Processing has: typedef boost::variant < vocabulary<terminal>::variable<vocabulary<terminal>::ident> , vocabulary<terminal>::variable<vocabulary<terminal>::number> , vocabulary<terminal>::variable<vocabulary<terminal>::op_add> , vocabulary<terminal>::variable<vocabulary<terminal>::op_mult> , vocabulary<terminal>::variable<vocabulary<terminal>::par_left> , vocabulary<terminal>::variable<vocabulary<terminal>::par_right> , vocabulary<terminal>::variable<vocabulary<terminal>::end_words> > terminal_sum_type ; #include <vector> #include "boost/range/iterator_range.hpp" template < > struct word_iterator < terminal_sum_type > : public boost::iterator_range<std::vector<terminal_sum_type>::const_iterator> { ... }; which is more directly what you're aiming at, I think. Although work_iterator isn't used in spirit at all, I think it could be adapted, and you'd replace terminal_sum_type with whatever your tagged union is. HTH. |