1 /*============================================================================= 2 Copyright (c) 2005-2010 Joel de Guzman 3 Copyright (c) 2010 Eric Niebler 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 #ifndef BOOST_PHOENIX_CORE_DOMAIN_HPP 9 #define BOOST_PHOENIX_CORE_DOMAIN_HPP 10 11 #include <boost/phoenix/core/limits.hpp> 12 #include <boost/proto/matches.hpp> 13 #include <boost/proto/transform/call.hpp> 14 #include <boost/proto/transform/when.hpp> 15 #include <boost/proto/domain.hpp> 16 17 namespace boost { namespace phoenix 18 { 19 template <typename Expr> 20 struct actor; 21 22 struct meta_grammar; 23 24 struct phoenix_generator 25 : proto::switch_<phoenix_generator> 26 { 27 28 BOOST_PROTO_USE_BASIC_EXPR() 29 30 template<typename Tag> 31 struct case_ 32 : proto::otherwise<proto::call<proto::pod_generator<actor>(proto::_)> > 33 {}; 34 }; 35 36 // proto's assignment operator takes rhs by reference 37 template<> 38 struct phoenix_generator::case_<proto::tag::assign> 39 : proto::otherwise<proto::call<proto::compose_generators< 40 proto::by_value_generator 41 , proto::pod_generator<actor> 42 >(proto::_)> > 43 {}; 44 45 // proto's subscript operator takes rhs by reference 46 template<> 47 struct phoenix_generator::case_<proto::tag::subscript> 48 : proto::otherwise<proto::call<proto::compose_generators< 49 proto::by_value_generator 50 , proto::pod_generator<actor> 51 >(proto::_)> > 52 {}; 53 54 struct phoenix_default_domain 55 : proto::domain< 56 proto::basic_default_generator 57 , proto::_ 58 , proto::basic_default_domain 59 > 60 { 61 template <typename T> 62 struct as_child 63 //: proto_base_domain::as_expr<T> // proto lambda example. 64 : as_expr<T> 65 {}; 66 }; 67 68 struct phoenix_domain 69 : proto::domain< 70 phoenix_generator 71 , meta_grammar 72 , proto::basic_default_domain 73 > 74 { 75 template <typename T> 76 struct as_child 77 //: proto_base_domain::as_expr<T> // proto lambda example. 78 : as_expr<T> 79 {}; 80 }; 81 }} 82 83 #endif 84