1 /*============================================================================= 2 Copyright (c) 2009 Francois Barel 3 Copyright (c) 2001-2010 Joel de Guzman 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #if !defined(BOOST_SPIRIT_REPOSITORY_SUPPORT_SUBRULE_CONTEXT_AUGUST_12_2009_0539PM) 9 #define BOOST_SPIRIT_REPOSITORY_SUPPORT_SUBRULE_CONTEXT_AUGUST_12_2009_0539PM 10 11 #if defined(_MSC_VER) 12 #pragma once 13 #endif 14 15 #include <boost/spirit/home/support/context.hpp> 16 17 /////////////////////////////////////////////////////////////////////////////// 18 namespace boost { namespace spirit { namespace repository 19 { 20 /////////////////////////////////////////////////////////////////////////// 21 // subrule_context: special context used with subrules, to pass around 22 // the current set of subrule definitions (subrule_group) 23 /////////////////////////////////////////////////////////////////////////// 24 template <typename Group, typename Attributes, typename Locals> 25 struct subrule_context 26 : context<Attributes, Locals> 27 { 28 typedef context<Attributes, Locals> base_type; 29 typedef Group group_type; 30 subrule_contextboost::spirit::repository::subrule_context31 subrule_context( 32 Group const& group 33 , typename Attributes::car_type attribute 34 ) : base_type(attribute), group(group) 35 { 36 } 37 38 template <typename Args, typename Context> subrule_contextboost::spirit::repository::subrule_context39 subrule_context( 40 Group const& group 41 , typename Attributes::car_type attribute 42 , Args const& args 43 , Context& caller_context 44 ) : base_type(attribute, args, caller_context), group(group) 45 { 46 } 47 subrule_contextboost::spirit::repository::subrule_context48 subrule_context(Group const& group, Attributes const& attributes) 49 : base_type(attributes), group(group) 50 { 51 } 52 53 Group const& group; 54 }; 55 }}} 56 57 #endif 58