]>
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(BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM) | |
7 | #define BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM | |
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/support/unused.hpp> | |
15 | ||
16 | namespace boost { namespace spirit { namespace lex { namespace detail | |
17 | { | |
18 | template <typename LexerDef, typename String> | |
19 | struct sequence_collect_function | |
20 | { | |
21 | sequence_collect_function(LexerDef& def_, String const& state_ | |
22 | , String const& targetstate_) | |
23 | : def(def_), state(state_), targetstate(targetstate_) {} | |
24 | ||
25 | template <typename Component> | |
26 | bool operator()(Component const& component) const | |
27 | { | |
28 | component.collect(def, state, targetstate); | |
29 | return false; // execute for all sequence elements | |
30 | } | |
31 | ||
32 | LexerDef& def; | |
33 | String const& state; | |
34 | String const& targetstate; | |
35 | ||
36 | private: | |
37 | // silence MSVC warning C4512: assignment operator could not be generated | |
38 | sequence_collect_function& operator= (sequence_collect_function const&); | |
39 | }; | |
40 | ||
41 | template <typename LexerDef> | |
42 | struct sequence_add_actions_function | |
43 | { | |
44 | sequence_add_actions_function(LexerDef& def_) | |
45 | : def(def_) {} | |
46 | ||
47 | template <typename Component> | |
48 | bool operator()(Component const& component) const | |
49 | { | |
50 | component.add_actions(def); | |
51 | return false; // execute for all sequence elements | |
52 | } | |
53 | ||
54 | LexerDef& def; | |
55 | ||
56 | private: | |
57 | // silence MSVC warning C4512: assignment operator could not be generated | |
58 | sequence_add_actions_function& operator= (sequence_add_actions_function const&); | |
59 | }; | |
60 | ||
61 | }}}} | |
62 | ||
63 | #endif |