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