Chris@16
|
1 // Copyright (c) 2001-2011 Hartmut Kaiser
|
Chris@16
|
2 //
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 #if !defined(BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM)
|
Chris@16
|
7 #define BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM
|
Chris@16
|
8
|
Chris@16
|
9 #if defined(_MSC_VER)
|
Chris@16
|
10 #pragma once
|
Chris@16
|
11 #endif
|
Chris@16
|
12
|
Chris@16
|
13 #include <boost/spirit/home/lex/domain.hpp>
|
Chris@16
|
14 #include <boost/spirit/home/support/unused.hpp>
|
Chris@16
|
15
|
Chris@16
|
16 namespace boost { namespace spirit { namespace lex { namespace detail
|
Chris@16
|
17 {
|
Chris@16
|
18 template <typename LexerDef, typename String>
|
Chris@16
|
19 struct sequence_collect_function
|
Chris@16
|
20 {
|
Chris@16
|
21 sequence_collect_function(LexerDef& def_, String const& state_
|
Chris@16
|
22 , String const& targetstate_)
|
Chris@16
|
23 : def(def_), state(state_), targetstate(targetstate_) {}
|
Chris@16
|
24
|
Chris@16
|
25 template <typename Component>
|
Chris@16
|
26 bool operator()(Component const& component) const
|
Chris@16
|
27 {
|
Chris@16
|
28 component.collect(def, state, targetstate);
|
Chris@16
|
29 return false; // execute for all sequence elements
|
Chris@16
|
30 }
|
Chris@16
|
31
|
Chris@16
|
32 LexerDef& def;
|
Chris@16
|
33 String const& state;
|
Chris@16
|
34 String const& targetstate;
|
Chris@16
|
35
|
Chris@16
|
36 private:
|
Chris@16
|
37 // silence MSVC warning C4512: assignment operator could not be generated
|
Chris@16
|
38 sequence_collect_function& operator= (sequence_collect_function const&);
|
Chris@16
|
39 };
|
Chris@16
|
40
|
Chris@16
|
41 template <typename LexerDef>
|
Chris@16
|
42 struct sequence_add_actions_function
|
Chris@16
|
43 {
|
Chris@16
|
44 sequence_add_actions_function(LexerDef& def_)
|
Chris@16
|
45 : def(def_) {}
|
Chris@16
|
46
|
Chris@16
|
47 template <typename Component>
|
Chris@16
|
48 bool operator()(Component const& component) const
|
Chris@16
|
49 {
|
Chris@16
|
50 component.add_actions(def);
|
Chris@16
|
51 return false; // execute for all sequence elements
|
Chris@16
|
52 }
|
Chris@16
|
53
|
Chris@16
|
54 LexerDef& def;
|
Chris@16
|
55
|
Chris@16
|
56 private:
|
Chris@16
|
57 // silence MSVC warning C4512: assignment operator could not be generated
|
Chris@16
|
58 sequence_add_actions_function& operator= (sequence_add_actions_function const&);
|
Chris@16
|
59 };
|
Chris@16
|
60
|
Chris@16
|
61 }}}}
|
Chris@16
|
62
|
Chris@16
|
63 #endif
|