1 // Copyright (c) 2001-2011 Hartmut Kaiser
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #if !defined(SPIRIT_LEX_SEQUENCE_MAR_28_2007_0610PM)
7 #define SPIRIT_LEX_SEQUENCE_MAR_28_2007_0610PM
13 #include <boost/spirit/home/lex/domain.hpp>
14 #include <boost/spirit/home/lex/lexer_type.hpp>
15 #include <boost/spirit/home/lex/meta_compiler.hpp>
16 #include <boost/spirit/home/lex/detail/sequence_function.hpp>
17 #include <boost/fusion/include/any.hpp>
19 namespace boost { namespace spirit
21 ///////////////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////////////
25 struct use_operator<lex::domain, proto::tag::bitwise_or> // enables |
29 struct flatten_tree<lex::domain, proto::tag::bitwise_or> // flattens |
34 namespace boost { namespace spirit { namespace lex
36 template <typename Elements>
37 struct sequence : nary_lexer<sequence<Elements> >
39 sequence(Elements const& elements)
40 : elements(elements) {}
42 template <typename LexerDef, typename String>
43 void collect(LexerDef& lexdef, String const& state
44 , String const& targetstate) const
46 typedef detail::sequence_collect_function<LexerDef, String>
47 collect_function_type;
48 collect_function_type f (lexdef, state, targetstate);
49 fusion::any(elements, f);
52 template <typename LexerDef>
53 void add_actions(LexerDef& lexdef) const
55 detail::sequence_add_actions_function<LexerDef> f (lexdef);
56 fusion::any(elements, f);
62 ///////////////////////////////////////////////////////////////////////////
63 // Lexer generator: make_xxx function (objects)
64 ///////////////////////////////////////////////////////////////////////////
65 template <typename Elements, typename Modifiers>
66 struct make_composite<proto::tag::bitwise_or, Elements, Modifiers>
67 : make_nary_composite<Elements, sequence>
70 }}} // namespace boost::spirit::lex