]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
2 | // | |
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) | |
5 | ||
6 | #if !defined(SPIRIT_LEX_SEQUENCE_MAR_28_2007_0610PM) | |
7 | #define SPIRIT_LEX_SEQUENCE_MAR_28_2007_0610PM | |
8 | ||
9 | #if defined(_MSC_VER) | |
10 | #pragma once | |
11 | #endif | |
12 | ||
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> | |
18 | ||
19 | namespace boost { namespace spirit | |
20 | { | |
21 | /////////////////////////////////////////////////////////////////////////// | |
22 | // Enablers | |
23 | /////////////////////////////////////////////////////////////////////////// | |
24 | template <> | |
25 | struct use_operator<lex::domain, proto::tag::bitwise_or> // enables | | |
26 | : mpl::true_ {}; | |
27 | ||
28 | template <> | |
29 | struct flatten_tree<lex::domain, proto::tag::bitwise_or> // flattens | | |
30 | : mpl::true_ {}; | |
31 | ||
32 | }} | |
33 | ||
34 | namespace boost { namespace spirit { namespace lex | |
35 | { | |
36 | template <typename Elements> | |
37 | struct sequence : nary_lexer<sequence<Elements> > | |
38 | { | |
39 | sequence(Elements const& elements) | |
40 | : elements(elements) {} | |
41 | ||
42 | template <typename LexerDef, typename String> | |
43 | void collect(LexerDef& lexdef, String const& state | |
44 | , String const& targetstate) const | |
45 | { | |
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); | |
50 | } | |
51 | ||
52 | template <typename LexerDef> | |
53 | void add_actions(LexerDef& lexdef) const | |
54 | { | |
55 | detail::sequence_add_actions_function<LexerDef> f (lexdef); | |
56 | fusion::any(elements, f); | |
57 | } | |
58 | ||
59 | Elements elements; | |
60 | }; | |
61 | ||
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> | |
68 | {}; | |
69 | ||
70 | }}} // namespace boost::spirit::lex | |
71 | ||
72 | #endif |