1 | /*============================================================================= |
---|
2 | Copyright (c) 2002-2003 Joel de Guzman |
---|
3 | Copyright (c) 2002-2003 Hartmut Kaiser |
---|
4 | http://spirit.sourceforge.net/ |
---|
5 | |
---|
6 | Use, modification and distribution is subject to the Boost Software |
---|
7 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
8 | http://www.boost.org/LICENSE_1_0.txt) |
---|
9 | =============================================================================*/ |
---|
10 | #if !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_HPP) |
---|
11 | #define BOOST_SPIRIT_CLOSURE_CONTEXT_HPP |
---|
12 | |
---|
13 | /////////////////////////////////////////////////////////////////////////////// |
---|
14 | namespace boost { namespace spirit { |
---|
15 | |
---|
16 | #if !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) |
---|
17 | #define BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED |
---|
18 | |
---|
19 | /////////////////////////////////////////////////////////////////////////////// |
---|
20 | // |
---|
21 | // closure_context_linker |
---|
22 | // { helper template for the closure extendability } |
---|
23 | // |
---|
24 | // This classes can be 'overloaded' (defined elsewhere), to plug |
---|
25 | // in additional functionality into the closure parsing process. |
---|
26 | // |
---|
27 | /////////////////////////////////////////////////////////////////////////////// |
---|
28 | |
---|
29 | template<typename ContextT> |
---|
30 | struct closure_context_linker : public ContextT |
---|
31 | { |
---|
32 | template <typename ParserT> |
---|
33 | closure_context_linker(ParserT const& p) |
---|
34 | : ContextT(p) {} |
---|
35 | |
---|
36 | template <typename ParserT, typename ScannerT> |
---|
37 | void pre_parse(ParserT const& p, ScannerT const& scan) |
---|
38 | { ContextT::pre_parse(p, scan); } |
---|
39 | |
---|
40 | template <typename ResultT, typename ParserT, typename ScannerT> |
---|
41 | ResultT& |
---|
42 | post_parse(ResultT& hit, ParserT const& p, ScannerT const& scan) |
---|
43 | { return ContextT::post_parse(hit, p, scan); } |
---|
44 | }; |
---|
45 | |
---|
46 | #endif // !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) |
---|
47 | |
---|
48 | /////////////////////////////////////////////////////////////////////////////// |
---|
49 | }} // namespace boost::spirit |
---|
50 | |
---|
51 | #endif // BOOST_SPIRIT_CLOSURE_CONTEXT_HPP |
---|