/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_SPIRIT_NONTERMINAL_FEB_19_2007_0236PM) #define BOOST_SPIRIT_NONTERMINAL_FEB_19_2007_0236PM #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace spirit { namespace qi { template struct nonterminal : proto::extends< typename make_nonterminal_holder< Derived const*, Derived >::type , Derived > { typedef Sig sig_type; typedef typename function_types::result_type::type attr_type_; // This is the nonterminal return type typedef typename mpl::if_< is_same , unused_type , attr_type_ >::type attr_type; typedef typename add_reference::type attr_reference_type; // param_types is a sequence of types passed as parameters to the nonterminal typedef typename function_types::parameter_types::type param_types; // locals_type is a sequence of types to be used as local variables typedef typename fusion::result_of::as_vector::type locals_type; // The overall context_type consist of a tuple with: // 1) a tuple of the return value and parameters // 2) the locals typedef fusion::vector< typename fusion::result_of::as_vector< fusion::joint_view< fusion::single_view , param_types > >::type , typename fusion::result_of::as_vector::type > context_type; typedef nonterminal self_type; typedef nonterminal_holder nonterminal_holder_; typedef typename proto::terminal::type nonterminal_tag; typedef proto::extends base_type; explicit nonterminal() : base_type(make_tag()) { } // bring in the operator() overloads #include private: nonterminal_tag make_tag() const { nonterminal_tag xpr = {{static_cast(this)}}; return xpr; } }; template struct make_nonterminal { typedef mpl::vector types; typedef function_types::is_function is_function; typedef spirit::detail::is_locals is_locals; typedef spirit::traits::is_component is_skipper; typedef typename mpl::find_if::type sig_; typedef typename mpl::find_if::type locals_; typedef typename mpl::find_if::type skipper_; typedef typename mpl::eval_if< is_same::type> , mpl::identity , mpl::deref >::type sig_type; typedef typename mpl::eval_if< is_same::type> , mpl::identity > , mpl::deref >::type locals_type; typedef typename mpl::eval_if< is_same::type> , mpl::identity , mpl::deref >::type skipper_type; typedef nonterminal type; }; }}} #endif