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