12 Jan 07:45
proto breaking changes (and patch for spirit2)
From: Eric Niebler <eric <at> boost-consulting.com>
Subject: proto breaking changes (and patch for spirit2)
Newsgroups: gmane.comp.parsers.spirit.devel
Date: 2008-01-12 06:48:31 GMT
Subject: proto breaking changes (and patch for spirit2)
Newsgroups: gmane.comp.parsers.spirit.devel
Date: 2008-01-12 06:48:31 GMT
I've committed to boost svn head a new version of proto with improved transforms. This is a breaking change. There isn't documentation yet for the new transforms, so I made a patch that gets Spirit-2 working again. (At least, it works with msvc, but there appear to be other problems with spirit-2 and gcc which are unrelated.) Patch attached. Cheers, -- Eric Niebler Boost Consulting www.boost-consulting.com
Index: boost/spirit/lex/lexer/meta_grammar.hpp
===================================================================
--- boost/spirit/lex/lexer/meta_grammar.hpp (revision 785)
+++ boost/spirit/lex/lexer/meta_grammar.hpp (working copy)
@@ -99,11 +99,11 @@
// semantic actions for tokens
meta_grammar::binary_rule<
lex::domain, proto::tag::subscript, action,
- token_def_meta_grammar, proto::transform::arg<proto::_>
+ token_def_meta_grammar, proto::when<proto::_, proto::_arg>
>,
meta_grammar::binary_rule<
lex::domain, proto::tag::subscript, action,
- action_lexer_meta_grammar, proto::transform::arg<proto::_>
+ action_lexer_meta_grammar, proto::when<proto::_, proto::_arg>
>
>
{
Index: boost/spirit/lex/meta_grammar.hpp
===================================================================
--- boost/spirit/lex/meta_grammar.hpp (revision 785)
+++ boost/spirit/lex/meta_grammar.hpp (working copy)
@@ -29,8 +29,8 @@
struct main_meta_grammar
: meta_grammar::if_transform<
- is_valid_expr<mpl::_>,
- expr_transform<mpl::_>
+ is_valid_expr<proto::_>(),
+ expr_transform<proto::_>
>
{
};
Index: boost/spirit/qi/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/meta_grammar.hpp (working copy)
@@ -25,8 +25,8 @@
struct main_meta_grammar
: meta_grammar::if_transform<
- is_valid_expr<mpl::_>
- , expr_transform<mpl::_>
+ is_valid_expr<proto::_>()
+ , expr_transform<proto::_>
>
{
};
Index: boost/spirit/qi/binary/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/binary/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/binary/meta_grammar.hpp (working copy)
@@ -197,7 +197,7 @@
struct int_binary_meta_grammar
: meta_grammar::compose_empty<
proto::if_<
- is_int_lit_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_int_lit_tag<proto::_arg, qi::domain>()
>,
qi::domain,
mpl::identity<extract_literal_bin_director<mpl::_> >
@@ -209,7 +209,7 @@
: proto::or_<
meta_grammar::compose_empty<
proto::if_<
- is_binary_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_binary_tag<proto::_arg, qi::domain>()
>,
qi::domain,
mpl::identity<extract_binary_director<mpl::_> >
@@ -217,7 +217,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_binary_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_binary_tag<proto::_arg, qi::domain>()
>,
int_binary_meta_grammar
>,
Index: boost/spirit/qi/stream/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/stream/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/stream/meta_grammar.hpp (working copy)
@@ -95,7 +95,7 @@
// stream, wstream
meta_grammar::compose_empty<
proto::if_<
- is_stream_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_stream_tag<proto::_arg, qi::domain>()
>,
qi::domain,
mpl::identity<extract_stream_director<mpl::_> >
Index: boost/spirit/qi/numeric/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/numeric/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/numeric/meta_grammar.hpp (working copy)
@@ -271,7 +271,7 @@
///////////////////////////////////////////////////////////////////////////
struct int_meta_grammar
: meta_grammar::compose_empty<
- proto::if_<is_int_tag<proto::result_of::arg<mpl::_>, qi::domain> >
+ proto::if_<is_int_tag<proto::_arg, qi::domain>()>
, qi::domain
, mpl::identity<extract_int_director<mpl::_> >
>
@@ -279,7 +279,7 @@
struct real_meta_grammar
: meta_grammar::compose_single<
- proto::if_<is_real_tag<proto::result_of::arg<mpl::_>, qi::domain> >
+ proto::if_<is_real_tag<proto::_arg, qi::domain>()>
, qi::domain
, mpl::identity<extract_real_director<mpl::_> >
>
Index: boost/spirit/qi/string/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/string/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/string/meta_grammar.hpp (working copy)
@@ -159,7 +159,7 @@
, meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_lit_tag<proto::result_of::arg<mpl::_>, qi::domain> >
+ is_lit_tag<proto::_arg, qi::domain>()>
, proto::or_<basic_string_literal_meta_grammar, basic_std_string_meta_grammar>
>
, qi::domain
@@ -170,7 +170,7 @@
, tag::lit
, lazy_string
, proto::if_<
- detail::is_not_convertible_to_int<proto::result_of::arg<mpl::_> > >
+ detail::is_not_convertible_to_int<proto::_arg >() >
>
, meta_grammar::terminal_rule<
qi::domain
Index: boost/spirit/qi/action/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/action/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/action/meta_grammar.hpp (working copy)
@@ -31,7 +31,7 @@
struct action_meta_grammar :
meta_grammar::binary_rule<
qi::domain, proto::tag::subscript, action
- , main_meta_grammar, proto::transform::arg<proto::_>
+ , main_meta_grammar, proto::when<proto::_, proto::_arg>
>
{
};
Index: boost/spirit/qi/char/meta_grammar.hpp
===================================================================
--- boost/spirit/qi/char/meta_grammar.hpp (revision 785)
+++ boost/spirit/qi/char/meta_grammar.hpp (working copy)
@@ -148,7 +148,7 @@
: proto::or_<
meta_grammar::compose_empty<
proto::if_<
- is_char_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_char_tag<proto::_arg, qi::domain>()
>
, qi::domain
, mpl::identity<extract_any_char_director<mpl::_> >
@@ -156,7 +156,7 @@
, meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_char_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_char_tag<proto::_arg, qi::domain>()
>
, basic_char_literal_meta_grammar
>
@@ -166,7 +166,7 @@
, meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_lit_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_lit_tag<proto::_arg, qi::domain>()
>
, basic_char_literal_meta_grammar
>
@@ -181,7 +181,7 @@
, meta_grammar::compose_function2_eval<
proto::function<
proto::if_<
- is_char_tag<proto::result_of::arg<mpl::_>, qi::domain>
+ is_char_tag<proto::_arg, qi::domain>()
>
, basic_char_literal_meta_grammar
, basic_char_literal_meta_grammar
Index: boost/spirit/karma/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/meta_grammar.hpp (working copy)
@@ -29,8 +29,8 @@
struct main_meta_grammar
: meta_grammar::if_transform<
- is_valid_expr<mpl::_>,
- expr_transform<mpl::_>
+ is_valid_expr<proto::_>(),
+ expr_transform<proto::_>
>
{
};
Index: boost/spirit/karma/binary/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/binary/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/binary/meta_grammar.hpp (working copy)
@@ -197,7 +197,7 @@
struct int_binary_meta_grammar
: meta_grammar::compose_empty<
proto::if_<
- is_int_lit_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_int_lit_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_literal_bin_director<mpl::_> >
@@ -209,7 +209,7 @@
: proto::or_<
meta_grammar::compose_empty<
proto::if_<
- is_binary_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_binary_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_binary_director<mpl::_> >
@@ -217,7 +217,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_binary_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_binary_tag<proto::_arg, karma::domain>()
>,
int_binary_meta_grammar
>,
Index: boost/spirit/karma/stream/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/stream/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/stream/meta_grammar.hpp (working copy)
@@ -75,7 +75,7 @@
// stream, wstream
meta_grammar::compose_empty<
proto::if_<
- is_stream_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_stream_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_any_stream_director<mpl::_> >
@@ -84,7 +84,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_stream_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_stream_tag<proto::_arg, karma::domain>()
>,
proto::_
>,
Index: boost/spirit/karma/numeric/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/numeric/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/numeric/meta_grammar.hpp (working copy)
@@ -359,7 +359,7 @@
struct int_literal_meta_grammar
: meta_grammar::compose_empty<
proto::if_<
- is_int_lit_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_int_lit_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_literal_int_director<mpl::_> >
@@ -372,7 +372,7 @@
: proto::or_<
meta_grammar::compose_empty<
proto::if_<
- is_int_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_int_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_int_director_plain<mpl::_> >
@@ -380,7 +380,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_int_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_int_tag<proto::_arg, karma::domain>()
>,
int_literal_meta_grammar
>,
@@ -394,7 +394,7 @@
struct real_literal_meta_grammar
: meta_grammar::compose_empty<
proto::if_<
- is_real_lit_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_real_lit_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_literal_real_director<mpl::_> >
@@ -405,7 +405,7 @@
: proto::or_<
meta_grammar::compose_single<
proto::if_<
- is_real_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_real_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_real_director_plain<mpl::_> >
@@ -413,7 +413,7 @@
meta_grammar::compose_function1_full<
proto::function<
proto::if_<
- is_real_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_real_tag<proto::_arg, karma::domain>()
>,
real_literal_meta_grammar
>,
Index: boost/spirit/karma/string/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/string/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/string/meta_grammar.hpp (working copy)
@@ -185,7 +185,7 @@
std_string_meta_grammar,
meta_grammar::compose_empty<
proto::if_<
- is_lit_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_lit_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_lit_director_plain<mpl::_> >
@@ -193,7 +193,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_lit_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_lit_tag<proto::_arg, karma::domain>()
>,
proto::or_<
basic_string_literal_meta_grammar,
@@ -206,9 +206,7 @@
meta_grammar::function1_rule<
karma::domain, tag::lit, lazy_string,
proto::if_<
- detail::is_not_convertible_to_int<
- proto::result_of::arg<mpl::_>
- >
+ detail::is_not_convertible_to_int<proto::_arg>()
>
>
>
Index: boost/spirit/karma/action/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/action/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/action/meta_grammar.hpp (working copy)
@@ -35,7 +35,7 @@
struct action_meta_grammar :
meta_grammar::binary_rule<
karma::domain, proto::tag::subscript, action,
- main_meta_grammar, proto::transform::arg<proto::_>
+ main_meta_grammar, proto::when<proto::_, proto::_arg>
>
{
};
Index: boost/spirit/karma/char/meta_grammar.hpp
===================================================================
--- boost/spirit/karma/char/meta_grammar.hpp (revision 785)
+++ boost/spirit/karma/char/meta_grammar.hpp (working copy)
@@ -163,7 +163,7 @@
// char_, wchar, space
meta_grammar::compose_empty<
proto::if_<
- is_char_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_char_tag<proto::_arg, karma::domain>()
>,
karma::domain,
mpl::identity<extract_any_char_director<mpl::_> >
@@ -172,7 +172,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_char_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_char_tag<proto::_arg, karma::domain>()
>,
basic_char_literal_meta_grammar
>,
@@ -183,7 +183,7 @@
meta_grammar::compose_function1_eval<
proto::function<
proto::if_<
- is_lit_tag<proto::result_of::arg<mpl::_>, karma::domain>
+ is_lit_tag<proto::_arg, karma::domain>()
>,
basic_char_literal_meta_grammar
>,
Index: boost/spirit/support/component.hpp
===================================================================
--- boost/spirit/support/component.hpp (revision 785)
+++ boost/spirit/support/component.hpp (working copy)
@@ -200,8 +200,8 @@
typedef typename proto::result_of::as_expr<Expr>::type proto_xpr;
typedef typename
- grammar::template apply<
- proto_xpr, State, Visitor
+ grammar::template result<
+ void(proto_xpr, State, Visitor)
>::type
type;
};
@@ -216,8 +216,8 @@
typedef typename proto::result_of::as_expr<T const*>::type proto_xpr;
typedef typename
- grammar::template apply<
- proto_xpr, State, Visitor
+ grammar::template result<
+ void(proto_xpr, State, Visitor)
>::type
type;
};
@@ -234,8 +234,9 @@
inline typename result_of::as_component<Domain, Expr>::type
as_component(Domain, Expr const& xpr)
{
+ unused_type unused;
typedef typename result_of::as_component<Domain, Expr>::grammar grammar;
- return grammar::call(proto::as_expr(xpr), unused, unused);
+ return grammar()(proto::as_expr(xpr), unused, unused);
};
template <typename Domain, typename Expr, typename State, typename Visitor>
@@ -245,7 +246,7 @@
typedef typename
result_of::as_component<Domain, Expr, State, Visitor>::grammar
grammar;
- return grammar::call(proto::as_expr(xpr), state, visitor);
+ return grammar()(proto::as_expr(xpr), state, visitor);
};
template <typename Domain, typename Director, typename Elements>
Index: boost/spirit/support/meta_grammar/basic_rules.hpp
===================================================================
--- boost/spirit/support/meta_grammar/basic_rules.hpp (revision 785)
+++ boost/spirit/support/meta_grammar/basic_rules.hpp (working copy)
@@ -10,9 +10,9 @@
#include <boost/spirit/support/meta_grammar/grammar.hpp>
#include <boost/spirit/support/meta_grammar/basic_transforms.hpp>
#include <boost/spirit/support/component.hpp>
+#include <boost/fusion/include/cons.hpp>
#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/transform/list.hpp>
-#include <boost/xpressive/proto/transform/fold_tree.hpp>
+#include <boost/xpressive/proto/transform.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace spirit { namespace meta_grammar
@@ -168,10 +168,13 @@
>
struct binary_rule_flat
: compose_list<
- proto::transform::reverse_fold_tree<
- Tag
- , proto::transform::list<Grammar>
- , fusion::nil
+ proto::when<
+ proto::binary_expr<Tag, Grammar, Grammar>
+ , proto::reverse_fold_tree<
+ proto::_
+ , fusion::nil()
+ , fusion::cons<Grammar, proto::_state>(Grammar, proto::_state)
+ >
>
, Domain
, Director
@@ -225,12 +228,9 @@
template <typename Tag, typename SubjectGrammar = proto::_>
struct deep_directive_meta_grammar
: meta_grammar::compose_deep_directive<
- proto::transform::arg_c<
- proto::subscript<
- proto::terminal<Tag>
- , SubjectGrammar
- >
- , 1
+ proto::when<
+ proto::subscript<proto::terminal<Tag>, SubjectGrammar>
+ , proto::call<SubjectGrammar(proto::_right)>
>
>
{};
Index: boost/spirit/support/meta_grammar/basic_transforms.hpp
===================================================================
--- boost/spirit/support/meta_grammar/basic_transforms.hpp (revision 785)
+++ boost/spirit/support/meta_grammar/basic_transforms.hpp (working copy)
@@ -13,7 +13,7 @@
#include <boost/spirit/support/modifier.hpp>
#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/transform/arg.hpp>
+#include <boost/xpressive/proto/transform.hpp>
#include <boost/fusion/include/cons.hpp>
#include <boost/fusion/include/list.hpp>
@@ -39,12 +39,15 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_empty : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename proto::result_of::arg<Expr>::type arg_type;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply1<DirectorF, arg_type>::type
@@ -57,10 +60,10 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(fusion::nil());
}
};
@@ -79,16 +82,19 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_single : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
proto::result_of::arg<
- typename Grammar::template apply<Expr, State, Visitor>::type
+ typename Grammar::template result<void(Expr, State, Visitor)>::type
>::type
arg_type;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply1<DirectorF, arg_type>::type
@@ -101,13 +107,13 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(
fusion::make_cons(
- proto::arg(Grammar::call(expr, state, visitor))
+ proto::arg(Grammar()(expr, state, visitor))
)
);
}
@@ -127,11 +133,14 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_double : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
- Grammar::template apply<Expr, State, Visitor>::type
+ Grammar::template result<void(Expr, State, Visitor)>::type
trans;
typedef typename proto::result_of::left<trans>::type left_type;
@@ -140,7 +149,7 @@
fusion::result_of::make_list<left_type, right_type>::type
list_type;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply1<DirectorF, list_type>::type
@@ -153,14 +162,14 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef apply<Expr, State, Visitor> apply;
+ typedef result<void(Expr, State, Visitor)> apply;
typedef typename apply::make_component result;
typedef typename apply::list_type list_type;
- typename apply::trans trans = Grammar::call(expr, state, visitor);
+ typename apply::trans trans = Grammar()(expr, state, visitor);
return result::call(
fusion::make_list(proto::left(trans), proto::right(trans))
);
@@ -182,11 +191,14 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_triple : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
- Grammar::template apply<Expr, State, Visitor>::type
+ Grammar::template result<void(Expr, State, Visitor)>::type
trans;
typedef typename proto::result_of::arg_c<trans, 0>::type arg0_type;
@@ -197,7 +209,7 @@
fusion::result_of::make_list<arg0_type, arg1_type, arg2_type>::type
list_type;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply1<DirectorF, list_type>::type
@@ -210,14 +222,14 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef apply<Expr, State, Visitor> apply;
+ typedef result<void(Expr, State, Visitor)> apply;
typedef typename apply::make_component result;
typedef typename apply::list_type list_type;
- typename apply::trans trans = Grammar::call(expr, state, visitor);
+ typename apply::trans trans = Grammar()(expr, state, visitor);
return result::call(
fusion::make_list(proto::arg_c<0>(trans), proto::arg_c<1>(trans), proto::arg_c<2>(trans))
);
@@ -239,11 +251,14 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_right : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
- Grammar::template apply<Expr, State, Visitor>::type
+ Grammar::template result<void(Expr, State, Visitor)>::type
trans;
typedef typename proto::result_of::right<trans>::type right_type;
@@ -251,7 +266,7 @@
fusion::result_of::make_list<right_type>::type
list_type;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply1<DirectorF, list_type>::type
@@ -264,14 +279,14 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef apply<Expr, State, Visitor> apply;
+ typedef result<void(Expr, State, Visitor)> apply;
typedef typename apply::make_component result;
typedef typename apply::list_type list_type;
- typename apply::trans trans = Grammar::call(expr, state, visitor);
+ typename apply::trans trans = Grammar()(expr, state, visitor);
return result::call(
fusion::make_list(proto::right(trans))
);
@@ -283,22 +298,9 @@
// applies a supplied indirect transform if the predicate is true.
///////////////////////////////////////////////////////////////////////////
template <typename Pred, typename TransformF>
- struct if_transform : proto::if_<Pred>
+ struct if_transform
+ : proto::when<proto::if_<Pred>, proto::bind<TransformF> >
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
- {
- typedef typename mpl::apply1<TransformF, Expr>::type transform;
- typedef typename transform::template apply<Expr, State, Visitor>::type type;
- };
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
- {
- typedef typename mpl::apply1<TransformF, Expr>::type transform;
- return transform::call(expr, state, visitor);
- }
};
///////////////////////////////////////////////////////////////////////////
@@ -307,14 +309,17 @@
template <typename Grammar, typename Domain, typename Director>
struct compose_list : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
- typedef typename
+ typedef
traits::make_component<
Domain, Director
, typename Grammar::template
- apply<Expr, State, Visitor>::type
+ result<void(Expr, State, Visitor)>::type
, Visitor
>
make_component;
@@ -323,11 +328,11 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
- return result::call(Grammar::call(expr, state, visitor));
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
+ return result::call(Grammar()(expr, state, visitor));
}
};
@@ -338,8 +343,11 @@
template <typename Grammar, typename Domain, typename Director>
struct compose_function1 : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
proto::result_of::arg<
@@ -347,7 +355,7 @@
>::type
arg1;
- typedef typename
+ typedef
traits::make_component<
Domain, Director
, typename fusion::result_of::make_cons<arg1>::type
@@ -359,10 +367,10 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(fusion::make_cons(proto::arg(proto::arg_c<1>(expr))));
}
};
@@ -372,8 +380,11 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_function1_eval : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
proto::result_of::arg<
@@ -386,7 +397,7 @@
>::type
arg1;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply2<DirectorF, function, arg1>::type
@@ -399,10 +410,10 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(
fusion::make_cons(proto::arg(proto::arg_c<1>(expr))));
}
@@ -413,8 +424,11 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_function1_full : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
proto::result_of::arg<
@@ -427,7 +441,7 @@
>::type
arg1;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply2<DirectorF, function, arg1>::type
@@ -440,10 +454,10 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(fusion::make_list(
proto::arg(proto::arg_c<0>(expr)),
proto::arg(proto::arg_c<1>(expr))
@@ -458,8 +472,11 @@
template <typename Grammar, typename Domain, typename Director>
struct compose_function2 : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
proto::result_of::arg<
@@ -473,7 +490,7 @@
>::type
arg2;
- typedef typename
+ typedef
traits::make_component<
Domain, Director
, typename fusion::result_of::make_list<arg1, arg2>::type
@@ -485,10 +502,10 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(fusion::make_list(
proto::arg(proto::arg_c<1>(expr))
, proto::arg(proto::arg_c<2>(expr))
@@ -501,8 +518,11 @@
template <typename Grammar, typename Domain, typename DirectorF>
struct compose_function2_eval : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
proto::result_of::arg<
@@ -520,7 +540,7 @@
>::type
arg2;
- typedef typename
+ typedef
traits::make_component<
Domain
, typename mpl::apply2<DirectorF, function, arg1>::type
@@ -533,10 +553,10 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef typename apply<Expr, State, Visitor>::make_component result;
+ typedef typename result<void(Expr, State, Visitor)>::make_component result;
return result::call(fusion::make_list(
proto::arg(proto::arg_c<1>(expr))
, proto::arg(proto::arg_c<2>(expr))
@@ -551,8 +571,11 @@
template <typename Grammar>
struct compose_deep_directive : Grammar
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef typename
add_modifier<
@@ -564,13 +587,13 @@
modifier_type;
typedef typename
- Grammar::template apply<Expr, State, modifier_type>::type
+ Grammar::template result<void(Expr, State, modifier_type)>::type
type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor&)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor&) const
{
typename add_modifier<
Visitor
@@ -579,7 +602,7 @@
>::type
>::type
modifier;
- return Grammar::call(expr, state, modifier);
+ return Grammar()(expr, state, modifier);
}
};
@@ -594,13 +617,16 @@
template <typename Grammar, typename Domain, typename Director>
struct compose_subscript : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
// apply all grammar transformations mandated for the whole
// expression
typedef typename
- Grammar::template apply<Expr, State, Visitor>::type
+ Grammar::template result<void(Expr, State, Visitor)>::type
trans;
// this calculates the type of the directive
@@ -612,7 +638,7 @@
// this is the type of the contained data
typedef fusion::list<embedded, directive> list_type;
- typedef typename
+ typedef
traits::make_component<Domain, Director, list_type, Visitor>
make_component;
@@ -620,14 +646,14 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef apply<Expr, State, Visitor> apply;
+ typedef result<void(Expr, State, Visitor)> apply;
typedef typename apply::make_component result;
typedef typename apply::list_type list_type;
- typename apply::trans trans = Grammar::call(expr, state, visitor);
-
+ typename apply::trans trans = Grammar()(expr, state, visitor);
+
return result::call(
list_type(proto::arg_c<1>(trans), proto::arg_c<0>(trans)));
}
@@ -644,13 +670,16 @@
template <typename Grammar, typename Domain, typename Director>
struct compose_subscript_function1 : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
// apply all grammar transformations mandated for the whole
// expression
typedef typename
- Grammar::template apply<Expr, State, Visitor>::type
+ Grammar::template result<void(Expr, State, Visitor)>::type
trans;
// this calculates the type of the embedded expression
@@ -662,11 +691,11 @@
typename proto::result_of::arg_c<trans, 0>::type, 1
>::type
arg1;
-
+
// this is the type of the contained data
typedef fusion::list<embedded, arg1> list_type;
- typedef typename
+ typedef
traits::make_component<
Domain, Director,
list_type,
@@ -678,14 +707,14 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef apply<Expr, State, Visitor> apply;
+ typedef result<void(Expr, State, Visitor)> apply;
typedef typename apply::make_component result;
typedef typename apply::list_type list_type;
- typename apply::trans trans = Grammar::call(expr, state, visitor);
-
+ typename apply::trans trans = Grammar()(expr, state, visitor);
+
return result::call(list_type(
proto::arg_c<1>(trans),
proto::arg_c<1>(proto::arg_c<0>(trans))));
@@ -703,13 +732,16 @@
template <typename Grammar, typename Domain, typename Director>
struct compose_subscript_function2 : Grammar
{
- template <typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
// apply all grammar transformations mandated for the whole
// expression
typedef typename
- Grammar::template apply<Expr, State, Visitor>::type
+ Grammar::template result<void(Expr, State, Visitor)>::type
trans;
// this calculates the types of the arguments of the function
@@ -721,7 +753,7 @@
typedef typename proto::result_of::arg_c<trans, 1>::type embedded;
typedef fusion::list<embedded, arg1, arg2> list_type;
- typedef typename
+ typedef
traits::make_component<
Domain, Director,
list_type,
@@ -733,13 +765,13 @@
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const& expr, State const& state, Visitor& visitor)
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const& expr, State const& state, Visitor& visitor) const
{
- typedef apply<Expr, State, Visitor> apply;
+ typedef result<void(Expr, State, Visitor)> apply;
typedef typename apply::make_component result;
typedef typename apply::list_type list_type;
- typename apply::trans trans = Grammar::call(expr, state, visitor);
+ typename apply::trans trans = Grammar()(expr, state, visitor);
typename apply::arg0 arg0 = proto::arg_c<0>(trans);
return result::call(list_type(
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________ Spirit-devel mailing list Spirit-devel <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spirit-devel
RSS Feed