summaryrefslogtreecommitdiffstats
blob: 0f52da8413fb6f8d67787082593c7af1513c86fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//  Copyright (c) 2001-2011 Hartmut Kaiser
// 
//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#if !defined(BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM)
#define BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM

#if defined(_MSC_VER)
#pragma once
#endif

#include <boost/spirit/home/lex/domain.hpp>
#include <boost/spirit/home/support/unused.hpp>

namespace boost { namespace spirit { namespace lex { namespace detail
{
    template <typename LexerDef, typename String>
    struct sequence_collect_function
    {
        sequence_collect_function(LexerDef& def_, String const& state_
              , String const& targetstate_)
          : def(def_), state(state_), targetstate(targetstate_) {}

        template <typename Component>
        bool operator()(Component const& component) const
        {
            component.collect(def, state, targetstate);
            return false;     // execute for all sequence elements
        }

        LexerDef& def;
        String const& state;
        String const& targetstate;

    private:
        // silence MSVC warning C4512: assignment operator could not be generated
        sequence_collect_function& operator= (sequence_collect_function const&);
    };

    template <typename LexerDef>
    struct sequence_add_actions_function
    {
        sequence_add_actions_function(LexerDef& def_)
          : def(def_) {}

        template <typename Component>
        bool operator()(Component const& component) const
        {
            component.add_actions(def);
            return false;     // execute for all sequence elements
        }

        LexerDef& def;

    private:
        // silence MSVC warning C4512: assignment operator could not be generated
        sequence_add_actions_function& operator= (sequence_add_actions_function const&);
    };

}}}}

#endif