Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-01-15 01:46:44


Author: eric_niebler
Date: 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
New Revision: 42788
URL: http://svn.boost.org/trac/boost/changeset/42788

Log:
code clean-up, begin updating the transform section in proto's docs
Text files modified:
   trunk/boost/xpressive/proto/debug.hpp | 4
   trunk/boost/xpressive/proto/deep_copy.hpp | 2
   trunk/boost/xpressive/proto/detail/funop.hpp | 2
   trunk/boost/xpressive/proto/expr.hpp | 40
   trunk/boost/xpressive/proto/generate.hpp | 8
   trunk/boost/xpressive/proto/make_expr.hpp | 8
   trunk/boost/xpressive/proto/matches.hpp | 71 +-
   trunk/boost/xpressive/proto/operators.hpp | 28
   trunk/boost/xpressive/proto/proto_fwd.hpp | 91 +-
   trunk/boost/xpressive/proto/traits.hpp | 58 +-
   trunk/boost/xpressive/proto/transform/arg.hpp | 62 +
   trunk/boost/xpressive/proto/transform/make.hpp | 18
   trunk/boost/xpressive/proto/transform/pass_through.hpp | 45 -
   trunk/libs/xpressive/doc/acknowledgements.qbk | 2
   trunk/libs/xpressive/doc/actions.qbk | 2
   trunk/libs/xpressive/doc/concepts.qbk | 2
   trunk/libs/xpressive/doc/dynamic_regexes.qbk | 2
   trunk/libs/xpressive/doc/examples.qbk | 2
   trunk/libs/xpressive/doc/grammars.qbk | 2
   trunk/libs/xpressive/doc/history.qbk | 2
   trunk/libs/xpressive/doc/installation.qbk | 2
   trunk/libs/xpressive/doc/introduction.qbk | 2
   trunk/libs/xpressive/doc/matching.qbk | 2
   trunk/libs/xpressive/doc/nyi.qbk | 2
   trunk/libs/xpressive/doc/perf.qbk | 2
   trunk/libs/xpressive/doc/preface.qbk | 2
   trunk/libs/xpressive/doc/quick_start.qbk | 2
   trunk/libs/xpressive/doc/regexpp_diffs.qbk | 2
   trunk/libs/xpressive/doc/results.qbk | 2
   trunk/libs/xpressive/doc/static_regexes.qbk | 2
   trunk/libs/xpressive/doc/substitutions.qbk | 2
   trunk/libs/xpressive/doc/tips_n_tricks.qbk | 2
   trunk/libs/xpressive/doc/tokenization.qbk | 2
   trunk/libs/xpressive/doc/traits.qbk | 2
   trunk/libs/xpressive/doc/xpressive.qbk | 2
   trunk/libs/xpressive/proto/doc/Jamfile.v2 | 16
   trunk/libs/xpressive/proto/doc/acknowledgements.qbk | 2
   trunk/libs/xpressive/proto/doc/calculator.qbk | 4
   trunk/libs/xpressive/proto/doc/examples.qbk | 2
   trunk/libs/xpressive/proto/doc/extensibility.qbk | 2
   trunk/libs/xpressive/proto/doc/grammars.qbk | 30
   trunk/libs/xpressive/proto/doc/history.qbk | 7
   trunk/libs/xpressive/proto/doc/implementation.qbk | 2
   trunk/libs/xpressive/proto/doc/installation.qbk | 12
   trunk/libs/xpressive/proto/doc/preface.qbk | 5
   trunk/libs/xpressive/proto/doc/proto.qbk | 7
   trunk/libs/xpressive/proto/doc/quick_start.qbk | 2
   trunk/libs/xpressive/proto/doc/rationale.qbk | 2
   trunk/libs/xpressive/proto/doc/transforms.qbk | 1081 ++++++++++++++++-----------------------
   trunk/libs/xpressive/proto/example/calc3.cpp | 17
   trunk/libs/xpressive/proto/example/mixed.cpp | 10
   trunk/libs/xpressive/proto/example/vec3.cpp | 9
   trunk/libs/xpressive/proto/test/examples.cpp | 46 +
   53 files changed, 764 insertions(+), 973 deletions(-)

Modified: trunk/boost/xpressive/proto/debug.hpp
==============================================================================
--- trunk/boost/xpressive/proto/debug.hpp (original)
+++ trunk/boost/xpressive/proto/debug.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -127,7 +127,7 @@
             {}
 
             template<typename Args>
- void operator()(expr<tag::terminal, Args, 0> const &expr) const
+ void operator()(proto::expr<tag::terminal, Args, 0> const &expr) const
             {
                 this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ")
                     << "terminal(" << proto::arg(expr) << ")\n";
@@ -140,7 +140,7 @@
 
         #define BOOST_PP_LOCAL_MACRO(N) \
             template<typename Tag, typename Args> \
- void operator()(expr<Tag, Args, N> const &expr) const \
+ void operator()(proto::expr<Tag, Args, N> const &expr) const \
             { \
                 using namespace tag; \
                 this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ") \

Modified: trunk/boost/xpressive/proto/deep_copy.hpp
==============================================================================
--- trunk/boost/xpressive/proto/deep_copy.hpp (original)
+++ trunk/boost/xpressive/proto/deep_copy.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -98,7 +98,7 @@
             template<typename Expr>
             struct deep_copy_impl<Expr, N>
             {
- typedef expr<typename Expr::proto_tag, BOOST_PP_CAT(args, N)<
+ typedef proto::expr<typename Expr::proto_tag, BOOST_PP_CAT(args, N)<
                     BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
> > expr_type;
                 typedef typename Expr::proto_domain::template apply<expr_type>::type type;

Modified: trunk/boost/xpressive/proto/detail/funop.hpp
==============================================================================
--- trunk/boost/xpressive/proto/detail/funop.hpp (original)
+++ trunk/boost/xpressive/proto/detail/funop.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -13,7 +13,7 @@
     template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A)>
     struct BOOST_PP_CAT(funop, BOOST_PP_ITERATION())
     {
- typedef expr<
+ typedef proto::expr<
             tag::function
           , BOOST_PP_CAT(args, BOOST_PP_INC(BOOST_PP_ITERATION()))<
                 ref_<Expr>

Modified: trunk/boost/xpressive/proto/expr.hpp
==============================================================================
--- trunk/boost/xpressive/proto/expr.hpp (original)
+++ trunk/boost/xpressive/proto/expr.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -255,20 +255,20 @@
             /// \param a The rhs.
             /// \return A new \c expr\<\> node representing an assignment of \c a to \c *this.
             template<typename A>
- expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
+ proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
             operator =(A &a) const
             {
- expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
             operator =(A const &a) const
             {
- expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
@@ -276,20 +276,20 @@
             /// \overload
             ///
             template<typename A>
- expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
+ proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
             operator =(A &a)
             {
- expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
             operator =(A const &a)
             {
- expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
         #endif
@@ -299,20 +299,20 @@
             /// \param a The rhs.
             /// \return A new \c expr\<\> node representing \c *this subscripted with \c a.
             template<typename A>
- expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
+ proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
             operator [](A &a) const
             {
- expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
             operator [](A const &a) const
             {
- expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
@@ -320,20 +320,20 @@
             /// \overload
             ///
             template<typename A>
- expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
+ proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
             operator [](A &a)
             {
- expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
             operator [](A const &a)
             {
- expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
         #endif
@@ -349,20 +349,20 @@
             /// Function call
             ///
             /// \return A new \c expr\<\> node representing the function invocation of \c (*this)().
- expr<tag::function, args1<ref_<expr const> > > const
+ proto::expr<tag::function, args1<ref_<expr const> > > const
             operator ()() const
             {
- expr<tag::function, args1<ref_<expr const> > > that = {{*this}};
+ proto::expr<tag::function, args1<ref_<expr const> > > that = {{*this}};
                 return that;
             }
 
         #if IS_TERMINAL
             /// \overload
             ///
- expr<tag::function, args1<ref_<expr> > > const
+ proto::expr<tag::function, args1<ref_<expr> > > const
             operator ()()
             {
- expr<tag::function, args1<ref_<expr> > > that = {{*this}};
+ proto::expr<tag::function, args1<ref_<expr> > > that = {{*this}};
                 return that;
             }
         #endif

Modified: trunk/boost/xpressive/proto/generate.hpp
==============================================================================
--- trunk/boost/xpressive/proto/generate.hpp (original)
+++ trunk/boost/xpressive/proto/generate.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -45,7 +45,7 @@
             struct arity_;
 
             template<typename Tag, typename Args, long N>
- struct arity_<expr<Tag, Args, N> >
+ struct arity_<proto::expr<Tag, Args, N> >
               : mpl::long_<N>
             {};
 
@@ -53,7 +53,7 @@
             struct tag_;
 
             template<typename Tag, typename Args, long N>
- struct tag_<expr<Tag, Args, N> >
+ struct tag_<proto::expr<Tag, Args, N> >
             {
                 typedef Tag type;
             };
@@ -62,7 +62,7 @@
             struct args_;
 
             template<typename Tag, typename Args, long N>
- struct args_<expr<Tag, Args, N> >
+ struct args_<proto::expr<Tag, Args, N> >
             {
                 typedef Args type;
             };
@@ -163,7 +163,7 @@
             template<typename Expr>
             struct by_value_generator_<Expr, N>
             {
- typedef expr<
+ typedef proto::expr<
                     typename tag_<Expr>::type
                   , BOOST_PP_CAT(args, N)<
                         // typename result_of::unref<typename args_<Expr>::type::arg0>::type, ...

Modified: trunk/boost/xpressive/proto/make_expr.hpp
==============================================================================
--- trunk/boost/xpressive/proto/make_expr.hpp (original)
+++ trunk/boost/xpressive/proto/make_expr.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -379,7 +379,7 @@
             template<typename Domain, typename Sequence>
             struct unpack_expr_<tag::terminal, Domain, Sequence, 1u>
             {
- typedef expr<
+ typedef proto::expr<
                     tag::terminal
                   , args0<typename fusion_::result_of::value_at_c<Sequence, 0>::type>
> expr_type;
@@ -416,7 +416,7 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
             {
                 typedef typename add_reference<A>::type reference;
- typedef expr<tag::terminal, args0<reference> > expr_type;
+ typedef proto::expr<tag::terminal, args0<reference> > expr_type;
                 typedef typename Domain::template apply<expr_type>::type type;
 
                 static type const call(reference a)
@@ -695,7 +695,7 @@
         struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
             BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
         {
- typedef expr<
+ typedef proto::expr<
                 Tag
               , BOOST_PP_CAT(args, N)<BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_TYPE, (A, Domain)) >
> expr_type;
@@ -714,7 +714,7 @@
         template<typename Tag, typename Domain, typename Sequence>
         struct unpack_expr_<Tag, Domain, Sequence, N>
         {
- typedef expr<
+ typedef proto::expr<
                 Tag
               , BOOST_PP_CAT(args, N)<
                     BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_AT_TYPE, (Sequence const, Domain))

Modified: trunk/boost/xpressive/proto/matches.hpp
==============================================================================
--- trunk/boost/xpressive/proto/matches.hpp (original)
+++ trunk/boost/xpressive/proto/matches.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -64,7 +64,7 @@
             struct ignore;
 
             template<typename Expr, typename Grammar>
- struct matches_impl;
+ struct matches_;
 
             // and_ and or_ implementation
             template<bool B, typename Expr, typename G0>
@@ -149,13 +149,13 @@
 
             template<typename Args1, typename Args2, typename Back>
             struct vararg_matches<Args1, Args2, Back, true, true, typename Back::proto_is_vararg_>
- : matches_impl<expr<ignore, Args1, Args1::size>, expr<ignore, Args2, Args1::size> >
+ : matches_<proto::expr<ignore, Args1, Args1::size>, proto::expr<ignore, Args2, Args1::size> >
             {};
 
             template<typename Args1, typename Args2, typename Back>
             struct vararg_matches<Args1, Args2, Back, true, false, typename Back::proto_is_vararg_>
               : and2<
- matches_impl<expr<ignore, Args1, Args2::size>, expr<ignore, Args2, Args2::size> >::value
+ matches_<proto::expr<ignore, Args1, Args2::size>, proto::expr<ignore, Args2, Args2::size> >::value
                   , vararg_matches_impl<Args1, typename Back::proto_base_expr, Args2::size + 1, Args1::size>
>
             {};
@@ -286,55 +286,55 @@
               : is_convertible<T, U>
             {};
 
- // matches_impl
+ // matches_
             template<typename Expr, typename Grammar>
- struct matches_impl
+ struct matches_
               : mpl::false_
             {};
 
             template<typename Expr>
- struct matches_impl< Expr, proto::_ >
+ struct matches_< Expr, proto::_ >
               : mpl::true_
             {};
 
             template<typename Tag, typename Args1, long N1, typename Args2, long N2>
- struct matches_impl< expr<Tag, Args1, N1>, expr<Tag, Args2, N2> >
+ struct matches_< proto::expr<Tag, Args1, N1>, proto::expr<Tag, Args2, N2> >
               : vararg_matches< Args1, Args2, typename Args2::back_, (N1+2 > N2), (N2 > N1) >
             {};
 
             template<typename Tag, typename Args1, long N1, typename Args2, long N2>
- struct matches_impl< expr<Tag, Args1, N1>, expr<proto::_, Args2, N2> >
+ struct matches_< proto::expr<Tag, Args1, N1>, proto::expr<proto::_, Args2, N2> >
               : vararg_matches< Args1, Args2, typename Args2::back_, (N1+2 > N2), (N2 > N1) >
             {};
 
             template<typename Args1, typename Args2, long N2>
- struct matches_impl< expr<tag::terminal, Args1, 0>, expr<proto::_, Args2, N2> >
+ struct matches_< proto::expr<tag::terminal, Args1, 0>, proto::expr<proto::_, Args2, N2> >
               : mpl::false_
             {};
 
             template<typename Tag, typename Args1, typename Args2>
- struct matches_impl< expr<Tag, Args1, 1>, expr<Tag, Args2, 1> >
- : matches_impl<typename Args1::arg0::proto_base_expr, typename Args2::arg0::proto_base_expr>
+ struct matches_< proto::expr<Tag, Args1, 1>, proto::expr<Tag, Args2, 1> >
+ : matches_<typename Args1::arg0::proto_base_expr, typename Args2::arg0::proto_base_expr>
             {};
 
             template<typename Tag, typename Args1, typename Args2>
- struct matches_impl< expr<Tag, Args1, 1>, expr<proto::_, Args2, 1> >
- : matches_impl<typename Args1::arg0::proto_base_expr, typename Args2::arg0::proto_base_expr>
+ struct matches_< proto::expr<Tag, Args1, 1>, proto::expr<proto::_, Args2, 1> >
+ : matches_<typename Args1::arg0::proto_base_expr, typename Args2::arg0::proto_base_expr>
             {};
 
             template<typename Args1, typename Args2>
- struct matches_impl< expr<tag::terminal, Args1, 0>, expr<tag::terminal, Args2, 0> >
+ struct matches_< proto::expr<tag::terminal, Args1, 0>, proto::expr<tag::terminal, Args2, 0> >
               : terminal_matches<typename Args1::arg0, typename Args2::arg0>
             {};
 
         #define BOOST_PROTO_MATCHES_N_FUN(z, n, data)\
- matches_impl<\
+ matches_<\
                 typename Args1::BOOST_PP_CAT(arg, n)::proto_base_expr\
               , typename Args2::BOOST_PP_CAT(arg, n)::proto_base_expr\
>
 
         #define BOOST_PROTO_DEFINE_MATCHES(z, n, data)\
- matches_impl<\
+ matches_<\
                 typename Expr::proto_base_expr\
               , typename BOOST_PP_CAT(G, n)::proto_base_expr\
>
@@ -361,29 +361,29 @@
 
             // handle proto::if_
             template<typename Expr, typename If, typename Then, typename Else>
- struct matches_impl<Expr, proto::if_<If, Then, Else> >
+ struct matches_<Expr, proto::if_<If, Then, Else> >
               : mpl::eval_if<
                     typename when<_, If>::template result<void(Expr, mpl::void_, mpl::void_)>::type
- , matches_impl<Expr, typename Then::proto_base_expr>
- , matches_impl<Expr, typename Else::proto_base_expr>
+ , matches_<Expr, typename Then::proto_base_expr>
+ , matches_<Expr, typename Else::proto_base_expr>
>::type
             {};
 
             template<typename Expr, typename If>
- struct matches_impl<Expr, proto::if_<If> >
+ struct matches_<Expr, proto::if_<If> >
               : when<_, If>::template result<void(Expr, mpl::void_, mpl::void_)>::type
             {};
 
             // handle proto::not_
             template<typename Expr, typename Grammar>
- struct matches_impl<Expr, not_<Grammar> >
- : mpl::not_<matches_impl<Expr, typename Grammar::proto_base_expr> >
+ struct matches_<Expr, not_<Grammar> >
+ : mpl::not_<matches_<Expr, typename Grammar::proto_base_expr> >
             {};
 
             // handle proto::switch_
             template<typename Expr, typename Cases>
- struct matches_impl<Expr, switch_<Cases> >
- : matches_impl<
+ struct matches_<Expr, switch_<Cases> >
+ : matches_<
                     Expr
                   , typename Cases::template case_<typename Expr::proto_tag>::proto_base_expr
>
@@ -394,7 +394,7 @@
         {
             template<typename Expr, typename Grammar>
             struct matches
- : detail::matches_impl<typename Expr::proto_base_expr, typename Grammar::proto_base_expr>
+ : detail::matches_<typename Expr::proto_base_expr, typename Grammar::proto_base_expr>
             {};
         }
 
@@ -405,7 +405,6 @@
             {
                 BOOST_PROTO_CALLABLE()
                 typedef _ proto_base_expr;
- typedef void proto_is_wildcard_;
             };
         }
 
@@ -466,7 +465,7 @@
                 template<typename This, typename Expr, typename State, typename Visitor>
                 struct result<This(Expr, State, Visitor)>
                 {
- typedef typename detail::matches_impl<Expr, or_>::which which;
+ typedef typename detail::matches_<Expr, or_>::which which;
                     typedef typename which::template result<void(Expr, State, Visitor)>::type type;
                 };
 
@@ -474,7 +473,7 @@
                 typename result<void(Expr, State, Visitor)>::type
                 operator ()(Expr const &expr, State const &state, Visitor &visitor) const
                 {
- typedef typename detail::matches_impl<Expr, or_>::which which;
+ typedef typename detail::matches_<Expr, or_>::which which;
                     return which()(expr, state, visitor);
                 }
             };
@@ -602,7 +601,7 @@
             template<bool B, typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>
             struct BOOST_PP_CAT(or, N)
               : BOOST_PP_CAT(or, BOOST_PP_DEC(N))<
- matches_impl<Expr, typename G1::proto_base_expr>::value
+ matches_<Expr, typename G1::proto_base_expr>::value
                   , Expr, BOOST_PP_ENUM_SHIFTED_PARAMS(N, G)
>
             {};
@@ -616,16 +615,16 @@
 
             // handle proto::or_
             template<typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>
- struct matches_impl<Expr, proto::or_<BOOST_PP_ENUM_PARAMS(N, G)> >
+ struct matches_<Expr, proto::or_<BOOST_PP_ENUM_PARAMS(N, G)> >
               : BOOST_PP_CAT(or, N)<
- matches_impl<typename Expr::proto_base_expr, typename G0::proto_base_expr>::value,
+ matches_<typename Expr::proto_base_expr, typename G0::proto_base_expr>::value,
                     typename Expr::proto_base_expr, BOOST_PP_ENUM_PARAMS(N, G)
>
             {};
 
             // handle proto::and_
             template<typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>
- struct matches_impl<Expr, proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
+ struct matches_<Expr, proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
               : detail::BOOST_PP_CAT(and, N)<
                     BOOST_PROTO_DEFINE_MATCHES(~, 0, ~)::value,
                     BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_MATCHES, ~)
@@ -642,14 +641,14 @@
             template<typename Args, typename Back, long To>
             struct vararg_matches_impl<Args, Back, N, To>
               : and2<
- matches_impl<typename Args::BOOST_PP_CAT(arg, BOOST_PP_DEC(N))::proto_base_expr, Back>::value
+ matches_<typename Args::BOOST_PP_CAT(arg, BOOST_PP_DEC(N))::proto_base_expr, Back>::value
                   , vararg_matches_impl<Args, Back, N + 1, To>
>
             {};
 
             template<typename Args, typename Back>
             struct vararg_matches_impl<Args, Back, N, N>
- : matches_impl<typename Args::BOOST_PP_CAT(arg, BOOST_PP_DEC(N))::proto_base_expr, Back>
+ : matches_<typename Args::BOOST_PP_CAT(arg, BOOST_PP_DEC(N))::proto_base_expr, Back>
             {};
 
             template<
@@ -665,7 +664,7 @@
             {};
 
             template<typename Tag, typename Args1, typename Args2>
- struct matches_impl< expr<Tag, Args1, N>, expr<Tag, Args2, N> >
+ struct matches_< proto::expr<Tag, Args1, N>, proto::expr<Tag, Args2, N> >
               : BOOST_PP_CAT(and, N)<
                     BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
                     BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
@@ -673,7 +672,7 @@
             {};
 
             template<typename Tag, typename Args1, typename Args2>
- struct matches_impl< expr<Tag, Args1, N>, expr<proto::_, Args2, N> >
+ struct matches_< proto::expr<Tag, Args1, N>, proto::expr<proto::_, Args2, N> >
               : BOOST_PP_CAT(and, N)<
                     BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
                     BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)

Modified: trunk/boost/xpressive/proto/operators.hpp
==============================================================================
--- trunk/boost/xpressive/proto/operators.hpp (original)
+++ trunk/boost/xpressive/proto/operators.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -35,17 +35,17 @@
         struct as_expr_if2<Tag, Left, Right, typename Left::proto_is_expr_, void>
           : generate_if<
                 typename Left::proto_domain
- , expr<
+ , proto::expr<
                     Tag
                   , args2<
                         ref_<Left>
- , typename Left::proto_domain::template apply<expr<tag::terminal, args0<Right &> > >::type
+ , typename Left::proto_domain::template apply<proto::expr<tag::terminal, args0<Right &> > >::type
>
>
>
         {
- typedef expr<tag::terminal, args0<Right &> > term_type;
- typedef expr<Tag, args2<ref_<Left>, typename Left::proto_domain::template apply<term_type>::type> > expr_type;
+ typedef proto::expr<tag::terminal, args0<Right &> > term_type;
+ typedef proto::expr<Tag, args2<ref_<Left>, typename Left::proto_domain::template apply<term_type>::type> > expr_type;
 
             static typename Left::proto_domain::template apply<expr_type>::type
             make(Left &left, Right &right)
@@ -60,17 +60,17 @@
         struct as_expr_if2<Tag, Left, Right, void, typename Right::proto_is_expr_>
           : generate_if<
                 typename Right::proto_domain
- , expr<
+ , proto::expr<
                     Tag
                   , args2<
- typename Right::proto_domain::template apply<expr<tag::terminal, args0<Left &> > >::type
+ typename Right::proto_domain::template apply<proto::expr<tag::terminal, args0<Left &> > >::type
                       , ref_<Right>
>
>
>
         {
- typedef expr<tag::terminal, args0<Left &> > term_type;
- typedef expr<Tag, args2<typename Right::proto_domain::template apply<term_type>::type, ref_<Right> > > expr_type;
+ typedef proto::expr<tag::terminal, args0<Left &> > term_type;
+ typedef proto::expr<Tag, args2<typename Right::proto_domain::template apply<term_type>::type, ref_<Right> > > expr_type;
 
             static typename Right::proto_domain::template apply<expr_type>::type
             make(Left &left, Right &right)
@@ -90,10 +90,10 @@
         struct as_expr_if<Tag, Left, Right, typename Left::proto_is_expr_, typename Right::proto_is_expr_>
           : generate_if<
                 typename Left::proto_domain
- , expr<Tag, args2<ref_<Left>, ref_<Right> > >
+ , proto::expr<Tag, args2<ref_<Left>, ref_<Right> > >
>
         {
- typedef expr<Tag, args2<ref_<Left>, ref_<Right> > > expr_type;
+ typedef proto::expr<Tag, args2<ref_<Left>, ref_<Right> > > expr_type;
             BOOST_MPL_ASSERT((is_same<typename Left::proto_domain, typename Right::proto_domain>));
 
             static typename Left::proto_domain::template apply<expr_type>::type
@@ -179,22 +179,22 @@
     template<typename Arg> \
     typename detail::generate_if< \
         typename Arg::proto_domain \
- , expr<TAG, args1<ref_<typename Arg::proto_derived_expr> > > \
+ , proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr> > > \
>::type const \
     operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
     { \
- typedef expr<TAG, args1<ref_<typename Arg::proto_derived_expr> > > that_type; \
+ typedef proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr> > > that_type; \
         that_type that = {{arg}}; \
         return Arg::proto_domain::make(that); \
     } \
     template<typename Arg> \
     typename detail::generate_if< \
         typename Arg::proto_domain \
- , expr<TAG, args1<ref_<typename Arg::proto_derived_expr const> > > \
+ , proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr const> > > \
>::type const \
     operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
     { \
- typedef expr<TAG, args1<ref_<typename Arg::proto_derived_expr const> > > that_type; \
+ typedef proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr const> > > that_type; \
         that_type that = {{arg}}; \
         return Arg::proto_domain::make(that); \
     } \

Modified: trunk/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/xpressive/proto/proto_fwd.hpp (original)
+++ trunk/boost/xpressive/proto/proto_fwd.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -326,9 +326,6 @@
         template<typename T, typename EnableIf = void>
         struct domain_of;
 
- template<typename Expr>
- struct id;
-
         template<typename Expr, typename Grammar>
         struct matches;
     }
@@ -338,7 +335,6 @@
     using proto::result_of::is_domain;
     using proto::result_of::tag_of;
     using proto::result_of::domain_of;
- using proto::result_of::id;
     using proto::result_of::matches;
 
     namespace op
@@ -650,9 +646,6 @@
 
     namespace has_transformns_
     {
- template<typename Grammar>
- struct has_pass_through_transform;
-
         struct has_identity_transform
         {
             BOOST_PROTO_IDENTITY_TRANSFORM();
@@ -660,10 +653,6 @@
     }
 
     using has_transformns_::has_identity_transform;
- using has_transformns_::has_pass_through_transform;
-
- //template<typename T>
- //struct is_transform;
 
     template<typename T>
     struct is_callable;
@@ -674,6 +663,7 @@
     namespace transform
     {
         #define BOOST_PROTO_CALLABLE() typedef void proto_is_callable_;
+ #define BOOST_PROTO_NOT_CALLABLE() typedef int proto_is_callable_;
 
         struct callable
         {
@@ -708,56 +698,63 @@
         template<typename Sequence, typename State, typename Fun>
         struct reverse_fold_tree;
 
- struct _expr;
- struct _state;
- struct _visitor;
+ template<typename Grammar>
+ struct pass_through;
+
+ struct expr;
+ struct state;
+ struct visitor;
 
         template<int I>
- struct _arg_c;
+ struct arg_c;
 
- struct _arg0;
- struct _arg1;
- struct _arg2;
- struct _arg3;
- struct _arg4;
- struct _arg5;
- struct _arg6;
- struct _arg7;
- struct _arg8;
- struct _arg9;
-
- typedef _arg0 _arg;
- typedef _arg0 _left;
- typedef _arg1 _right;
+ typedef arg_c<0> arg0;
+ typedef arg_c<1> arg1;
+ typedef arg_c<2> arg2;
+ typedef arg_c<3> arg3;
+ typedef arg_c<4> arg4;
+ typedef arg_c<5> arg5;
+ typedef arg_c<6> arg6;
+ typedef arg_c<7> arg7;
+ typedef arg_c<8> arg8;
+ typedef arg_c<9> arg9;
+
+ typedef arg0 arg;
+ typedef arg0 left;
+ typedef arg1 right;
     }
 
     using transform::when;
- using transform::otherwise;
- using transform::_arg0;
- using transform::_arg1;
- using transform::_arg2;
- using transform::_arg3;
- using transform::_arg4;
- using transform::_arg5;
- using transform::_arg6;
- using transform::_arg7;
- using transform::_arg8;
- using transform::_arg9;
- using transform::_arg;
- using transform::_left;
- using transform::_right;
- using transform::_expr;
- using transform::_state;
- using transform::_visitor;
- using transform::_arg_c;
     using transform::call;
     using transform::make;
     using transform::bind;
     using transform::fold;
+ using transform::otherwise;
     using transform::reverse_fold;
     using transform::fold_tree;
     using transform::reverse_fold_tree;
     using transform::callable;
+ using transform::pass_through;
+
+ typedef transform::expr _expr;
+ typedef transform::state _state;
+ typedef transform::visitor _visitor;
+ typedef transform::arg0 _arg0;
+ typedef transform::arg1 _arg1;
+ typedef transform::arg2 _arg2;
+ typedef transform::arg3 _arg3;
+ typedef transform::arg4 _arg4;
+ typedef transform::arg5 _arg5;
+ typedef transform::arg6 _arg6;
+ typedef transform::arg7 _arg7;
+ typedef transform::arg8 _arg8;
+ typedef transform::arg9 _arg9;
+ typedef transform::arg _arg;
+ typedef transform::left _left;
+ typedef transform::right _right;
+
+ template<int I>
+ struct _arg_c;
 
     template<typename T>
     struct is_extension;

Modified: trunk/boost/xpressive/proto/traits.hpp
==============================================================================
--- trunk/boost/xpressive/proto/traits.hpp (original)
+++ trunk/boost/xpressive/proto/traits.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -109,7 +109,7 @@
         {};
 
         template<typename Tag, typename Args, long N>
- struct is_aggregate<expr<Tag, Args, N> >
+ struct is_aggregate<proto::expr<Tag, Args, N> >
           : mpl::true_
         {};
 
@@ -144,12 +144,6 @@
                 typedef typename Expr::proto_tag type;
             };
 
- // id
- template<typename Expr>
- struct id
- : result_of::deep_copy<Expr>
- {};
-
             // as_expr
             template<typename T, typename Domain, typename EnableIf>
             struct as_expr
@@ -160,7 +154,7 @@
                   , remove_cv<T>
>::type proto_arg0;
 
- typedef expr<proto::tag::terminal, args0<proto_arg0> > expr_type;
+ typedef proto::expr<proto::tag::terminal, args0<proto_arg0> > expr_type;
                 typedef typename Domain::template apply<expr_type>::type type;
                 typedef type const result_type;
 
@@ -188,7 +182,7 @@
             template<typename T, typename Domain, typename EnableIf>
             struct as_arg
             {
- typedef expr<proto::tag::terminal, args0<T &> > expr_type;
+ typedef proto::expr<proto::tag::terminal, args0<T &> > expr_type;
                 typedef typename Domain::template apply<expr_type>::type type;
 
                 template<typename T2>
@@ -217,8 +211,8 @@
 
             // left
                 // BUGBUG this forces the instantiation of Expr. Couldn't we
- // partially specialize left<> on expr< T, A > and
- // ref_< expr< T, A > > and return A::arg0 ?
+ // partially specialize left<> on proto::expr< T, A > and
+ // ref_< proto::expr< T, A > > and return A::arg0 ?
             template<typename Expr>
             struct left
               : unref<typename Expr::proto_arg0>
@@ -249,7 +243,8 @@
             template<typename T>
             struct terminal : has_identity_transform
             {
- typedef expr<proto::tag::terminal, args0<T> > type;
+ BOOST_PROTO_NOT_CALLABLE()
+ typedef proto::expr<proto::tag::terminal, args0<T> > type;
                 typedef type proto_base_expr;
                 typedef proto::tag::terminal proto_tag;
                 typedef T proto_arg0;
@@ -257,9 +252,10 @@
 
             // if_else
             template<typename T, typename U, typename V>
- struct if_else_ : has_pass_through_transform<if_else_<T, U, V> >
+ struct if_else_ : pass_through<if_else_<T, U, V> >
             {
- typedef expr<proto::tag::if_else_, args3<T, U, V> > type;
+ BOOST_PROTO_NOT_CALLABLE()
+ typedef proto::expr<proto::tag::if_else_, args3<T, U, V> > type;
                 typedef type proto_base_expr;
                 typedef proto::tag::if_else_ proto_tag;
                 typedef T proto_arg0;
@@ -269,9 +265,10 @@
 
             // unary_expr
             template<typename Tag, typename T>
- struct unary_expr : has_pass_through_transform<unary_expr<Tag, T> >
+ struct unary_expr : pass_through<unary_expr<Tag, T> >
             {
- typedef expr<Tag, args1<T> > type;
+ BOOST_PROTO_NOT_CALLABLE()
+ typedef proto::expr<Tag, args1<T> > type;
                 typedef type proto_base_expr;
                 typedef Tag proto_tag;
                 typedef T proto_arg0;
@@ -279,9 +276,10 @@
 
             // binary_expr
             template<typename Tag, typename T, typename U>
- struct binary_expr : has_pass_through_transform<binary_expr<Tag, T, U> >
+ struct binary_expr : pass_through<binary_expr<Tag, T, U> >
             {
- typedef expr<Tag, args2<T, U> > type;
+ BOOST_PROTO_NOT_CALLABLE()
+ typedef proto::expr<Tag, args2<T, U> > type;
                 typedef type proto_base_expr;
                 typedef Tag proto_tag;
                 typedef T proto_arg0;
@@ -290,9 +288,10 @@
 
         #define BOOST_PROTO_UNARY_GENERATOR(Name) \
             template<typename T> \
- struct Name : has_pass_through_transform<Name<T> > \
+ struct Name : pass_through<Name<T> > \
             { \
- typedef expr<proto::tag::Name, args1<T> > type; \
+ BOOST_PROTO_NOT_CALLABLE() \
+ typedef proto::expr<proto::tag::Name, args1<T> > type; \
                 typedef type proto_base_expr; \
                 typedef proto::tag::Name proto_tag; \
                 typedef T proto_arg0; \
@@ -301,9 +300,10 @@
 
         #define BOOST_PROTO_BINARY_GENERATOR(Name) \
             template<typename T, typename U> \
- struct Name : has_pass_through_transform<Name<T, U> > \
+ struct Name : pass_through<Name<T, U> > \
             { \
- typedef expr<proto::tag::Name, args2<T, U> > type; \
+ BOOST_PROTO_NOT_CALLABLE() \
+ typedef proto::expr<proto::tag::Name, args2<T, U> > type; \
                 typedef type proto_base_expr; \
                 typedef proto::tag::Name proto_tag; \
                 typedef T proto_arg0; \
@@ -695,14 +695,15 @@
                 BOOST_PP_ENUM_PARAMS(N, A)
                 BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT), void
>
- : has_pass_through_transform<
+ : pass_through<
                     function<
                         BOOST_PP_ENUM_PARAMS(N, A)
                         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT), void
>
>
             {
- typedef expr<proto::tag::function, BOOST_PP_CAT(args, N)<BOOST_PP_ENUM_PARAMS(N, A)> > type;
+ BOOST_PROTO_NOT_CALLABLE()
+ typedef proto::expr<proto::tag::function, BOOST_PP_CAT(args, N)<BOOST_PP_ENUM_PARAMS(N, A)> > type;
                 typedef type proto_base_expr;
                 typedef proto::tag::function proto_tag;
                 BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, A)
@@ -715,7 +716,7 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
                 BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT), void
>
- : has_pass_through_transform<
+ : pass_through<
                     nary_expr<
                         Tag
                         BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
@@ -723,7 +724,8 @@
>
>
             {
- typedef expr<Tag, BOOST_PP_CAT(args, N)<BOOST_PP_ENUM_PARAMS(N, A)> > type;
+ BOOST_PROTO_NOT_CALLABLE()
+ typedef proto::expr<Tag, BOOST_PP_CAT(args, N)<BOOST_PP_ENUM_PARAMS(N, A)> > type;
                 typedef type proto_base_expr;
                 typedef Tag proto_tag;
                 BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, A)
@@ -739,9 +741,9 @@
                 BOOST_PP_REPEAT(N, BOOST_PROTO_IMPLICIT_ARG, A)
 
                 template<typename Tag, typename Args, long Arity>
- operator expr<Tag, Args, Arity> () const
+ operator proto::expr<Tag, Args, Arity> () const
                 {
- expr<Tag, Args, Arity> that = {BOOST_PP_ENUM_PARAMS(N, a)};
+ proto::expr<Tag, Args, Arity> that = {BOOST_PP_ENUM_PARAMS(N, a)};
                     return that;
                 }
             };

Modified: trunk/boost/xpressive/proto/transform/arg.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/arg.hpp (original)
+++ trunk/boost/xpressive/proto/transform/arg.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -20,7 +20,7 @@
     namespace transform
     {
 
- struct _expr : callable
+ struct expr : callable
         {
             template<typename Sig>
             struct result;
@@ -33,13 +33,13 @@
 
             template<typename Expr, typename State, typename Visitor>
             Expr const &
- operator ()(Expr const &expr, State const &, Visitor &) const
+ operator ()(Expr const &expr_, State const &, Visitor &) const
             {
- return expr;
+ return expr_;
             }
         };
 
- struct _state : callable
+ struct state : callable
         {
             template<typename Sig>
             struct result;
@@ -52,13 +52,13 @@
 
             template<typename Expr, typename State, typename Visitor>
             State const &
- operator ()(Expr const &, State const &state, Visitor &) const
+ operator ()(Expr const &, State const &state_, Visitor &) const
             {
- return state;
+ return state_;
             }
         };
 
- struct _visitor : callable
+ struct visitor : callable
         {
             template<typename Sig>
             struct result;
@@ -71,14 +71,14 @@
 
             template<typename Expr, typename State, typename Visitor>
             Visitor &
- operator ()(Expr const &, State const &, Visitor &visitor) const
+ operator ()(Expr const &, State const &, Visitor &visitor_) const
             {
- return visitor;
+ return visitor_;
             }
         };
 
         template<int I>
- struct _arg_c : callable
+ struct arg_c : callable
         {
             template<typename Sig>
             struct result;
@@ -95,25 +95,35 @@
                 return proto::arg_c<I>(expr);
             }
         };
-
- struct _arg0 : _arg_c<0> {};
- struct _arg1 : _arg_c<1> {};
- struct _arg2 : _arg_c<2> {};
- struct _arg3 : _arg_c<3> {};
- struct _arg4 : _arg_c<4> {};
- struct _arg5 : _arg_c<5> {};
- struct _arg6 : _arg_c<6> {};
- struct _arg7 : _arg_c<7> {};
- struct _arg8 : _arg_c<8> {};
- struct _arg9 : _arg_c<9> {};
-
- typedef _arg0 _arg;
- typedef _arg0 _left;
- typedef _arg1 _right;
     }
 
     template<int I>
- struct is_callable<transform::_arg_c<I> >
+ struct _arg_c
+ : transform::arg_c<I>
+ {};
+
+ template<>
+ struct is_callable<transform::expr>
+ : mpl::true_
+ {};
+
+ template<>
+ struct is_callable<transform::state>
+ : mpl::true_
+ {};
+
+ template<>
+ struct is_callable<transform::visitor>
+ : mpl::true_
+ {};
+
+ template<int I>
+ struct is_callable<transform::arg_c<I> >
+ : mpl::true_
+ {};
+
+ template<int I>
+ struct is_callable<_arg_c<I> >
       : mpl::true_
     {};
 

Modified: trunk/boost/xpressive/proto/transform/make.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/make.hpp (original)
+++ trunk/boost/xpressive/proto/transform/make.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -87,9 +87,9 @@
                 #if BOOST_WORKAROUND(__GNUC__, == 3)
                 // work around GCC bug
                 template<typename Tag, typename Args, long N, typename Expr, typename State, typename Visitor>
- struct make_if_<expr<Tag, Args, N>, Expr, State, Visitor, false>
+ struct make_if_<proto::expr<Tag, Args, N>, Expr, State, Visitor, false>
                 {
- typedef expr<Tag, Args, N> type;
+ typedef proto::expr<Tag, Args, N> type;
                     typedef void not_applied_;
                 };
                 #endif
@@ -141,9 +141,9 @@
                 };
 
                 template<typename T, typename A, long N>
- struct construct_<expr<T, A, N>, true>
+ struct construct_<proto::expr<T, A, N>, true>
                 {
- typedef expr<T, A, N> result_type;
+ typedef proto::expr<T, A, N> result_type;
 
                     #define TMP(Z, N, DATA) \
                     template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)> \
@@ -256,9 +256,9 @@
             {};
 
             template<typename T, typename A>
- struct construct_<expr<T, A, N>, true>
+ struct construct_<proto::expr<T, A, N>, true>
             {
- typedef expr<T, A, N> result_type;
+ typedef proto::expr<T, A, N> result_type;
 
                 template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>
                 result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const
@@ -295,16 +295,16 @@
         #if BOOST_WORKAROUND(__GNUC__, == 3)
         // work around GCC bug
         template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
- struct make<expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> : callable
+ struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> : callable
         {
             template<typename Sig>
             struct result
             {
- typedef expr<Tag, Args, Arity> type;
+ typedef proto::expr<Tag, Args, Arity> type;
             };
 
             template<typename Expr, typename State, typename Visitor>
- expr<Tag, Args, Arity> operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ proto::expr<Tag, Args, Arity> operator ()(Expr const &expr, State const &state, Visitor &visitor) const
             {
                 return proto::expr<Tag, Args, Arity>::make(
                     #define TMP(Z, M, DATA) detail::as_lvalue(when<_, BOOST_PP_CAT(A, M)>()(expr, state, visitor))

Modified: trunk/boost/xpressive/proto/transform/pass_through.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/pass_through.hpp (original)
+++ trunk/boost/xpressive/proto/transform/pass_through.hpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -54,42 +54,8 @@
             };
         } // namespace detail
 
- //template<typename Grammar>
- //struct pass_through
- // : Grammar
- //{
- // pass_through() {}
-
- // template<typename Expr, typename State, typename Visitor>
- // struct apply
- // : detail::pass_through_impl<
- // Grammar
- // , typename Expr::proto_base_expr
- // , State
- // , Visitor
- // , Expr::proto_arity::value
- // >
- // {};
-
- // template<typename Expr, typename State, typename Visitor>
- // static typename apply<Expr, State, Visitor>::type
- // call(Expr const &expr, State const &state, Visitor &visitor)
- // {
- // return apply<Expr, State, Visitor>::call(expr.proto_base(), state, visitor);
- // }
- //};
-
- } // namespace transform
-
- //template<typename Grammar>
- //struct is_transform<transform::pass_through<Grammar> >
- // : mpl::true_
- //{};
-
- namespace has_transformns_
- {
         template<typename Grammar>
- struct has_pass_through_transform
+ struct pass_through : callable
         {
             template<typename Sig>
             struct result;
@@ -113,7 +79,12 @@
             }
         };
 
- } // namespace has_transformns_
+ } // namespace transform
+
+ template<typename Grammar>
+ struct is_callable<transform::pass_through<Grammar> >
+ : mpl::true_
+ {};
 
     }} // namespace boost::proto
 
@@ -126,7 +97,7 @@
             template<typename Grammar, typename Expr, typename State, typename Visitor>
             struct pass_through_impl<Grammar, Expr, State, Visitor, N>
             {
- typedef expr<
+ typedef proto::expr<
                     typename Expr::proto_tag
                   , BOOST_PP_CAT(args, N)<
                         BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM_TYPE, ~)

Modified: trunk/libs/xpressive/doc/acknowledgements.qbk
==============================================================================
--- trunk/libs/xpressive/doc/acknowledgements.qbk (original)
+++ trunk/libs/xpressive/doc/acknowledgements.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/actions.qbk
==============================================================================
--- trunk/libs/xpressive/doc/actions.qbk (original)
+++ trunk/libs/xpressive/doc/actions.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/concepts.qbk
==============================================================================
--- trunk/libs/xpressive/doc/concepts.qbk (original)
+++ trunk/libs/xpressive/doc/concepts.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/dynamic_regexes.qbk
==============================================================================
--- trunk/libs/xpressive/doc/dynamic_regexes.qbk (original)
+++ trunk/libs/xpressive/doc/dynamic_regexes.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/examples.qbk
==============================================================================
--- trunk/libs/xpressive/doc/examples.qbk (original)
+++ trunk/libs/xpressive/doc/examples.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/grammars.qbk
==============================================================================
--- trunk/libs/xpressive/doc/grammars.qbk (original)
+++ trunk/libs/xpressive/doc/grammars.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/history.qbk
==============================================================================
--- trunk/libs/xpressive/doc/history.qbk (original)
+++ trunk/libs/xpressive/doc/history.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/installation.qbk
==============================================================================
--- trunk/libs/xpressive/doc/installation.qbk (original)
+++ trunk/libs/xpressive/doc/installation.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/introduction.qbk
==============================================================================
--- trunk/libs/xpressive/doc/introduction.qbk (original)
+++ trunk/libs/xpressive/doc/introduction.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/matching.qbk
==============================================================================
--- trunk/libs/xpressive/doc/matching.qbk (original)
+++ trunk/libs/xpressive/doc/matching.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/nyi.qbk
==============================================================================
--- trunk/libs/xpressive/doc/nyi.qbk (original)
+++ trunk/libs/xpressive/doc/nyi.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/perf.qbk
==============================================================================
--- trunk/libs/xpressive/doc/perf.qbk (original)
+++ trunk/libs/xpressive/doc/perf.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/preface.qbk
==============================================================================
--- trunk/libs/xpressive/doc/preface.qbk (original)
+++ trunk/libs/xpressive/doc/preface.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/quick_start.qbk
==============================================================================
--- trunk/libs/xpressive/doc/quick_start.qbk (original)
+++ trunk/libs/xpressive/doc/quick_start.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/regexpp_diffs.qbk
==============================================================================
--- trunk/libs/xpressive/doc/regexpp_diffs.qbk (original)
+++ trunk/libs/xpressive/doc/regexpp_diffs.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/results.qbk
==============================================================================
--- trunk/libs/xpressive/doc/results.qbk (original)
+++ trunk/libs/xpressive/doc/results.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/static_regexes.qbk
==============================================================================
--- trunk/libs/xpressive/doc/static_regexes.qbk (original)
+++ trunk/libs/xpressive/doc/static_regexes.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/substitutions.qbk
==============================================================================
--- trunk/libs/xpressive/doc/substitutions.qbk (original)
+++ trunk/libs/xpressive/doc/substitutions.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/tips_n_tricks.qbk
==============================================================================
--- trunk/libs/xpressive/doc/tips_n_tricks.qbk (original)
+++ trunk/libs/xpressive/doc/tips_n_tricks.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/tokenization.qbk
==============================================================================
--- trunk/libs/xpressive/doc/tokenization.qbk (original)
+++ trunk/libs/xpressive/doc/tokenization.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/traits.qbk
==============================================================================
--- trunk/libs/xpressive/doc/traits.qbk (original)
+++ trunk/libs/xpressive/doc/traits.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/doc/xpressive.qbk
==============================================================================
--- trunk/libs/xpressive/doc/xpressive.qbk (original)
+++ trunk/libs/xpressive/doc/xpressive.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/Jamfile.v2
==============================================================================
--- trunk/libs/xpressive/proto/doc/Jamfile.v2 (original)
+++ trunk/libs/xpressive/proto/doc/Jamfile.v2 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -6,8 +6,8 @@
 import doxygen ;
 import quickbook ;
 
-wave-command = [ path.native ../../../../dist/bin/wave ] ;
-
+#wave-command = [ path.native ../../../../dist/bin/wave ] ;
+#
 ## Generate reference section using Doxygen
 #doxygen protodoc
 # :
@@ -36,15 +36,13 @@
 # ../../../../boost/xpressive/proto/context/default.hpp
 # ../../../../boost/xpressive/proto/context/null.hpp
 # ../../../../boost/xpressive/proto/transform/arg.hpp
-# ../../../../boost/xpressive/proto/transform/apply.hpp
-# ../../../../boost/xpressive/proto/transform/branch.hpp
-# ../../../../boost/xpressive/proto/transform/compose.hpp
-# ../../../../boost/xpressive/proto/transform/construct.hpp
+# ../../../../boost/xpressive/proto/transform/bind.hpp
+# ../../../../boost/xpressive/proto/transform/call.hpp
 # ../../../../boost/xpressive/proto/transform/fold.hpp
 # ../../../../boost/xpressive/proto/transform/fold_tree.hpp
-# ../../../../boost/xpressive/proto/transform/function.hpp
-# ../../../../boost/xpressive/proto/transform/list.hpp
+# ../../../../boost/xpressive/proto/transform/make.hpp
 # ../../../../boost/xpressive/proto/transform/pass_through.hpp
+# ../../../../boost/xpressive/proto/transform/when.hpp
 # :
 # <doxygen:param>EXTRACT_ALL=YES
 # <doxygen:param>HIDE_UNDOC_MEMBERS=NO
@@ -62,6 +60,8 @@
 xml proto
     :
         proto.qbk
+ :
+ <dependency>../test/examples.cpp
     ;
 
 boostbook standalone

Modified: trunk/libs/xpressive/proto/doc/acknowledgements.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/acknowledgements.qbk (original)
+++ trunk/libs/xpressive/proto/doc/acknowledgements.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/calculator.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/calculator.qbk (original)
+++ trunk/libs/xpressive/proto/doc/calculator.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)
@@ -138,7 +138,7 @@
 You might notice that the `calculator_context` has a lot of boilerplate. It
 is fairly common for addition nodes to be handled by evaluating the left and
 right children and then adding the result, for instance. For this purpose,
-proto provides the _default_context_, which gives the operators their usual
+Boost.Proto provides the _default_context_, which gives the operators their usual
 meanings, and uses Boost.Typeof to deduce return types. In fact, the
 _callable_context_ from which our `calculator_context` inherits uses
 _default_context_ as a fall-back for any expression types you don't handle

Modified: trunk/libs/xpressive/proto/doc/examples.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/examples.qbk (original)
+++ trunk/libs/xpressive/proto/doc/examples.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/extensibility.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/extensibility.qbk (original)
+++ trunk/libs/xpressive/proto/doc/extensibility.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/grammars.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/grammars.qbk (original)
+++ trunk/libs/xpressive/proto/doc/grammars.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)
@@ -268,8 +268,9 @@
 and logically negates it; `not_<Grammar>` will match any expression that
 `Grammar` does /not/ match.
 
-The _if_ template is used together with an MPL lambda expression, which is
-evaluated against expression types to find matches.
+The _if_ template is used together with a Proto transform that is evaluated
+against expression types to find matches. (Proto transforms will be described
+later.)
 
 The _and_ template is like _or_, except that each argument of the _and_ must
 match in order for the _and_ to match. As an example, consider the definition
@@ -279,34 +280,19 @@
     struct CharString
       : and_<
             terminal< _ >
- , if_< is_same< result_of::arg< mpl::_ >, char const * > >
+ , if_< is_same< _arg, char const * >() >
>
     {};
 
 This says that a `CharString` must be a terminal, /and/ its argument must be
 the same as `char const *`. Notice the template argument of _if_:
-`is_same< result_of::arg< mpl::_ >, char const * >`. This is an MPL lambda
-expression because it has the MPL placeholder `mpl::_` in it.
-
-[warning Do not confuse `mpl::_` with `proto::_`. The first is only useful in
-MPL lambda expressions. The second is Proto's grammar wildcard. The only place
-`mpl::_` should appear in your grammars is in an _if_, or in tranform::applyN<>,
-as we'll see later. Elsewhere in your grammars you should be using `proto::_`.]
+`is_same< _arg, char const * >()`. This is Proto transform that compares the
+argument of a terminal to `char const *`.
 
 The _if_ template has a couple of variants. In additon to `if_<Condition>` you
 can also say `if_<Condition, ThenGrammar>` and
 `if_<Condition, ThenGrammar, ElseGrammar>`. These let you select one sub-grammar
-or another based on the `Condition`. The following table shows their
-equivalencies:
-
-[table If-Then-Else Equivalencies
-[[Short-Cut Grammar][Equivalent Grammar]]
-[[`if_<Condition, ThenGrammar>`][`and_<if_<Condition>, ThenGrammar>`]]
-[[`if_<Condition, ThenGrammar, ElseGrammar>`][``or_<
- and_<if_<Condition>, ThenGrammar>
- , and_<not_<if_<Condition> >, ElseGrammar>
->``]]
-]
+or another based on the `Condition`.
 
 [endsect]
 

Modified: trunk/libs/xpressive/proto/doc/history.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/history.qbk (original)
+++ trunk/libs/xpressive/proto/doc/history.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)
@@ -9,6 +9,11 @@
 
 [variablelist
 [
+ [January 11, 2008]
+ [Boost.Proto v3 brings separation of grammars and transforms and a
+ "round" lambda syntax for defining transforms in-place.]
+]
+[
     [April 15, 2007]
     [Boost.Xpressive is ported from Proto compilers to Proto transforms.
      Support for old Proto compilers is dropped.]

Modified: trunk/libs/xpressive/proto/doc/implementation.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/implementation.qbk (original)
+++ trunk/libs/xpressive/proto/doc/implementation.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/installation.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/installation.qbk (original)
+++ trunk/libs/xpressive/proto/doc/installation.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)
@@ -9,9 +9,9 @@
 
 [heading Getting Proto]
 
-Currently the only way to get Proto is through CVS via the boost project on
-SourceForge.net. Just go to [@http://sf.net/projects/boost] and follow the
-instructions there for anonymous CVS access.
+Currently the only way to get Proto is through SVN via the boost project on
+SourceForge.net. Just go to [@http://svn.boost.org/trac/boost/wiki/BoostSubversion]
+and follow the instructions there for anonymous SVN access.
 
 [heading Building with Proto]
 
@@ -23,14 +23,14 @@
 
 [heading Requirements]
 
-Proto depends on Boost. You must use the version in CVS HEAD.
+Proto depends on Boost. You must use the version in SVN HEAD.
 
 [heading Supported Compilers]
 
 Currently, Boost.Proto is known to work on the following compilers:
 
 * Visual C++ 7.1 and higher
-* GNU C++ 3.2 and higher
+* GNU C++ 3.4 and higher
 * Intel on Linun 8.1 and higher
 * Intel on Windows 9.1 and higher
 

Modified: trunk/libs/xpressive/proto/doc/preface.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/preface.qbk (original)
+++ trunk/libs/xpressive/proto/doc/preface.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)
@@ -61,6 +61,7 @@
 with Fusion's iterators and algorithms.
 
 The syntax for the grammar-matching features of `proto::matches<>` is inspired
-by MPL's lambda expressions.
+by MPL's lambda expressions, and by Aleksey Gurtovoy's
+[@http://lists.boost.org/Archives/boost/2002/11/39718.php "round" lambda] notation.
 
 [endsect]

Modified: trunk/libs/xpressive/proto/doc/proto.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/proto.qbk (original)
+++ trunk/libs/xpressive/proto/doc/proto.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -2,7 +2,7 @@
 [library Boost.Proto
     [quickbook 1.3]
     [authors [Niebler, Eric]]
- [copyright 2006 Eric Niebler]
+ [copyright 2008 Eric Niebler]
     [category template]
     [id proto]
     [dirname proto]
@@ -18,7 +18,7 @@
 ]
 
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)
@@ -69,6 +69,7 @@
 [def _vararg_ [classref boost::proto::control::vararg `vararg<>`]]
 [def _default_context_ [classref boost::proto::context::default_context `default_context`]]
 [def _callable_context_ [classref boost::proto::context::callable_context `callable_context<>`]]
+[def _when_ [classref boost::proto::transform::when `when<>`]]
 
 [include preface.qbk]
 
@@ -118,7 +119,7 @@
 
 [endsect]
 
-[xinclude protodoc.xml]
+[/ xinclude protodoc.xml]
 
 [section Appendices]
 

Modified: trunk/libs/xpressive/proto/doc/quick_start.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/quick_start.qbk (original)
+++ trunk/libs/xpressive/proto/doc/quick_start.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/rationale.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/rationale.qbk (original)
+++ trunk/libs/xpressive/proto/doc/rationale.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2006 Eric Niebler
+ / Copyright (c) 2008 Eric Niebler
  /
  / 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)

Modified: trunk/libs/xpressive/proto/doc/transforms.qbk
==============================================================================
--- trunk/libs/xpressive/proto/doc/transforms.qbk (original)
+++ trunk/libs/xpressive/proto/doc/transforms.qbk 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -28,30 +28,50 @@
 are to be transformed. Just as the grammar is defined recursively, so too
 is the tree transformation.
 
-A grammar decorated with transforms has a static member function named
-`call()` which takes three parameters:
+You associate transforms with your grammar rules using _when_. For instance,
+you might want to promote all `int` terminals to `long`. You would say
+`when< terminal<int>, terminal<long>::type(_arg) >`. Here,
+`terminal<long>::type(_arg)` is an example of a Proto transform. It says to
+create an object of type `terminal<long>::type` and initialize it with the
+result of the `_arg` transform. `_arg` is a transform defined by Proto which
+essentially calls `proto::arg()` on the current expression.
+
+[note The transform above might look a little strange at first. It appears
+to be constructing a temporary object in place. In fact, it is a
+/function type/. Since `terminal<long>::type` and `_arg` are types,
+`terminal<long>::type(_arg)` is actually the type of a function that takes
+`_arg` as a parameter as returns `terminal<long>::type`. That is immaterial;
+there is no such function in reality. Rather, Proto interprets this function
+type as a transform, the effect of which is described above. The resemblance
+to an in-place construction of a temporary object is intentional. It is a
+concise and natural notation for specifying transforms. Proto transforms use
+function types extensively, as we'll see.]
 
-* `expr` -- the expression to transform
-* `state` -- the state of the transformation so far
-* `visitor` -- any optional auxiliary mutable state information
-
-It also has a nested `apply<>` template which is used to calculate the return
-type of the `call()` member function.
+A grammar decorated with transforms is a function object which takes three
+parameters:
 
-Let's say we have a grammar called `Grammar`, an expression template
-object called `expr` that matches the grammar, and `state` and `visitor`
-objects of your choosing. What happens when you call
-`Grammar::call(expr, state, visitor)`? Well, if `Grammar` were defined as
-`shift_right< Rule1, Rule2 >`, for instance, it might transform the left
-child of `expr` according to `Rule1`'s transform, do the same thing to the
-right child using `Rule2`, and combine the results somehow. Of course, `Rule1`
-and `Rule2` might be defined in terms of other rules with other transforms, so
-the process executes recursively. Some transforms, the `fold<>` in particular,
-use the result of transforming one child as the `state` parameter when
-transforming the other child. In this way, the results of the recursive
-transformations can be accumulated bottom-up.
+* `expr` -- the Proto expression to transform
+* `state` -- the state of the transformation so far
+* `visitor` -- any optional mutable state information
 
-That's it, in a nutshell. Now let's crack this nut and peek inside.
+Grammars with transforms are proper function objects, so you can use
+`boost::result_of<>` to calculate their return types. So, applying a
+transform typically looks like this:
+
+ // Assuming we have an expression to transform,
+ // an initial state, and a visitor ...
+ Expr expr;
+ State state;
+ Visitor visitor;
+
+ // ... calculate the result type of applying
+ // Grammar's transform ...
+ typedef typename
+ boost::result_of<Grammar(Expr, State, Visitor)>::type
+ result_type;
+
+ // ... and apply Grammar's transform:
+ result_type result = Grammar()(expr, state, visitor);
 
 [/==========================================]
 [section Example: Calculator Arity Transform]
@@ -87,14 +107,14 @@
 
 We can immediately write the calculator grammar as follows:
 
-[CalculatorGrammar]
+[CalcGrammar]
 
 We can read this as follows: a calculator expression is either placeholder 1,
 placeholder 2, some other terminal, or some unary or binary operator whose
 operands are calculator expressions. Recall that `proto::_` is a wildcard which
 matches anything. So `terminal< _ >` will match any terminal, and
-`unary_expr< _, CalculatorGrammar >` will match any unary expression
-for which the operand matches CalculatorGrammar (the `_` matches any operator
+`unary_expr< _, CalcArity >` will match any unary expression
+for which the operand matches CalcArity (the `_` matches any operator
 tag).
 
 [/============================]
@@ -124,122 +144,144 @@
 `mpl::int_<1>` to represent the arity of the first placeholder. The following
 attaches a transform that always evaluates to `mpl::int_<1>`:
 
- transform::always< terminal< placeholder1 >, mpl::int_<1> >
+ when< terminal< placeholder1 >, mpl::int_<1>() >
 
 This grammar rule will match any `placeholder1` terminal, and will transform it
-to `mpl::int_<1>`. Likewise, we will use the `transform::always<>` transform to
-transform `placeholder2` terminals into `mpl::int_<2>`, and other terminals
-into `mpl::int_<0>`.
+to a (default-constructed) `mpl::int_<1>` object. As described previously,
+`mpl::int_<1>()` is a function type, but Proto interprets it as an object to
+construct. We will have a similar transform to convert `placeholder2` terminals
+into `mpl::int_<2>`, and other terminals into `mpl::int_<0>`.
 
 Next, let's write a transform for unary operators that returns the arity of the
 operand. It is simply:
 
- transform::arg< unary_expr< _, CalculatorGrammar > >
+ when< unary_expr< _, CalcArity >, CalcArity(_arg) >
 
-As you might expect, the `transform::arg<>` transform returns the argument of the
-unary expression. This looks simple, but there is quite a lot going on here.
+The transform `CalcArity(_arg)` recursively applies the `CalcArity`
+transform to the child node of the unary expression. As you might have noticed,
+`CalcArity(_arg)` is another function type, but Proto interprets this one
+differently. Rather than trying to construct a `CalcArity` object, Proto
+knows this is a function object and invokes it instead.
+
+[note When using function types as Proto transforms, they can either represent
+an object to construct or a function to call. It is similar to C++ where the
+syntax `foo(x)` can either be interpreted as an object to construct or a
+function to call, depending on whether `foo` is a type or a function. Proto
+can't know in general which is the case, so it uses a trait, `proto::is_callable<>`,
+to differentiate. `is_callable< mpl::int_<1> >::value` is false so `mpl::int_<1>()`
+is an object to construct, but `is_callable< CalcArity >::value` is true so
+`CalcArity(_arg)` is a function to call. (`is_callable< CalcArity >::value` is true
+because `CalcArity` inherits from `proto::or_<>`, which is callable.)]
+
+[/
+ That begs the question, what does `unary_expr<>`'s transform do? Well,
+ `unary_expr< _, CalcArity >` has a default transform
+ associated with it. It is a /pass-through/ transform. When an expression
+ of the form `expr< T, arg1< X > >` is passed to the transform, its `apply<>`
+ member template will invoke the `CalcArity` transform (which we haven't
+ completely defined yet -- patience) on `X` resulting in `Y`, and then
+ reassemble the expression as `expr< T, arg1< Y > >`.
+
+ [note You may have noticed that Proto types like `unary_expr<>` serve several
+ different but related roles. In particular, `unary_expr<>` is ...
+
+ ... [*a meta-function]: `unary_expr<T, X>::type` is a typedef for
+ `expr<T, args1<X> >`.
+
+ ... [*a grammar]: `unary_expr<U, Y>` is a simle grammar that matches
+ `expr<T, args1<X> >` if an only if `U` is `T` or `proto::_`, and `Y` is a
+ grammar that matches `X`.
+
+ ... [*a transform]: `unary_expr<U, Y>::apply<expr<T, args1<X> >, S, V>::type`
+ applies `unary_expr<>`'s pass-through transform to `expr<T, args1<X> >` with
+ state `S` and visitor `V`. The result is
+ `expr<T, args1< Y::apply<X, S, V>::type > >`.
+ ]
+
+ So, putting a few things together, consider the calculator expression `+_1`,
+ which would have the following type:
+
+ expr< tag::posit, arg1<
+ expr< tag::terminal, arg0< placeholder1 > >
+ > >
+
+ If we executed the `unary_expr< _, CalcArity >` transform on this
+ expression, we would expect to get:
+
+ expr< tag::posit, arg1<
+ mpl::int_<1>
+ > >
+
+ And if we added the `transform::arg<>` transform also, as in
+ `transform::arg< unary_expr< _, CalcArity > >`, we expect the result
+ to be:
 
-First, you should know that transforms are written so that they can be chained.
-So `transform::arg<>` invokes the transform associated with
-`unary_expr< _, CalculatorGrammar >` before it does anything else.
-
-That begs the question, what does `unary_expr<>`'s transform do? Well,
-`unary_expr< _, CalculatorGrammar >` has a default transform
-associated with it. It is a /pass-through/ transform. When an expression
-of the form `expr< T, arg1< X > >` is passed to the transform, its `apply<>`
-member template will invoke the `CalculatorGrammar` transform (which we haven't
-completely defined yet -- patience) on `X` resulting in `Y`, and then
-reassemble the expression as `expr< T, arg1< Y > >`.
-
-[note You may have noticed that Proto types like `unary_expr<>` serve several
-different but related roles. In particular, `unary_expr<>` is ...
-
-... [*a meta-function]: `unary_expr<T, X>::type` is a typedef for
-`expr<T, args1<X> >`.
-
-... [*a grammar]: `unary_expr<U, Y>` is a simle grammar that matches
-`expr<T, args1<X> >` if an only if `U` is `T` or `proto::_`, and `Y` is a
-grammar that matches `X`.
-
-... [*a transform]: `unary_expr<U, Y>::apply<expr<T, args1<X> >, S, V>::type`
-applies `unary_expr<>`'s pass-through transform to `expr<T, args1<X> >` with
-state `S` and visitor `V`. The result is
-`expr<T, args1< Y::apply<X, S, V>::type > >`.
-]
-
-So, putting a few things together, consider the calculator expression `+_1`,
-which would have the following type:
+ mpl::int_<1>
 
- expr< tag::posit, arg1<
- expr< tag::terminal, arg0< placeholder1 > >
- > >
+ Which is exactly what we want.
 
-If we executed the `unary_expr< _, CalculatorGrammar >` transform on this
-expression, we would expect to get:
+ [note *Default Transforms*
 
- expr< tag::posit, arg1<
- mpl::int_<1>
- > >
-
-And if we added the `transform::arg<>` transform also, as in
-`transform::arg< unary_expr< _, CalculatorGrammar > >`, we expect the result
-to be:
-
- mpl::int_<1>
-
-Which is exactly what we want.
-
-[note *Default Transforms*
-
-All the tools Proto provides for defining grammar rules have default transforms
-associated with them. Just as `unary_expr<>` has a pass-through transform,
-so too does `binary_expr<>`, `shift_right<>`, and all the others.
-`proto::or_<>` has a default transform which evaluates the transform of the
-branch that matched. `proto::and_<>`'s default transform evaluates the
-transform of the last branch. Even `proto::expr<>`, `proto::if_<>`,
-`proto::not_<>`, and `proto::_` have no-op default transforms that simply return
-unmodified the expressions passed to them.
+ All the tools Proto provides for defining grammar rules have default transforms
+ associated with them. Just as `unary_expr<>` has a pass-through transform,
+ so too does `binary_expr<>`, `shift_right<>`, and all the others.
+ `proto::or_<>` has a default transform which evaluates the transform of the
+ branch that matched. `proto::and_<>`'s default transform evaluates the
+ transform of the last branch. Even `proto::expr<>`, `proto::if_<>`,
+ `proto::not_<>`, and `proto::_` have no-op default transforms that simply return
+ unmodified the expressions passed to them.
+ ]
 ]
 
 The arity of a binary operator is the maximum of the arity of the left and
-right operands. Proto does not provide a transform that can help us directly,
-but we can easily write our own. This is what it looks like, and we'll describe
-it below:
-
-[binary_max]
-
-This transform will be used as follows:
-`binary_max< binary_expr< _, CalculatorGrammar, CalculatorGrammar > >`.
-First, note that the transform is a template that takes a Grammar as a template
-parameter. It inherits from the Grammar, as all transforms must. Next, we
-define a nested `apply<>` template which calculates the return type. The first
-thing it does is invoke `Grammar`'s transform. Recall that `binary_expr<>`
-has a pass-through transform. Given an expression like
-`expr< T, arg2< A, B > >`, it transforms it to `expr< T, arg2< X, Y > >`, where
-`X` and `Y` are the results of transforming `A` and `B` according to
-`CalculatorGrammar`.
-
-Next, we extract from this transformed binary expression the left and right
-argument types. As the arguments were transformed in the previous step, we
-expect them to already be of the form `mpl::int_<N>`. Then we use `mpl::max<>`
-to find the maximum, and we're done.
-
-The static `call()` member function is needed to complete the transform
-interface. It simply returns a default-constructed object, which will be an
-instantiation of `mpl::int_<>`.
+right operands. We can specify this with the help of `mpl::max<>`, which is a
+so-called meta-function that computes the maximum of two compile-time integers.
+The transform is described below:
+
+ when<
+ binary_expr< _, CalcArity, CalcArity >
+ , mpl::max< CalcArity(_left), CalcArity(_right) >()
+ >
+
+The above says to match binary calculator expressions and compute their
+arity by first computing the arity of the left and right children and then
+taking their maximum.
+
+There's a lot going on in the above transform, so let's take it one piece
+at a time, starting with the parts we know. `CalcArity(_left)`
+will calculate the arity of the left child, returning a compile-time integer.
+Likewise for `CalcArity(_right)`. What is new is that these two
+transforms are nested within another: `mpl::max<...>()`. Proto notices that
+`mpl::max<...>` is not callable, so this transform is interpreted as an
+object to construct rather than a function to invoke. Using meta-programming
+tricks, Proto disassembles the `mpl::max<...>` template looking for nested
+Proto transforms to apply. It finds two and applies them, resulting in
+`mpl::max< mpl::int_<X>, mpl::int_<Y> >`.
+
+Having first applied any nested transforms, Proto then looks to see if
+`mpl::max<X, Y>` has a nested `::type` typedef. This is a common convention
+used by meta-functions. In this case, `mpl::max<>::type` is a typedef
+for `mpl::int_< Z >` where `Z` is the maximum of `X` and `Y`. The trailing
+`()` on the transform indicates that the result should be default-constructed,
+so this transform returns `mpl::int_<Z>()`. And we're done.
+
+[note Had `mpl::max<>` not had a nested `::type` typedef, the transform
+would have created and returned a default-constructed `mpl::max<>` object
+instead. That is, the result of substituting nested transforms need not
+of necessity have a nested `::type` typedef, but it is used if it is there.]
 
-Piecing it all together, the complete `CalculatorGrammar` looks like this:
+Piecing it all together, the complete `CalcArity` looks like this:
 
-[CalculatorArityGrammar]
+[CalcArity]
 
-We can use our CalculatorGrammar transform to calculate the arity of any
+We can use our `CalcArity` transform to calculate the arity of any
 calculator expression:
 
     int i = 0; // not used, dummy state and visitor parameter
 
- std::cout << CalculatorGrammar::call( lit(100) * 200, i, i) << '\n';
- std::cout << CalculatorGrammar::call( (_1 - _1) / _1 * 100, i, i) << '\n';
- std::cout << CalculatorGrammar::call( (_2 - _1) / _2 * 100, i, i) << '\n';
+ std::cout << CalcArity()( lit(100) * 200, i, i) << '\n';
+ std::cout << CalcArity()( (_1 - _1) / _1 * 100, i, i) << '\n';
+ std::cout << CalcArity()( (_2 - _1) / _2 * 100, i, i) << '\n';
 
 This displays the following:
 
@@ -257,67 +299,91 @@
 [section Canned Transforms]
 [/========================]
 
-Some transforms are generally useful, so Proto provides them. They are
-described below. Each is of the form:
-
- boost::proto::transform::``[~transform-name]``< Grammar ``[~\[, additional args ...\]]`` >
-
-They each inherit from their `Grammar` parameter; therefore, they themselves
-match the same expressions as `Grammar` does. As transforms, they all have
-nested static `call()` member functions that accept `expr`, `state`, and
-`visitor` parameters, as well as `apply<>` member templates for calculating
-the return type of `call()`. The tables below show what `call()` and `apply<>`
-do for each of the transforms that Proto provides.
-
-[section:arg_c_and_friends [^arg<>], [^arc_c<>], [^left<>] and [^right<>]]
-
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar, typename N = mpl::long_<0> >
- struct arg;
-
- template<typename Grammar, long N>
- struct arg_c;
-
- template<typename Grammar>
- struct left;
-
- template<typename Grammar>
- struct right;
- }}}
+So far, we've seen how to write custom transforms using function types.
+These were implemented in terms of more primitive transforms provided by
+Proto, such as `_arg`, `_left`, and `_right`. This section describes those
+transforms and others in detail.
+
+All the transforms defined in this section are of the following form:
+
+ struct some_transform : callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef ... type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return ...;
+ }
+ };
+
+So defined, `some_transform` is a transform "in the raw". It can be used
+without needing to explicitly specify any arguments to the transform. These
+are the building blocks from which you can compose larger transforms using
+function types.
+
+[section:arg_c_and_friends [^_arg], [^_left], and [^_right]]
+
+ namespace boost { namespace proto
+ {
+ namespace transform
+ {
+ template<long N>
+ struct arg_c;
+
+ typedef arg_c<0> arg0;
+ typedef arg_c<1> arg1;
+ ...
+ typedef arg_c<9> arg9;
+
+ typedef arg_c<0> arg;
+ typedef arg_c<0> left;
+ typedef arg_c<1> right;
+ }
+
+ typedef transform::arg0 _arg0;
+ typedef transform::arg1 _arg1;
+ ...
+ typedef transform::arg9 _arg9;
+
+ typedef transform::arg _arg;
+ typedef transform::left _left;
+ typedef transform::right _right;
+ }}
 
 These transforms are useful for extracting the ['[^N]]th argument from an
-expression. The `left<Grammar>` transform is equivalent to the
-`arg_c<Grammar, 0>` transform, and the `right<Grammar>` transform is equivalent
-to the `arg_c<Grammar, 1>` transform.
+expression. The `_left` transform is equivalent to the `arg_c<0>` transform,
+and the `_right` transform is equivalent to the `arg_c<1>` transform.
 
 [table
     [ [Expression]
         [Returns]
     ]
- [ [`transform::arg<Grammar, N>::apply<Expr, State, Visitor>::type`]
- [`proto::result_of::arg<typename Grammar::apply<Expr, State, Visitor>::type, N>::type`]
- ]
- [ [`transform::arg<Grammar, N>::call(expr, state, visitor)`]
- [`proto::arg<N>(Grammar::call(expr, state, visitor))`]
+ [ [`transform::arg_c<N>::result<void(Expr, State, Visitor)>::type`]
+ [`proto::result_of::arg_c<Expr, N>::type`]
     ]
- [ [`transform::arg_c<Grammar, N>::apply<Expr, State, Visitor>::type`]
- [`proto::result_of::arg_c<typename Grammar::apply<Expr, State, Visitor>::type, N>::type`]
+ [ [`transform::arg_c<N>()(expr, state, visitor)`]
+ [`proto::arg_c<N>(expr)`]
     ]
- [ [`transform::arg_c<Grammar, N>::call(expr, state, visitor)`]
- [`proto::arg_c<N>(Grammar::call(expr, state, visitor))`]
+ [ [`transform::left::result<void(Expr, State, Visitor)>::type`]
+ [`proto::result_of::left<Expr>::type`]
     ]
- [ [`transform::left<Grammar>::apply<Expr, State, Visitor>::type`]
- [`proto::result_of::left<typename Grammar::apply<Expr, State, Visitor>::type>::type`]
+ [ [`transform::left()(expr, state, visitor)`]
+ [`proto::left(expr)`]
     ]
- [ [`transform::left<Grammar>::call(expr, state, visitor)`]
- [`proto::left(Grammar::call(expr, state, visitor))`]
+ [ [`transform::right::result<void(Expr, State, Visitor)>::type`]
+ [`proto::result_of::right<Expr>::type`]
     ]
- [ [`transform::right<Grammar>::apply<Expr, State, Visitor>::type`]
- [`proto::result_of::right<typename Grammar::apply<Expr, State, Visitor>::type>::type`]
- ]
- [ [`transform::right<Grammar>::call(expr, state, visitor)`]
- [`proto::right(Grammar::call(expr, state, visitor))`]
+ [ [`transform::right()(expr, state, visitor)`]
+ [`proto::right(expr)`]
     ]
 ]
 
@@ -325,391 +391,169 @@
 
     // Matches an integer terminal and extracts the int.
     struct Int
- : transform::arg< terminal<int> >
+ : when< terminal<int>, _arg >
     {};
 
 [endsect]
 
-[section:identity_and_friends [^identity<>], [^state<>] and [^visitor<>]]
+[section:identity_and_friends [^_expr], [^_state] and [^_visitor]]
 
- namespace boost { namespace proto { namespace transform
+ namespace boost { namespace proto
     {
- template<typename Grammar>
- struct identity;
-
- template<typename Grammar>
- struct state;
-
- template<typename Grammar>
- struct visitor;
- }}}
-
-The `identity<>`, `state<>` and `visitor<>` transforms merely return the
-`expr`, `state` and `visitor` arguments, respectively.
+ namespace transform
+ {
+ struct expr;
+ struct state;
+ struct visitor;
+ }
+
+ typedef transform::expr _expr;
+ typedef transform::state _state;
+ typedef transform::visitor _visitor;
+ }}
+
+The `expr`, `state` and `visitor` transforms merely return the
+`expr`, `state` and `visitor` arguments, respectively. Proto's
+wildcard pattern, `_`, behaves like `transform::expr` when used
+as a transform.
 
 [table
     [ [Expression]
         [Returns]
     ]
- [ [`transform::identity<Grammar>::apply<Expr, State, Visitor>::type`]
+ [ [`_::result<void(Expr, State, Visitor)>::type`]
         [`Expr`]
     ]
- [ [`transform::identity<Grammar>::call(expr, state, visitor)`]
- [`expr`]
+ [ [`_()(expr_, state, visitor)`]
+ [`expr_`]
+ ]
+ [ [`transform::expr::result<void(Expr, State, Visitor)>::type`]
+ [`Expr`]
     ]
- [ [`transform::state<Grammar>::apply<Expr, State, Visitor>::type`]
+ [ [`transform::expr()(expr_, state, visitor)`]
+ [`expr_`]
+ ]
+ [ [`transform::state::result<void(Expr, State, Visitor)>::type`]
         [`State`]
     ]
- [ [`transform::state<Grammar>::call(expr, state, visitor)`]
- [`state`]
+ [ [`transform::state()(expr, state_, visitor)`]
+ [`state_`]
     ]
- [ [`transform::visitor<Grammar>::apply<Expr, State, Visitor>::type`]
+ [ [`transform::visitor::result<void(Expr, State, Visitor)>::type`]
         [`Visitor`]
     ]
- [ [`transform::visitor<Grammar>::call(expr, state, visitor)`]
- [`visitor`]
+ [ [`transform::visitor()(expr, state, visitor_)`]
+ [`visitor_`]
     ]
 ]
 
 Example:
 
     // Matches a subscript expression where the left- and right-hand operands
- // match MyGrammar, returns the expression unmodified; that is, without
- // applying MyGrammar's transforms to the left and right operands, as would
- // happen by default.
+ // match MyGrammar, returns the expression unmodified
     struct Subscript
- : transform::identity< subscript<MyGrammar, MyGrammar> >
- {};
-
-[endsect]
-
-[section:always [^always<>]]
-
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar, typename Always, typename Factory = ``[~default-factory]``>
- struct always;
- }}}
-
-The `always<>` transform always returns a certain type. By default, its
-`call()` member returns a default constructed object of that type, but you can
-configure this with the optional `Factory` parameter.
-
-[table
- [ [Expression]
- [Returns]
- ]
- [ [`transform::always<Grammar, Type, Factory>::apply<Expr, State, Visitor>::type`]
- [`Type`]
- ]
- [ [`transform::always<Grammar, Type, Factory>::call(expr, state, visitor)`]
- [`Factory()()`]
- ]
-]
-
-Example:
-
- // Match a placeholder terminal and return the arity of the
- // placeholder.
- struct PlaceholderArity
- : transform::always< terminal<placeholder1>, mpl::int_<1> >
+ : when< subscript<MyGrammar, MyGrammar>, _expr >
     {};
 
 [endsect]
 
-[section:applyn [^apply1<>], [^apply2<>] and [^apply3<>]]
-
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar, typename Lambda, typename Factory = ``[~default-factory]``>
- struct apply1;
-
- template<typename Grammar, typename Lambda, typename Factory = ``[~default-factory]``>
- struct apply2;
-
- template<typename Grammar, typename Lambda, typename Factory = ``[~default-factory]``>
- struct apply3;
- }}}
-
-The `apply1<>` transform invokes an MPL lambda expression with the Proto
-expression as the argument, `apply2<>` uses the expression and the state
-as arguments and `apply3<>` uses the expression, state and visitor.
-
-[table
- [ [Expression]
- [Returns]
- ]
- [ [`transform::apply1<Grammar, Lambda, Factory>::apply<Expr, State, Visitor>::type`]
- [`mpl::apply1<Lambda, typename Grammar::apply<Expr, State, Visitor>::type>::type`]
- ]
- [ [`transform::apply1<Grammar, Lambda, Factory>::call(expr, state, visitor)`]
- [`Factory()(Grammar::call(expr, state, visitor))`]
- ]
- [ [`transform::apply2<Grammar, Lambda, Factory>::apply<Expr, State, Visitor>::type`]
- [`mpl::apply2<Lambda, typename Grammar::apply<Expr, State, Visitor>::type, State>::type`]
- ]
- [ [`transform::apply2<Grammar, Lambda, Factory>::call(expr, state, visitor)`]
- [`Factory()(Grammar::call(expr, state, visitor), state)`]
- ]
- [ [`transform::apply3<Grammar, Lambda, Factory>::apply<Expr, State, Visitor>::type`]
- [`mpl::apply3<Lambda, typename Grammar::apply<Expr, State, Visitor>::type, State, Visitor>::type`]
- ]
- [ [`transform::apply3<Grammar, Lambda, Factory>::call(expr, state, visitor)`]
- [`Factory()(Grammar::call(expr, state, visitor), state, visitor)`]
- ]
-]
-
-The `call()` member functions of Proto's `applyN<>` transforms simply return a
-default constructed object of the appropriate type by default. If you want a
-different behavior, you can specify a `Factory` type as the third template
-parameter.
-
-Example:
-
- // Another way to implement a transform that calculates the arity of a
- // binary Calculator expression. This code is functionally equivalent to
- // the binary_max<> transform defined above. The mpl::max<...> type below
- // is an MPL Placeholder expression (note the use of mpl::_) that
- // mpl::apply1<> knows how to evaluate. The effect of the
- // BinaryCalculatorArity grammar is to match binary Calculator expressions,
- // evaluate the arity of the left and right sub-expressions and return the
- // maximum of the two.
- struct BinaryCalculatorArity
- : transform::apply1<
- binary_expr<_, CalculatorArity, CalculatorArity>
- , mpl::max<result_of::left<mpl::_>, result_of::right<mpl::_> >
- >
- {};
-
-[endsect]
-
-[section:branch [^branch<>]]
+[section:fold [^fold<>] and [^reverse_fold<>]]
 
- namespace boost { namespace proto { namespace transform
+ namespace boost { namespace proto
     {
- template<typename Grammar, typename BranchState>
- struct branch;
- }}}
-
-The `branch<>` transform applies `Grammar`'s transform with a new `state`
-parameter. This is useful when you want to compile a branch of the expression
-tree independently of the rest; for example, when you want to fold everything
-under a certain child node into a list.
+ namespace transform
+ {
+ template<typename Sequence, typename State0, typename Fun>
+ struct fold;
+
+ template<typename Sequence, typename State0, typename Fun>
+ struct reverse_fold;
+ }
+
+ using transform::fold;
+ using transform::reverse_fold;
+ }}
 
-[table
- [ [Expression]
- [Returns]
- ]
- [ [`transform::branch<Grammar, BranchState>::apply<Expr, State, Visitor>::type`]
- [`typename Grammar::template apply<Expr, BranchState, Visitor>::type`]
- ]
- [ [`transform::branch<Grammar, BranchState>::call(expr, state, visitor)`]
- [`Grammar::call(expr, BranchState(), visitor)`]
- ]
-]
-
-Example:
-
-See the [link reverse_fold_example [^reverse_fold<>] example].
-
-[endsect]
-
-[section:compose [^compose<>]]
+The transforms `fold<>` and `reverse_fold<>` are akin to the
+`std::accumulate()` algorithm in the STL, or the `fold()` algorithm in
+Boost.Fusion. They iterate over some sequence and
+accumulate some state at each element. The `fold<>`
+transform iterates over the children in order, starting with the 0th child.
+The `reverse_fold<>` transform does it in reverse order, starting with the Nth
+child. (Note that for building things like cons lists, you'll often want to
+built it back-to-front with `reverse_fold<>`.)
 
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar1, typename Grammar2>
- struct compose;
- }}}
-
-The `compose<>` transform applies two transformations in succession. It
-inherits from `Grammar1`, so it matches whatever `Grammar1` matches. The
-result of applying `Grammar1`'s transform is passed to `Grammar2`'s transform,
-along with the `state` and `visitor` parameters. It is assumed that the
-result of applying `Grammar1`'s transform is an expression that matches
-the grammar specified by `Grammar2`.
-
-The `compose<>` transform is useful in situations where you would like to
-preprocess a node in the expression tree before forwarding it on for further
-processing.
+Both `fold<>` and `reverse_fold<>` are implemented in terms of `fusion::fold<>`.
+The three template parameters must each be Proto transforms. The have the following
+meaning:
+
+* `Sequence`: A Proto transform that returns a Fusion sequence.
+* `State`: A Proto transform that returns the initial state of the fold.
+* `Fun`: A Proto transform representing the operation to perform at each
+ iteration of the fold algorithm.
+
+Often, the `Sequence` parameter is `proto::_`, which returns the current node
+in the Proto expression tree. Tree nodes are valid Fusion sequences, where
+the children are the elements of the sequence.
+
+The semantics of the `fold<>` and `reverse_fold<>` transforms can both be
+understood in terms of a helper struct, `as_callable<>`, which binds the
+visitor and the `Fun` transform into a binary function object for use by
+`fusion::fold()`. `as_callable<>` has the following behavior:
 
 [table
     [ [Expression]
         [Returns]
     ]
- [ [`transform::compose<Grammar1, Grammar2>::apply<Expr, State, Visitor>::type`]
- [``typename Grammar2::template apply<
- typename Grammar1::template apply<Expr, State, Visitor>::type
- , State
- , Visitor
->::type``]
+ [ [`as_callable<Fun, Visitor>::result<void(Expr, State)>::type`]
+ [`when<_, Fun>::result<void(Expr, State, Visitor)>::type`]
     ]
- [ [`transform::compose<Grammar1, Grammar2>::call(expr, state, visitor)`]
- [``Grammar2::call(
- Grammar1::call(expr, state, visitor), state, visitor)``]
+ [ [`as_callable<Fun, Visitor>(visitor)(expr, state)`]
+ [`when<_, Fun>()(expr, state, visitor)`]
     ]
 ]
 
-Example:
-
- // A fragment of a Calculator grammar which uses compose<> to process
- // a node in the expression tree after it has been preprocessed by
- // an arg<> transform.
- struct Calculator
- : or_<
- // ...
- transform::compose<
- // Match anything of the form +X, and
- // extract X, discarding the +.
- transform::arg<posit<_> >
- // Now invoke the Calculator transform on X
- , Calculator
- >
- >
- {};
-
-[endsect]
-
-[section:list [^list<>]]
-
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar>
- struct list;
- }}}
-
-`list<>` is a simple transform that builds a fusion cons list, using the
-transformed expression as the list's head, and the state as the list's tail.
+With the above `as_callable<>` adaptor, `fold<>` and `reverse_fold<>`
+can be easily implemented in terms of `fusion::fold<>`:
 
 [table
     [ [Expression]
         [Returns]
     ]
- [ [`transform::list<Grammar>::apply<Expr, State, Visitor>::type`]
- [``fusion::cons<
- typename Grammar::template apply<Expr, State, Visitor>::type
- , State
->``]
- ]
- [ [`transform::list<Grammar>::call(expr, state, visitor)`]
- [``fusion::cons<
- typename Grammar::template apply<Expr, State, Visitor>::type
- , State
->(Grammar::call(expr, state, visitor), state)``]
- ]
-]
-
-Example:
-
-See the [link reverse_fold_example [^reverse_fold<>] example].
-
-[endsect]
-
-[section:fold [^fold<>] and [^reverse_fold<>]]
-
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar, typename State = void>
- struct fold;
-
- template<typename Grammar, typename State = void>
- struct reverse_fold;
- }}}
-
-The transforms `fold<>` and `reverse_fold<>` are akin to the
-`std::accumulate()` algorithm in the STL. They iterate over some sequence and
-accumulate some state at each element. For Proto's `fold<>` and
-`reverse_fold<>`, the "elements" of the sequence are actually pairs consisting
-of the corresponding child grammars and expressions. The state is accumulated
-by applying the child grammar's transform to the corresponding child
-expression. The result of one transform is used as the state of the next
-transform, such that the transforms nest like Russian dolls. The `fold<>`
-transform iterates over the children in order, starting with the 0th child.
-The `reverse_fold<>` transform does it in reverse order, starting with the Nth
-child. (Note that for building things like cons lists, you'll often want to
-built it back-to-front with `reverse_fold<>`.)
-
-[def __arg_N__ proto_arg[~N]]
-[def __arg_N_sub_1__ proto_arg[~N-1]]
-
-[table
- [ [Expression]
- [Returns]
- ]
- [ [`transform::fold<Grammar>::apply<Expr, State, Visitor>::type`]
- [``typename Grammar::__arg_N__::apply<
- typename Expr::__arg_N__::proto_base_expr
- , typename Grammar::__arg_N_sub_1__::apply<
- typename Expr::__arg_N_sub_1__::proto_base_expr
- , // ...
- typename Grammar::proto_arg0::apply<
- typename Expr::proto_arg0::proto_base_expr, State, Visitor>::type
- // ...
- , Visitor
- >::type
- , Visitor
+ [ [`fold<Sequence, State0, Fun>::result<void(Expr, State, Visitor)>::type`]
+ [``fusion::result_of::fold<
+ when<_, Sequence>::result<void(Expr, State, Visitor)>::type
+ , when<_, State0>::result<void(Expr, State, Visitor)>::type
+ , as_callable<Fun, Visitor>
>::type``]
     ]
- [ [`transform::fold<Grammar>::call(expr, state, visitor)`]
- [``Grammar::__arg_N__::call(
- proto::arg_c<N>(expr)
- , Grammar::__arg_N_sub_1__::call(
- proto::arg_c<N-1>(expr)
- , // ...
- Grammar::proto_arg0::call(
- proto::arg_c<0>(expr), state, visitor)
- // ...
- , visitor
- )
- , visitor
+ [ [`fold<Sequence, State0, Fun>()(expr, state, visitor)`]
+ [``fusion::fold(
+ when<_, Sequence>()(expr, state, visitor)
+ , when<_, State0>()(expr, state, visitor)
+ , as_callable<Fun, Visitor>(visitor)
 )``]
     ]
- [ [`transform::reverse_fold<Grammar>::apply<Expr, State, Visitor>::type`]
- [``typename Grammar::proto_arg0::apply<
- typename Expr::proto_arg0::proto_base_expr
- , typename Grammar::proto_arg1::apply<
- typename Expr::proto_arg1::proto_base_expr
- , // ...
- typename Grammar::__arg_N__::apply<
- typename Expr::__arg_N__::proto_base_expr, State, Visitor>::type
- // ...
- , Visitor
+ [ [`reverse_fold<Sequence, State0, Fun>::result<void(Expr, State, Visitor)>::type`]
+ [``fusion::result_of::fold<
+ fusion::result_of::reverse<
+ when<_, Sequence>::result<void(Expr, State, Visitor)>::type
>::type
- , Visitor
+ , when<_, State0>::result<void(Expr, State, Visitor)>::type
+ , as_callable<Fun, Visitor>
>::type``]
     ]
- [ [`transform::reverse_fold<Grammar>::call(expr, state, visitor)`]
- [``Grammar::proto_arg0::call(
- proto::arg_c<0>(expr)
- , Grammar::proto_arg1::call(
- proto::arg_c<1>(expr)
- , // ...
- Grammar::__arg_N__::call(
- proto::arg_c<N>(expr), state, visitor)
- // ...
- , visitor
+ [ [`reverse_fold<Sequence, State0, Fun>()(expr, state, visitor)`]
+ [``fusion::fold(
+ fusion::reverse(
+ when<_, Sequence>()(expr, state, visitor)
     )
- , visitor
+ , when<_, State0>()(expr, state, visitor)
+ , as_callable<Fun, Visitor>(visitor)
 )``]
     ]
 ]
 
-Both the `fold<>` and `reverse_fold<>` transforms take an optional `State`
-template parameter. For non-`void` `State` parameters, the following
-equivalances hold:
-
-[table fold<> and reverse_fold<> Equivalencies
- [[Short-Cut Grammar] [Equivalent Grammar]]
- [[`transform::fold<Grammar, State>`] [``transform::branch<
- transform::fold<Grammar>
- , State
->``]]
- [[`transform::reverse_fold<Grammar, State>`][``transform::branch<
- transform::reverse_fold<Grammar>
- , State
->``]]
-]
-
 [#reverse_fold_example]Example:
 
 [AsArgList]
@@ -718,59 +562,98 @@
 
 [section:fold_tree [^fold_tree<>] and [^reverse_fold_tree<>]]
 
- namespace boost { namespace proto { namespace transform
+ namespace boost { namespace proto
     {
- template<typename Tag, typename Grammar, typename State = void>
- struct fold_tree;
-
- template<typename Tag, typename Grammar, typename State = void>
- struct reverse_fold_tree;
- }}}
+ namespace transform
+ {
+ template<typename Sequence, typename State0, typename Fun>
+ struct fold_tree;
+
+ template<typename Sequence, typename State0, typename Fun>
+ struct reverse_fold_tree;
+ }
+
+ using transform::fold;
+ using transform::reverse_fold;
+ }}
 
 The `fold_tree<>` and `reverse_fold_tree<>` transforms recursively apply the
 `fold<>` and `reverse_fold<>` transforms to sub-trees that all share a common
-`Tag` type. This is useful for flattening trees into lists; for example, you
+tag type. This is useful for flattening trees into lists; for example, you
 might use `reverse_fold_tree<>` to flatten an expression tree like `a | b | c`
 into a Fusion list like `cons(a, cons(b, cons(c)))`.
 
 The `fold_tree<>` and `reverse_fold_tree<>` transforms are unlike the other
 transforms that Proto provides in that they operate on entire sub-trees rather
-than just single nodes within the tree. As a result, their interface is
-different. The `Tag` parameter is the type of the operator tag that behaves
-like a separator. The `Grammar` parameter represents that grammar that the
-separated sub-expressions must match, and the transform that will be applied
-to each. The optional `State` parameter is the initial state of the transform.
+than just single nodes within the tree.
 
 These are higher-level transforms, implemented in terms of the `fold<>`
-transform. They are probably best understood in terms of their definition,
-which is fairly small.
+and `reverse_fold<>` transforms and helper structs `fold_tree_<>` and
+`reverse_fold_tree_<>`, one of which is shown below:
 
- namespace detail
- {
- // fold_tree_ either recurses into the expression, if its Tag
- // matches, or else ends the recursion by matching Grammar and
- // applying its transform.
- template<typename Tag, typename Grammar>
- struct fold_tree_
- : or_<
- transform::fold<
- nary_expr<Tag, vararg<fold_tree_<Tag, Grammar> > >
- >
- , Grammar
- >
- {};
- }
-
- template<typename Tag, typename Grammar, typename State = void>
- struct fold_tree
- : transform::fold<
- nary_expr<Tag, vararg<detail::fold_tree_<Tag, Grammar> > >
- , State
+ // fold_tree_ either recurses into the expression, if its Grammar
+ // matches, or else ends the recursion by matching Grammar and
+ // applying its transform.
+ template<typename Grammar, typename Fun>
+ struct fold_tree_
+ : or_<
+ when<Grammar, fold<_, _state, fold_tree_<Grammar, Fun> > >
+ , when<_, Fun>
>
     {};
+
+The `reverse_fold_tree_<>` helper is specified similarly, only with
+`reverse_fold<>` instead of `fold<>`. With these two helpers, we can
+specify the behavior of `fold_tree<>` and `reverse_fold_tree<>` as
+follows:
 
-The `reverse_fold_tree<>` transform is specified similarly, only with
-`reverse_fold<>` instead of `fold<>`.
+[table
+ [ [Expression]
+ [Returns]
+ ]
+ [ [``fold_tree<Sequence, State0, Fun>
+ ::result<void(Expr, State, Visitor)>::type``]
+ [``fold<
+ Sequence
+ , State0
+ , fold_tree_<
+ nary_expr<Expr::proto_tag, vararg<_> >
+ , Fun
+ >
+>::result<void(Expr, State, Visitor)>::type``]
+ ]
+ [ [`fold_tree<Sequence, State0, Fun>()(expr, state, visitor)`]
+ [``fold<
+ Sequence
+ , State0
+ , fold_tree_<
+ nary_expr<Expr::proto_tag, vararg<_> >
+ , Fun
+ >
+>()(expr, state, visitor)``]
+ ]
+ [ [``reverse_fold_tree<Sequence, State0, Fun>
+ ::result<void(Expr, State, Visitor)>::type``]
+ [``reverse_fold<
+ Sequence
+ , State0
+ , reverse_fold_tree_<
+ nary_expr<Expr::proto_tag, vararg<_> >
+ , Fun
+ >
+>::result<void(Expr, State, Visitor)>::type``]
+ ]
+ [ [`reverse_fold_tree<Sequence, State0, Fun>()(expr, state, visitor)`]
+ [``reverse_fold<
+ Sequence
+ , State0
+ , reverse_fold_tree_<
+ nary_expr<Expr::proto_tag, vararg<_> >
+ , Fun
+ >
+>()(expr, state, visitor)``]
+ ]
+]
 
 Example:
 
@@ -778,104 +661,18 @@
 
 [endsect]
 
-[section:construct [^construct<>]]
-
- namespace boost { namespace proto { namespace transform
- {
- template<typename Grammar, typename Constructor>
- struct construct;
- }}}
-
-The `construct<>` transform is a flexible tool for transforming expressions
-into other types of objects. With it, you can specify both the type of the
-object to construct as well as what parameters to pass to its constructor. A
-typical usage of the `construct<>` transform is like this:
-
- transform::construct<
- terminal<float>
- , terminal<double>::type(transform::arg<_>)
- >
-
-The first template parameter is the grammar to match; in this case, terminals
-of type `float`. The second template parameter might look a little strange. It
-is actually a function type, but here we're using it to describe what object to
-construct and how to initialize it. In this case, we will be constructing a
-`double` terminal, using the argument from the `float` terminal. This transform
-effectively promotes a `float` to a `double`.
-
-The `Constructor` template parameter is a function type of the following form:
-
- ResultType(Transform1, Transform2, ...)
-
-where `Transform1`, `Transform2`, etc, are Proto transforms. They specify what
-arguments should be used to construct the `ResultType` object. The way it works
-is as follows. Consider the transform `transform::construct<G, R(T)>`, and an
-expression object `e` of type `E` that matches `G`. Then the result will be an
-object of type `R` constructed like this:
-
- E2 e2 = G::call(e, s, v);
- R(T::call(e2, s, v));
-
-where `s` and `v` are some state and visitor parameters, and `E2` is the return
-type of `G::call(e,s,v)`. Note that `G`'s transform is applied first, followed
-by `T`'s transform.
-
-The result type itself may be specified in terms of Proto transforms. In that
-case, the return type is the result of applying the transforms and substituting
-the transforms with the results. Consider the following code that matches an
-invocation of a lazy `make_pair_` function, and actually returns a
-`std::pair<>` of the correct type.
-
-[LazyMakePair]
-
-Notice that the result type, `std::pair<...>`, is specified in terms of Proto
-transforms. Notice also that Proto transforms are used to specify how to
-construct the `std::pair<>` object. We can now use the `MakePair` transform to
-convert a lazy `make_pair_()` function invocation into an actual `std::pair<>`:
-
-[LazyMakePairTest]
-
-The above code would display the following:
-
-[pre
-1
-3.14
-]
-
-When building the result type, if the result of applying a Proto transform is a
-type that has a nested `::type` member typedef, then that type is used instead.
-For instance, here is a transform that matches an integer and negates it lazily
-by wrapping it in a `negate<>` node.
-
-[NegateInt]
-
-The return type is `negate<_>`, but what is actually constructed is
-`negate<terminal<int>::type>::type`. This behavior should seem familiar if you
-have ever used MPL Placeholder expressions.
-
-The `construct<>` transform gives you a simple and convenient syntax for
-creating temporary sub-objects. In the `Constructor` expression
-`ResultType(Transform1, Transform2)`, if the type of `Transform1` is a function
-type, then it is converted into the transform `construct<_, Transform1>`. The
-following example demonstrates how to match an integer, promote it to a long
-integer, and lazily square it.
-
-[SquareAndPromoteInt]
-
-The "arguments" to the constructor are `terminal<long>::type(transform::arg<_>)`,
-which is short-cut syntax for a nested `construct<>` transform. [footnote The
-short-cut syntax for nested constructors does not work on MSVC due to compiler
-bugs.]
-
-[endsect]
-
 [section:pass_through [^pass_through<>]]
 
- namespace boost { namespace proto { namespace transform
+ namespace boost { namespace proto
     {
- template<typename Grammar>
- struct pass_through;
- }}}
+ namespace transform
+ {
+ template<typename Grammar>
+ struct pass_through;
+ }
+
+ using transform::pass_through;
+ }}
 
 The `pass_through<>` transform iterates over the pairs of
 children in the grammar and the expression, applying the child grammar's
@@ -895,22 +692,30 @@
     [ [Expression]
         [Returns]
     ]
- [ [`transform::pass_through<Grammar>::apply<Expr, State, Visitor>::type`]
+ [ [``transform::pass_through<Grammar>
+ ::result<void(Expr, State, Visitor)>::type``]
         [``typename nary_expr<
- typename Expr::proto_tag
- , typename Grammar::proto_arg0::apply<typename Expr::proto_arg0::proto_base_expr, State, Visitor>::type
- , typename Grammar::proto_arg1::apply<typename Expr::proto_arg1::proto_base_expr, State, Visitor>::type
+ Expr::proto_tag
+ , result_of::arg_c<Grammar, 0>::type::result<
+ void(result_of::arg_c<Expr, 0>::type, State, Visitor)>::type
+ , result_of::arg_c<Grammar, 1>::type::result<
+ void(result_of::arg_c<Expr, 1>::type, State, Visitor)>::type
     // ...
- , typename Grammar::__arg_N__::apply<typename Expr::__arg_N__::proto_base_expr, State, Visitor>::type
+ , result_of::arg_c<Grammar, N>::type::result<
+ void(result_of::arg_c<Expr, N>::type, State, Visitor)>::type
>::type``]
     ]
- [ [`transform::pass_through<Grammar>::call(expr, state, visitor)`]
- [``transform::pass_through<Grammar>::apply<Expr, State, Visitor>::type::make(
- Grammar::proto_arg0::call(proto::arg_c<0>(expr), state, visitor)
- , Grammar::proto_arg1::call(proto::arg_c<1>(expr), state, visitor)
- // ...
- , Grammar::__arg_N__::call(proto::arg_c<N>(expr), state, visitor)
-)``]
+ [ [`transform::pass_through<Grammar>()(expr, state, visitor)`]
+ [``transform::pass_through<Grammar>
+ ::result<void(Expr, State, Visitor)>::type::make(
+ result_of::arg_c<Grammar, 0>::type()(
+ proto::arg_c<0>(expr), state, visitor)
+ , result_of::arg_c<Grammar, 1>::type()(
+ proto::arg_c<1>(expr), state, visitor)
+ // ...
+ , result_of::arg_c<Grammar, N>::type()(
+ proto::arg_c<N>(expr), state, visitor)
+ )``]
     ]
 ]
 

Modified: trunk/libs/xpressive/proto/example/calc3.cpp
==============================================================================
--- trunk/libs/xpressive/proto/example/calc3.cpp (original)
+++ trunk/libs/xpressive/proto/example/calc3.cpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -19,10 +19,9 @@
 using namespace boost;
 
 // Will be used to define the placeholders _1 and _2
-template<typename I> struct arg : I {};
+template<typename I> struct placeholder : I {};
 
 using proto::_;
-using namespace proto::transform;
 
 // This grammar basically says that a calculator expression is one of:
 // - A placeholder terminal
@@ -34,15 +33,15 @@
   : proto::or_<
 
         // placeholders have a non-zero arity ...
- when< proto::terminal< arg<_> >, _arg >
+ proto::when< proto::terminal< placeholder<_> >, proto::_arg >
 
         // Any other terminals have arity 0 ...
- , when< proto::terminal<_>, mpl::int_<0>() >
+ , proto::when< proto::terminal<_>, mpl::int_<0>() >
 
         // For any non-terminals, find the arity of the children and
         // take the maximum. This is recursive.
- , when< proto::nary_expr<_, proto::vararg<_> >
- , fold<_, mpl::int_<0>(), mpl::max<CalculatorGrammar, _state>() > >
+ , proto::when< proto::nary_expr<_, proto::vararg<_> >
+ , proto::fold<_, mpl::int_<0>(), mpl::max<CalculatorGrammar, proto::_state>() > >
 
>
 {};
@@ -78,7 +77,7 @@
 
     // Handle the evaluation of the placeholder terminals
     template<typename I>
- double operator ()(proto::tag::terminal, arg<I>) const
+ double operator ()(proto::tag::terminal, placeholder<I>) const
     {
         return d[ I() - 1 ];
     }
@@ -132,8 +131,8 @@
 {};
 
 // Define some placeholders (notice they're wrapped in calculator_expression<>)
-calculator_expression<proto::terminal< arg< mpl::int_<1> > >::type> const _1;
-calculator_expression<proto::terminal< arg< mpl::int_<2> > >::type> const _2;
+calculator_expression<proto::terminal< placeholder< mpl::int_<1> > >::type> const _1;
+calculator_expression<proto::terminal< placeholder< mpl::int_<2> > >::type> const _2;
 
 // Now, our arithmetic expressions are immediately executable function objects:
 int main()

Modified: trunk/libs/xpressive/proto/example/mixed.cpp
==============================================================================
--- trunk/libs/xpressive/proto/example/mixed.cpp (original)
+++ trunk/libs/xpressive/proto/example/mixed.cpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -23,9 +23,9 @@
 #include <boost/typeof/std/vector.hpp>
 #include <boost/typeof/std/complex.hpp>
 
-using namespace boost;
-using namespace proto::transform;
-using proto::_;
+namespace proto = boost::proto;
+namespace mpl = boost::mpl;
+using namespace proto;
 
 template<typename Expr>
 struct MixedExpr;
@@ -48,7 +48,7 @@
     template<class This, class Cont>
     struct result<This(Cont)>
       : proto::result_of::as_expr<
- iterator_wrapper<typename remove_reference<Cont>::type::const_iterator>
+ iterator_wrapper<typename boost::remove_reference<Cont>::type::const_iterator>
>
     {};
     
@@ -231,7 +231,7 @@
 
         template<typename This, typename Arg>
         struct result<This(Arg)>
- : remove_const<typename remove_reference<Arg>::type>
+ : boost::remove_const<typename boost::remove_reference<Arg>::type>
         {};
 
         template<typename Arg>

Modified: trunk/libs/xpressive/proto/example/vec3.cpp
==============================================================================
--- trunk/libs/xpressive/proto/example/vec3.cpp (original)
+++ trunk/libs/xpressive/proto/example/vec3.cpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -17,9 +17,10 @@
 #include <boost/xpressive/proto/context.hpp>
 #include <boost/xpressive/proto/proto_typeof.hpp>
 #include <boost/xpressive/proto/transform.hpp>
-using namespace boost::proto;
-using namespace transform;
+
 namespace mpl = boost::mpl;
+namespace proto = boost::proto;
+using namespace proto;
 
 // Here is an evaluation context that indexes into a Vec3
 // expression, and combines the result.
@@ -93,12 +94,12 @@
 
     int &operator [](int i)
     {
- return arg(*this)[i];
+ return proto::arg(*this)[i];
     }
 
     int const &operator [](int i) const
     {
- return arg(*this)[i];
+ return proto::arg(*this)[i];
     }
 
     // Here we define a operator = for Vec3 terminals that

Modified: trunk/libs/xpressive/proto/test/examples.cpp
==============================================================================
--- trunk/libs/xpressive/proto/test/examples.cpp (original)
+++ trunk/libs/xpressive/proto/test/examples.cpp 2008-01-15 01:46:39 EST (Tue, 15 Jan 2008)
@@ -25,11 +25,14 @@
 
 namespace test1
 {
-//[ CalculatorGrammar
+//[ CalcGrammar
     using namespace boost::proto;
 
+ // This is the grammar for calculator expressions,
+ // to which we will attach transforms for computing
+ // the expressions' arity.
     /*<< A Calculator expression is ... >>*/
- struct CalculatorGrammar
+ struct CalcArity
       : or_<
             /*<< placeholder1, or ... >>*/
             terminal< placeholder1 >
@@ -38,9 +41,9 @@
           /*<< some other terminal, or ... >>*/
           , terminal< _ >
           /*<< a unary expression where the operand is a calculator expression, or ... >>*/
- , unary_expr< _, CalculatorGrammar >
- /*<< a binary expression where the operands are calculator expressions, or ... >>*/
- , binary_expr< _, CalculatorGrammar, CalculatorGrammar >
+ , unary_expr< _, CalcArity >
+ /*<< a binary expression where the operands are calculator expressions >>*/
+ , binary_expr< _, CalcArity, CalcArity >
>
     {};
 //]
@@ -146,14 +149,25 @@
 {};
 //]
 
-//[ CalculatorArityGrammar2
-struct CalcArity2
+//[ CalcArity
+struct CalcArity
   : or_<
- when< terminal< placeholder1 >, mpl::int_<1>() >
- , when< terminal< placeholder2 >, mpl::int_<2>() >
- , when< terminal<_>, mpl::int_<0>() >
- , when< unary_expr<_, CalcArity2>, CalcArity2(_arg) >
- , when< binary_expr<_, CalcArity2, CalcArity2>, mpl::max<CalcArity2(_left), CalcArity2(_right)>() >
+ when< terminal< placeholder1 >,
+ mpl::int_<1>()
+ >
+ , when< terminal< placeholder2 >,
+ mpl::int_<2>()
+ >
+ , when< terminal<_>,
+ mpl::int_<0>()
+ >
+ , when< unary_expr<_, CalcArity>,
+ CalcArity(_arg)
+ >
+ , when< binary_expr<_, CalcArity, CalcArity>,
+ mpl::max<CalcArity(_left),
+ CalcArity(_right)>()
+ >
>
 {};
 //]
@@ -177,7 +191,7 @@
       , reverse_fold<
             /*<< The first child expression of a `function<>` node is the
             function being invoked. We don't want that in our list, so use
- the `pop_front()` to remove it. >>*/
+ `pop_front()` to remove it. >>*/
             _pop_front(_)
           /*<< `nil` is the initial state used by the `reverse_fold<>`
           transform. >>*/
@@ -286,9 +300,9 @@
     BOOST_CHECK_EQUAL(1, CalculatorArity()( (_1 - _1) / _1 * 100, i, i));
     BOOST_CHECK_EQUAL(2, CalculatorArity()( (_2 - _1) / _2 * 100, i, i));
 
- BOOST_CHECK_EQUAL(0, CalcArity2()( lit(100) * 200, i, i));
- BOOST_CHECK_EQUAL(1, CalcArity2()( (_1 - _1) / _1 * 100, i, i));
- BOOST_CHECK_EQUAL(2, CalcArity2()( (_2 - _1) / _2 * 100, i, i));
+ BOOST_CHECK_EQUAL(0, CalcArity()( lit(100) * 200, i, i));
+ BOOST_CHECK_EQUAL(1, CalcArity()( (_1 - _1) / _1 * 100, i, i));
+ BOOST_CHECK_EQUAL(2, CalcArity()( (_2 - _1) / _2 * 100, i, i));
 
     using boost::fusion::cons;
     using boost::fusion::nil;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk