annotate DEPENDENCIES/generic/include/boost/phoenix/core/terminal.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /*==============================================================================
Chris@16 2 Copyright (c) 2005-2010 Joel de Guzman
Chris@16 3 Copyright (c) 2010 Thomas Heller
Chris@16 4
Chris@16 5 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 ==============================================================================*/
Chris@16 8 #ifndef BOOST_PHOENIX_CORE_TERMINAL_HPP
Chris@16 9 #define BOOST_PHOENIX_CORE_TERMINAL_HPP
Chris@16 10
Chris@16 11 #include <boost/phoenix/core/limits.hpp>
Chris@16 12 #include <boost/call_traits.hpp>
Chris@16 13 #include <boost/is_placeholder.hpp>
Chris@16 14 #include <boost/phoenix/core/actor.hpp>
Chris@16 15 #include <boost/phoenix/core/meta_grammar.hpp>
Chris@16 16 #include <boost/phoenix/core/terminal_fwd.hpp>
Chris@16 17 #include <boost/proto/matches.hpp>
Chris@16 18 #include <boost/proto/transform/lazy.hpp>
Chris@16 19 #include <boost/proto/functional/fusion/at.hpp>
Chris@16 20 #include <boost/type_traits/remove_pointer.hpp>
Chris@16 21
Chris@16 22 #define BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(Template, Terminal, IsNullary, EvalFun)\
Chris@16 23 namespace boost { namespace phoenix \
Chris@16 24 { \
Chris@16 25 namespace result_of \
Chris@16 26 { \
Chris@16 27 Template \
Chris@16 28 struct is_nullary< \
Chris@16 29 custom_terminal< \
Chris@16 30 Terminal \
Chris@16 31 > \
Chris@16 32 > \
Chris@16 33 : IsNullary \
Chris@16 34 {}; \
Chris@16 35 } \
Chris@16 36 Template \
Chris@16 37 struct is_custom_terminal<Terminal >: mpl::true_ {}; \
Chris@16 38 \
Chris@16 39 Template \
Chris@16 40 struct custom_terminal<Terminal > : proto::call<EvalFun > {}; \
Chris@16 41 }} \
Chris@16 42 /**/
Chris@16 43
Chris@16 44 namespace boost { namespace phoenix
Chris@16 45 {
Chris@16 46 template <typename T, typename Dummy>
Chris@16 47 struct is_custom_terminal
Chris@16 48 : mpl::false_ {};
Chris@16 49
Chris@16 50 template <typename T, typename Dummy>
Chris@16 51 struct custom_terminal;
Chris@101 52
Chris@101 53 namespace tag {
Chris@101 54 struct terminal /*: public proto::tag::terminal */ {};
Chris@101 55 }
Chris@16 56
Chris@16 57 namespace expression
Chris@16 58 {
Chris@16 59 template <typename T, template <typename> class Actor = actor>
Chris@16 60 struct terminal
Chris@16 61 : proto::terminal<
Chris@16 62 T//typename call_traits<T>::value_type
Chris@16 63 >
Chris@16 64 {
Chris@16 65 typedef
Chris@16 66 proto::basic_expr<
Chris@101 67 proto::tag::terminal
Chris@101 68 // tag::terminal //cannot change to use phoenix tag - breaks code.
Chris@16 69 , proto::term<T>
Chris@16 70 , 0
Chris@16 71 >
Chris@16 72 base_type;
Chris@16 73 typedef Actor<base_type> type;
Chris@16 74
Chris@16 75 static const type make(typename call_traits<T>::param_type t)
Chris@16 76 {
Chris@101 77 // ?? Should the next line be Actor not actor which is the default?
Chris@16 78 actor<base_type> const e = {base_type::make(t)};
Chris@101 79 //Actor<base_type> const e = {base_type::make(t)};
Chris@16 80 return e;
Chris@16 81 }
Chris@16 82 };
Chris@16 83 }
Chris@16 84
Chris@16 85 namespace rule
Chris@16 86 {
Chris@16 87 struct argument
Chris@16 88 : proto::if_<boost::is_placeholder<proto::_value>()>
Chris@16 89 {};
Chris@16 90
Chris@16 91 struct custom_terminal
Chris@16 92 : proto::if_<boost::phoenix::is_custom_terminal<proto::_value>()>
Chris@16 93 {};
Chris@16 94
Chris@16 95 struct terminal
Chris@16 96 : proto::terminal<proto::_>
Chris@16 97 {};
Chris@16 98 }
Chris@16 99
Chris@16 100 template <typename Dummy>
Chris@16 101 struct meta_grammar::case_<proto::tag::terminal, Dummy>
Chris@16 102 : proto::or_<
Chris@16 103 enable_rule<rule::argument , Dummy>
Chris@16 104 , enable_rule<rule::custom_terminal, Dummy>
Chris@16 105 , enable_rule<rule::terminal , Dummy>
Chris@16 106 >
Chris@16 107 {};
Chris@16 108
Chris@16 109 template <typename Dummy>
Chris@16 110 struct default_actions::when<rule::custom_terminal, Dummy>
Chris@16 111 : proto::lazy<
Chris@16 112 custom_terminal<proto::_value>(
Chris@16 113 proto::_value
Chris@16 114 , _context
Chris@16 115 )
Chris@16 116 >
Chris@16 117 {};
Chris@16 118
Chris@16 119 namespace detail
Chris@16 120 {
Chris@16 121 template <typename N>
Chris@16 122 struct placeholder_idx
Chris@16 123 : mpl::int_<N::value>
Chris@16 124 {};
Chris@16 125 }
Chris@16 126
Chris@16 127 template <typename Grammar>
Chris@16 128 struct default_actions::when<rule::argument, Grammar>
Chris@16 129 : proto::call<
Chris@16 130 proto::functional::at(
Chris@16 131 _env
Chris@16 132 , proto::make<
Chris@16 133 detail::placeholder_idx<
Chris@16 134 proto::make<
Chris@16 135 boost::is_placeholder<proto::_value>()
Chris@16 136 >
Chris@16 137 >()
Chris@16 138 >
Chris@16 139 )
Chris@16 140 >
Chris@16 141 {};
Chris@16 142 }}
Chris@16 143
Chris@16 144 #endif