Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-27 16:36:54


Author: eric_niebler
Date: 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
New Revision: 41424
URL: http://svn.boost.org/trac/boost/changeset/41424

Log:
rename case_ to when
Added:
   branches/proto/v3/boost/xpressive/proto3/transform/when.hpp
      - copied, changed from r41422, /branches/proto/v3/boost/xpressive/proto3/transform/case.hpp
Removed:
   branches/proto/v3/boost/xpressive/proto3/transform/case.hpp
Text files modified:
   branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp | 42 ++++++++++++++++++++--------------------
   branches/proto/v3/boost/xpressive/proto3/matches.hpp | 14 ++++++------
   branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp | 4 +-
   branches/proto/v3/boost/xpressive/proto3/transform.hpp | 2
   branches/proto/v3/boost/xpressive/proto3/transform/apply.hpp | 26 ++++++++++++------------
   branches/proto/v3/boost/xpressive/proto3/transform/bind.hpp | 4 +-
   branches/proto/v3/boost/xpressive/proto3/transform/fold.hpp | 10 ++++----
   branches/proto/v3/boost/xpressive/proto3/transform/fold_tree.hpp | 8 +++---
   branches/proto/v3/boost/xpressive/proto3/transform/when.hpp | 14 ++++++------
   branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp | 6 ++--
   branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp | 8 +++---
   branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp | 6 ++--
   branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp | 6 ++--
   branches/proto/v3/libs/xpressive/proto3/test/examples.cpp | 40 +++++++++++++++++++-------------------
   branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp | 6 ++--
   branches/proto/v3/libs/xpressive/proto3/test/main.cpp | 24 +++++++++++-----------
   branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp | 16 +++++++-------
   17 files changed, 118 insertions(+), 118 deletions(-)

Modified: branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -253,6 +253,14 @@
               : apply_<Gram, _make_shift_right(_, alternate_end_matcher()), no_next()>
             {};
 
+ struct as_alternates_list
+ : reverse_fold_tree<
+ _
+ , fusion::nil()
+ , alternates_list<as_alternate, _state>(as_alternate, _state)
+ >
+ {};
+
             struct as_marker
               : apply_<
                     _
@@ -299,14 +307,14 @@
>
             {};
 
- template<typename Tag, uint_t, uint_t>
+ template<typename Tag, uint_t = min_type<Tag>::value, uint_t = max_type<Tag>::value>
             struct as_default_repeat_impl
               : apply_<as_repeater<Tag>, as_marker(add_hidden_mark(_arg))>
             {};
 
             template<typename Tag, uint_t Max>
             struct as_default_repeat_impl<Tag, 0, Max>
- : apply_<_, _make_logical_not(as_default_repeat_impl<generic_quant_tag<1, Max>, 1, Max>)>
+ : apply_<_, _make_logical_not(as_default_repeat_impl<generic_quant_tag<1, Max> >)>
             {};
 
             template<typename Tag>
@@ -316,7 +324,7 @@
 
             template<typename Tag>
             struct as_default_repeat
- : as_default_repeat_impl<Tag, min_type<Tag>::value, max_type<Tag>::value>
+ : as_default_repeat_impl<Tag>
             {};
 
             struct as_simple_repeat
@@ -347,28 +355,20 @@
 
             template<typename Dummy>
             struct case_<tag::terminal, Dummy>
- : proto::case_< terminal<_>, as_matcher(_arg, _visitor) >
+ : when< terminal<_>, as_matcher(_arg, _visitor) >
             {};
 
             template<typename Dummy>
             struct case_<tag::shift_right, Dummy>
- : proto::case_<
+ : when<
                     shift_right<Gram, Gram>
                   , reverse_fold_tree<_, _state, in_sequence(Gram, _state) >
>
             {};
 
- struct as_alternates_list
- : reverse_fold_tree<
- _
- , fusion::nil()
- , alternates_list<as_alternate, _state>(as_alternate, _state)
- >
- {};
-
             template<typename Dummy>
             struct case_<tag::bitwise_or, Dummy>
- : proto::case_<
+ : when<
                     bitwise_or<Gram, Gram>
                   , alternate_matcher<as_alternates_list, traits_type<_visitor> >(as_alternates_list)
>
@@ -376,29 +376,29 @@
 
             template<typename Dummy>
             struct case_<tag::dereference, Dummy>
- : proto::case_<dereference<Gram>, as_repeat>
+ : when<dereference<Gram>, as_repeat>
             {};
 
             template<typename Dummy>
             struct case_<tag::posit, Dummy>
- : proto::case_<posit<Gram>, as_repeat>
+ : when<posit<Gram>, as_repeat>
             {};
 
             template<uint_t Min, uint_t Max, typename Dummy>
             struct case_<generic_quant_tag<Min, Max>, Dummy>
- : proto::case_<unary_expr<generic_quant_tag<Min, Max>, Gram>, as_repeat>
+ : when<unary_expr<generic_quant_tag<Min, Max>, Gram>, as_repeat>
             {};
 
             template<typename Dummy>
             struct case_<tag::logical_not, Dummy>
- : proto::or_<
- proto::case_<
+ : or_<
+ when<
                         logical_not<assign<terminal<mark_placeholder>, Gram> >
                       , optional_mark_matcher<as_alternate(_arg), greedy_t>(
                             as_alternate(_arg), mark_number(_arg(_left(_arg)))
                         )
>
- , proto::case_<
+ , when<
                         logical_not<Gram>
                       , optional_matcher<as_alternate(_arg), greedy_t>(
                             as_alternate(_arg)
@@ -409,7 +409,7 @@
 
             template<typename Dummy>
             struct case_<tag::assign, Dummy>
- : proto::case_<
+ : when<
                     assign<terminal<mark_placeholder>, Gram>
                   , Gram(as_marker)
>

Modified: branches/proto/v3/boost/xpressive/proto3/matches.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/matches.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/matches.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -367,7 +367,7 @@
             template<typename Expr, typename If, typename Then, typename Else>
             struct matches_<Expr, proto::if_<If, Then, Else> >
               : mpl::eval_if<
- typename mpl::apply_wrap3<case_<_, If>, Expr, mpl::void_, mpl::void_>::type
+ typename mpl::apply_wrap3<when<_, If>, Expr, mpl::void_, mpl::void_>::type
                   , matches_<Expr, typename Then::proto_base_expr>
                   , matches_<Expr, typename Else::proto_base_expr>
>::type
@@ -463,9 +463,9 @@
             template<typename Expr, typename State, typename Visitor>
             struct apply
               : mpl::eval_if<
- typename mpl::apply_wrap3<case_<_, If>, Expr, State, Visitor>::type
- , mpl::apply_wrap3<case_<_, Then>, Expr, State, Visitor>
- , mpl::apply_wrap3<case_<_, Else>, Expr, State, Visitor>
+ typename mpl::apply_wrap3<when<_, If>, Expr, State, Visitor>::type
+ , mpl::apply_wrap3<when<_, Then>, Expr, State, Visitor>
+ , mpl::apply_wrap3<when<_, Else>, Expr, State, Visitor>
>
             {};
 
@@ -475,9 +475,9 @@
             {
                 typedef
                     typename mpl::if_<
- typename mpl::apply_wrap3<case_<_, If>, Expr, State, Visitor>::type
- , case_<_, Then>
- , case_<_, Else>
+ typename mpl::apply_wrap3<when<_, If>, Expr, State, Visitor>::type
+ , when<_, Then>
+ , when<_, Else>
>::type
                 branch;
 

Modified: branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -368,7 +368,7 @@
         struct reverse_fold_tree;
 
         template<typename Grammar, typename Fun = Grammar>
- struct case_;
+ struct when;
 
         struct _expr;
         struct _state;
@@ -396,7 +396,7 @@
         typedef _arg1 _right;
     }
 
- using transform::case_;
+ using transform::when;
     using transform::_arg0;
     using transform::_arg1;
     using transform::_arg2;

Modified: branches/proto/v3/boost/xpressive/proto3/transform.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -12,8 +12,8 @@
 #include <boost/xpressive/proto3/transform/apply.hpp>
 #include <boost/xpressive/proto3/transform/arg.hpp>
 #include <boost/xpressive/proto3/transform/bind.hpp>
-#include <boost/xpressive/proto3/transform/case.hpp>
 #include <boost/xpressive/proto3/transform/fold.hpp>
 #include <boost/xpressive/proto3/transform/fold_tree.hpp>
+#include <boost/xpressive/proto3/transform/when.hpp>
 
 #endif

Modified: branches/proto/v3/boost/xpressive/proto3/transform/apply.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform/apply.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform/apply.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -36,7 +36,7 @@
             template<typename Expr, typename State, typename Visitor>
             struct apply
               : Trans::template apply<
- typename case_<_, ExprTfx>::template apply<Expr, State, Visitor>::type
+ typename when<_, ExprTfx>::template apply<Expr, State, Visitor>::type
                   , State
                   , Visitor
>
@@ -47,7 +47,7 @@
             call(Expr const &expr, State const &state, Visitor &visitor)
             {
                 return Trans::call(
- case_<_, ExprTfx>::call(expr, state, visitor)
+ when<_, ExprTfx>::call(expr, state, visitor)
                   , state
                   , visitor
                 );
@@ -60,8 +60,8 @@
             template<typename Expr, typename State, typename Visitor>
             struct apply
               : Trans::template apply<
- typename case_<_, ExprTfx>::template apply<Expr, State, Visitor>::type
- , typename case_<_, StateTfx>::template apply<Expr, State, Visitor>::type
+ typename when<_, ExprTfx>::template apply<Expr, State, Visitor>::type
+ , typename when<_, StateTfx>::template apply<Expr, State, Visitor>::type
                   , Visitor
>
             {};
@@ -71,8 +71,8 @@
             call(Expr const &expr, State const &state, Visitor &visitor)
             {
                 return Trans::call(
- case_<_, ExprTfx>::call(expr, state, visitor)
- , case_<_, StateTfx>::call(expr, state, visitor)
+ when<_, ExprTfx>::call(expr, state, visitor)
+ , when<_, StateTfx>::call(expr, state, visitor)
                   , visitor
                 );
             }
@@ -84,9 +84,9 @@
             template<typename Expr, typename State, typename Visitor>
             struct apply
               : Trans::template apply<
- typename case_<_, ExprTfx>::template apply<Expr, State, Visitor>::type
- , typename case_<_, StateTfx>::template apply<Expr, State, Visitor>::type
- , typename case_<_, VisitorTfx>::template apply<Expr, State, Visitor>::type
+ typename when<_, ExprTfx>::template apply<Expr, State, Visitor>::type
+ , typename when<_, StateTfx>::template apply<Expr, State, Visitor>::type
+ , typename when<_, VisitorTfx>::template apply<Expr, State, Visitor>::type
>
             {};
 
@@ -94,11 +94,11 @@
             static typename apply<Expr, State, Visitor>::type
             call(Expr const &expr, State const &state, Visitor &visitor)
             {
- typedef typename case_<_, VisitorTfx>::template apply<Expr, State, Visitor>::type visitor_type;
+ typedef typename when<_, VisitorTfx>::template apply<Expr, State, Visitor>::type visitor_type;
                 return Trans::call(
- case_<_, ExprTfx>::call(expr, state, visitor)
- , case_<_, StateTfx>::call(expr, state, visitor)
- , const_cast<visitor_type &>(as_lvalue(case_<_, VisitorTfx>::call(expr, state, visitor)))
+ when<_, ExprTfx>::call(expr, state, visitor)
+ , when<_, StateTfx>::call(expr, state, visitor)
+ , const_cast<visitor_type &>(as_lvalue(when<_, VisitorTfx>::call(expr, state, visitor)))
                 );
             }
         };

Modified: branches/proto/v3/boost/xpressive/proto3/transform/bind.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform/bind.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform/bind.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -25,7 +25,7 @@
             template<typename Expr, typename State, typename Visitor>
             struct apply
               : boost::result_of<
- Fun(typename case_<_, Args>::template apply<Expr, State, Visitor>::type...)
+ Fun(typename when<_, Args>::template apply<Expr, State, Visitor>::type...)
>
             {};
 
@@ -34,7 +34,7 @@
             call(Expr const &expr, State const &state, Visitor &visitor)
             {
                 Fun f;
- return f(case_<_, Args>::call(expr, state, visitor)...);
+ return f(when<_, Args>::call(expr, state, visitor)...);
             }
         };
 

Deleted: branches/proto/v3/boost/xpressive/proto3/transform/case.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform/case.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
+++ (empty file)
@@ -1,316 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-/// \file transform.hpp
-/// Definition of case_ transform.
-//
-// Copyright 2007 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)
-
-#ifndef BOOST_PROTO3_TRANSFORM_CASE_HPP_EAN_10_29_2007
-#define BOOST_PROTO3_TRANSFORM_CASE_HPP_EAN_10_29_2007
-
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/logical.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/aux_/has_type.hpp>
-#include <boost/type_traits.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/xpressive/proto3/proto_fwd.hpp>
-#include <boost/xpressive/proto3/transform/bind.hpp>
-#include <boost/xpressive/proto3/transform/apply.hpp>
-
-namespace boost { namespace proto
-{
- template<typename T>
- struct is_aggregate
- : is_pod<T>
- {};
-
- template<typename Tag, typename Args, long N>
- struct is_aggregate<expr<Tag, Args, N> >
- : mpl::true_
- {};
-
- namespace detail
- {
- template<typename T, typename EnableIf = void>
- struct transform_category2_
- {
- typedef no_transform type;
- };
-
- template<typename T>
- struct transform_category2_<T, typename T::proto_raw_transform_>
- {
- typedef raw_transform type;
- };
-
- template<typename T>
- struct transform_category2_<T, typename T::proto_function_transform_>
- {
- typedef function_transform type;
- };
-
- template<typename T>
- struct transform_category_
- : transform_category2_<T>
- {};
-
- template<template<typename...> class T, typename... Args>
- struct transform_category_<T<Args...> >
- {
- typedef no_transform type;
- };
- }
-
- template<typename T>
- struct transform_category
- : proto::detail::transform_category_<T>
- {};
-
- // work around GCC bug
- template<typename Tag, typename Args, long N>
- struct transform_category<expr<Tag, Args, N> >
- {
- typedef no_transform type;
- };
-
- namespace transform
- {
- namespace detail
- {
- template<typename... T>
- struct typelist
- {
- typedef void type;
- };
-
- template<typename T, bool HasType = mpl::aux::has_type<T>::value>
- struct nested_type
- {
- typedef typename T::type type;
- };
-
- template<typename T>
- struct nested_type<T, false>
- {
- typedef T type;
- };
-
- template<typename T, typename Args, typename EnableIf = void>
- struct nested_type_if
- : nested_type<T>
- {};
-
- template<typename T, typename... Args>
- struct nested_type_if<T, typelist<Args...>, typename typelist<typename Args::not_applied_...>::type>
- {
- typedef T type;
- typedef void not_applied_;
- };
-
- template<typename R, typename Expr, typename State, typename Visitor
- , typename Category = typename transform_category<R>::type
- >
- struct apply_lambda_;
-
- template<typename R, typename Expr, typename State, typename Visitor>
- struct apply_lambda_aux_
- {
- typedef R type;
- typedef void not_applied_;
- };
-
- template<template<typename...> class R, typename... Args, typename Expr, typename State, typename Visitor>
- struct apply_lambda_aux_<R<Args...>, Expr, State, Visitor>
- : nested_type_if<
- R<typename apply_lambda_<Args, Expr, State, Visitor>::type...>
- , typelist<apply_lambda_<Args, Expr, State, Visitor>...>
- >
- {};
-
- template<typename R, typename Expr, typename State, typename Visitor>
- struct apply_lambda_<R, Expr, State, Visitor, no_transform>
- : apply_lambda_aux_<R, Expr, State, Visitor>
- {};
-
- template<typename R, typename Expr, typename State, typename Visitor>
- struct apply_lambda_<R, Expr, State, Visitor, raw_transform>
- : R::template apply<Expr, State, Visitor>
- {};
-
- template<typename R, typename... Args, typename Expr, typename State, typename Visitor>
- struct apply_lambda_<R(Args...), Expr, State, Visitor, no_transform>
- : case_<_, R(Args...)>::template apply<Expr, State, Visitor>
- {};
-
- template<typename R, typename... Args, typename Expr, typename State, typename Visitor>
- struct apply_lambda_<R(*)(Args...), Expr, State, Visitor, no_transform>
- : case_<_, R(*)(Args...)>::template apply<Expr, State, Visitor>
- {};
-
- // work around GCC bug
- template<typename Tag, typename Args, long N, typename Expr, typename State, typename Visitor>
- struct apply_lambda_<expr<Tag, Args, N>, Expr, State, Visitor, no_transform>
- {
- typedef expr<Tag, Args, N> type;
- typedef void not_applied_;
- };
-
- template<typename Type, typename... Args>
- typename enable_if<is_aggregate<Type>, Type>::type
- construct_(Args &&... args)
- {
- Type that = { args... };
- return that;
- }
-
- template<typename Type, typename... Args>
- typename disable_if<is_aggregate<Type>, Type>::type
- construct_(Args &&... args)
- {
- return Type(args...);
- }
-
- template<typename Type>
- Type construct_()
- {
- return Type();
- }
-
- template<
- typename Expr
- , typename State
- , typename Visitor
- , typename TransformCategory
- , typename Return
- , typename... Args
- >
- struct apply_
- {
- typedef typename apply_lambda_<Return, Expr, State, Visitor>::type lambda_type;
-
- // If the result of applying the lambda on the return type is a transform,
- // apply the transform rather than trying to construct it.
- typedef typename proto::detail::transform_category2_<lambda_type>::type lambda_category;
-
- typedef
- typename mpl::eval_if<
- is_same<no_transform, lambda_category>
- , mpl::identity<lambda_type>
- , apply_<Expr, State, Visitor, lambda_category, lambda_type, Args...>
- >::type
- type;
-
- static type call(Expr const &expr, State const &state, Visitor &visitor)
- {
- return apply_::call_(expr, state, visitor, is_same<no_transform, lambda_category>());
- }
-
- private:
- static type call_(Expr const &expr, State const &state, Visitor &visitor, mpl::true_)
- {
- return detail::construct_<type>(
- case_<_, Args>::call(expr, state, visitor)...
- );
- }
-
- static type call_(Expr const &expr, State const &state, Visitor &visitor, mpl::false_)
- {
- return apply_<Expr, State, Visitor, lambda_category, lambda_type, Args...>::call(expr, state, visitor);
- }
- };
-
- template<
- typename Expr
- , typename State
- , typename Visitor
- , typename Return
- , typename... Args
- >
- struct apply_<Expr, State, Visitor, function_transform, Return, Args...>
- {
- typedef typename bind<Return, Args...>::template apply<Expr, State, Visitor>::type type;
-
- static type call(Expr const &expr, State const &state, Visitor &visitor)
- {
- return bind<Return, Args...>::call(expr, state, visitor);
- }
- };
-
- template<
- typename Expr
- , typename State
- , typename Visitor
- , typename Return
- , typename... Args
- >
- struct apply_<Expr, State, Visitor, raw_transform, Return, Args...>
- {
- typedef typename transform::apply_<Return, Args...>::template apply<Expr, State, Visitor>::type type;
-
- static type call(Expr const &expr, State const &state, Visitor &visitor)
- {
- return transform::apply_<Return, Args...>::call(expr, state, visitor);
- }
- };
-
- }
-
- // Simple transform, takes a raw transform and
- // applies it directly.
- template<typename Grammar, typename Fun>
- struct case_
- : Fun
- {
- typedef typename Grammar::proto_base_expr proto_base_expr;
- };
-
- // Lambda-style transform, takes a raw or function-style
- // transform with arguments and applies it, OR takes a
- // (possibly lambda) type and constructor arguments.
- template<typename Grammar, typename Return, typename... Args>
- struct case_<Grammar, Return(Args...)>
- : raw_transform
- {
- typedef typename Grammar::proto_base_expr proto_base_expr;
-
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : detail::apply_<Expr, State, Visitor, typename transform_category<Return>::type, Return, Args...>
- {};
-
- // BUGBUG makes a temporary
- 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, state, visitor);
- }
- };
-
- template<typename Grammar, typename Return, typename... Args>
- struct case_<Grammar, Return(*)(Args...)>
- : raw_transform
- {
- typedef typename Grammar::proto_base_expr proto_base_expr;
-
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : detail::apply_<Expr, State, Visitor, typename transform_category<Return>::type, Return, Args...>
- {};
-
- 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, state, visitor);
- }
- };
-
- }
-
-}}
-
-#endif

Modified: branches/proto/v3/boost/xpressive/proto3/transform/fold.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform/fold.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform/fold.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -37,7 +37,7 @@
                   : v_(v)
                 {}
 
- typedef case_<_, Transform> Tfx;
+ typedef when<_, Transform> Tfx;
 
                 template<typename Sig>
                 struct result;
@@ -83,8 +83,8 @@
             template<typename Expr, typename State, typename Visitor>
             struct apply
               : fusion::result_of::fold<
- typename case_<_, Sequence>::template apply<Expr, State, Visitor>::type
- , typename case_<_, State0>::template apply<Expr, State, Visitor>::type
+ typename when<_, Sequence>::template apply<Expr, State, Visitor>::type
+ , typename when<_, State0>::template apply<Expr, State, Visitor>::type
                   , detail::as_callable<Fun, Visitor>
>
             {};
@@ -95,8 +95,8 @@
             {
                 detail::as_callable<Fun, Visitor> fun(visitor);
                 return fusion::fold(
- case_<_, Sequence>::call(expr, state, visitor)
- , case_<_, State0>::call(expr, state, visitor)
+ when<_, Sequence>::call(expr, state, visitor)
+ , when<_, State0>::call(expr, state, visitor)
                   , fun
                 );
             }

Modified: branches/proto/v3/boost/xpressive/proto3/transform/fold_tree.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform/fold_tree.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform/fold_tree.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -27,16 +27,16 @@
             template<typename Grammar, typename Fun>
             struct fold_tree_
               : or_<
- case_<Grammar, fold<_, _state, fold_tree_<Grammar, Fun> > >
- , case_<_, Fun>
+ when<Grammar, fold<_, _state, fold_tree_<Grammar, Fun> > >
+ , when<_, Fun>
>
             {};
 
             template<typename Grammar, typename Fun>
             struct reverse_fold_tree_
               : or_<
- case_<Grammar, reverse_fold<_, _state, reverse_fold_tree_<Grammar, Fun> > >
- , case_<_, Fun>
+ when<Grammar, reverse_fold<_, _state, reverse_fold_tree_<Grammar, Fun> > >
+ , when<_, Fun>
>
             {};
 

Copied: branches/proto/v3/boost/xpressive/proto3/transform/when.hpp (from r41422, /branches/proto/v3/boost/xpressive/proto3/transform/case.hpp)
==============================================================================
--- /branches/proto/v3/boost/xpressive/proto3/transform/case.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform/when.hpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 /// \file transform.hpp
-/// Definition of case_ transform.
+/// Definition of when transform.
 //
 // Copyright 2007 Eric Niebler. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
@@ -142,12 +142,12 @@
 
             template<typename R, typename... Args, typename Expr, typename State, typename Visitor>
             struct apply_lambda_<R(Args...), Expr, State, Visitor, no_transform>
- : case_<_, R(Args...)>::template apply<Expr, State, Visitor>
+ : when<_, R(Args...)>::template apply<Expr, State, Visitor>
             {};
 
             template<typename R, typename... Args, typename Expr, typename State, typename Visitor>
             struct apply_lambda_<R(*)(Args...), Expr, State, Visitor, no_transform>
- : case_<_, R(*)(Args...)>::template apply<Expr, State, Visitor>
+ : when<_, R(*)(Args...)>::template apply<Expr, State, Visitor>
             {};
 
             // work around GCC bug
@@ -212,7 +212,7 @@
                 static type call_(Expr const &expr, State const &state, Visitor &visitor, mpl::true_)
                 {
                     return detail::construct_<type>(
- case_<_, Args>::call(expr, state, visitor)...
+ when<_, Args>::call(expr, state, visitor)...
                     );
                 }
 
@@ -261,7 +261,7 @@
         // Simple transform, takes a raw transform and
         // applies it directly.
         template<typename Grammar, typename Fun>
- struct case_
+ struct when
           : Fun
         {
             typedef typename Grammar::proto_base_expr proto_base_expr;
@@ -271,7 +271,7 @@
         // transform with arguments and applies it, OR takes a
         // (possibly lambda) type and constructor arguments.
         template<typename Grammar, typename Return, typename... Args>
- struct case_<Grammar, Return(Args...)>
+ struct when<Grammar, Return(Args...)>
           : raw_transform
         {
             typedef typename Grammar::proto_base_expr proto_base_expr;
@@ -291,7 +291,7 @@
         };
 
         template<typename Grammar, typename Return, typename... Args>
- struct case_<Grammar, Return(*)(Args...)>
+ struct when<Grammar, Return(*)(Args...)>
           : raw_transform
         {
             typedef typename Grammar::proto_base_expr proto_base_expr;

Modified: branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/calc3.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -37,14 +37,14 @@
   : proto::or_<
 
         // placeholders have a non-zero arity ...
- case_< proto::terminal< arg<_> >, _arg >
+ when< proto::terminal< arg<_> >, _arg >
 
         // Any other terminals have arity 0 ...
- , case_< proto::terminal<_>, zero() >
+ , when< proto::terminal<_>, zero() >
 
         // For any non-terminals, find the arity of the children and
         // take the maximum. This is recursive.
- , case_< proto::nary_expr<_, proto::vararg<_> >
+ , when< proto::nary_expr<_, proto::vararg<_> >
              , fold<_, zero(), mpl::max<CalculatorGrammar, _state>() > >
 
>

Modified: branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -59,10 +59,10 @@
 // begin iterators
 struct Begin
   : proto::or_<
- case_< proto::terminal< std::vector<_, _> >, begin(_arg) >
- , case_< proto::terminal< std::list<_, _> >, begin(_arg) >
- , case_< proto::terminal<_> >
- , case_< proto::nary_expr<_, proto::vararg<Begin> > >
+ when< proto::terminal< std::vector<_, _> >, begin(_arg) >
+ , when< proto::terminal< std::list<_, _> >, begin(_arg) >
+ , when< proto::terminal<_> >
+ , when< proto::nary_expr<_, proto::vararg<Begin> > >
>
 {};
 

Modified: branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/rgb.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -78,9 +78,9 @@
 
 struct RGB
   : or_<
- case_< Red, RedTag() >
- , case_< Blue, BlueTag() >
- , case_< Green, GreenTag() >
+ when< Red, RedTag() >
+ , when< Blue, BlueTag() >
+ , when< Green, GreenTag() >
>
 {};
 

Modified: branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/vec3.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -72,12 +72,12 @@
 struct CountLeaves
   : or_<
         // match a Vec3 terminal, return 1
- case_<terminal<int[3]>, one() >
+ when<terminal<int[3]>, one() >
         // match a terminal, return int() (which is 0)
- , case_<terminal<_>, int() >
+ , when<terminal<_>, int() >
         // fold everything else, using std::plus<> to add
         // the leaf count of each child to the accumulated state.
- , case_< nary_expr<_, vararg<_> >, fold<_, int(), iplus(CountLeaves, _state) > >
+ , when< nary_expr<_, vararg<_> >, fold<_, int(), iplus(CountLeaves, _state) > >
>
 {};
 

Modified: branches/proto/v3/libs/xpressive/proto3/test/examples.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/examples.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/examples.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -138,11 +138,11 @@
 //[ CalculatorArityGrammar
 struct CalculatorArity
   : or_<
- case_< terminal< placeholder1 >, one() >
- , case_< terminal< placeholder2 >, two() >
- , case_< terminal<_>, zero() >
- , case_< unary_expr<_, _>, unary_arity >
- , case_< binary_expr<_, _, _>, binary_arity >
+ when< terminal< placeholder1 >, one() >
+ , when< terminal< placeholder2 >, two() >
+ , when< terminal<_>, zero() >
+ , when< unary_expr<_, _>, unary_arity >
+ , when< binary_expr<_, _, _>, binary_arity >
>
 {};
 //]
@@ -150,11 +150,11 @@
 //[ CalculatorArityGrammar2
 struct CalcArity2
   : or_<
- case_< terminal< placeholder1 >, one() >
- , case_< terminal< placeholder2 >, two() >
- , case_< terminal<_>, zero() >
- , case_< unary_expr<_, CalcArity2>, CalcArity2(_arg) >
- , case_< binary_expr<_, CalcArity2, CalcArity2>, mpl::max<CalcArity2(_left), CalcArity2(_right)>() >
+ when< terminal< placeholder1 >, one() >
+ , when< terminal< placeholder2 >, two() >
+ , when< terminal<_>, zero() >
+ , when< unary_expr<_, CalcArity2>, CalcArity2(_arg) >
+ , when< binary_expr<_, CalcArity2, CalcArity2>, mpl::max<CalcArity2(_left), CalcArity2(_right)>() >
>
 {};
 //]
@@ -164,7 +164,7 @@
 // and transforms them into Fusion cons lists of their arguments. In this
 // case, the result would be cons(1, cons('a', cons("b", nil()))).
 struct ArgsAsList
- : case_<
+ : when<
         function<terminal<_>, vararg<terminal<_> > >
       /*<< Use a `reverse_fold<>` transform to iterate over the children
       of this node in reverse order, building a fusion list from back to
@@ -195,13 +195,13 @@
         // This grammar describes what counts as the terminals in expressions
         // of the form (_1=1,'a',"b"), which will be flattened using
         // reverse_fold_tree<> below.
- case_<assign<_, terminal<_> >
+ when<assign<_, terminal<_> >
              , _arg(_right)
>
- , case_<terminal<_>
+ , when<terminal<_>
              , _arg
>
- , case_<
+ , when<
             comma<FoldTreeToList, FoldTreeToList>
           /*<< Fold all terminals that are separated by commas into a Fusion cons list. >>*/
           , reverse_fold_tree<
@@ -221,12 +221,12 @@
   : or_<
         /*<< Match a `terminal<float>`, then construct a
         `terminal<double>::type` with the `float`. >>*/
- case_<terminal<float>, terminal<double>::type(_arg) >
- , case_<terminal<_> >
+ when<terminal<float>, terminal<double>::type(_arg) >
+ , when<terminal<_> >
       /*<< `nary_expr<>` has a pass-through transform which
       will transform each child sub-expression using the
       `Promote` transform. >>*/
- , case_<nary_expr<_, vararg<Promote> > >
+ , when<nary_expr<_, vararg<Promote> > >
>
 {};
 //]
@@ -239,7 +239,7 @@
 // `make_pair_(1, 3.14)` and actually builds a `std::pair<>`
 // from the arguments.
 struct MakePair
- : case_<
+ : when<
         /*<< Match expressions like `make_pair_(1, 3.14)` >>*/
         function<terminal<make_pair_tag>, terminal<_>, terminal<_> >
       /*<< Return `std::pair<F,S>(f,s)` where `f` and `s` are the
@@ -251,14 +251,14 @@
 
 //[ NegateInt
 struct NegateInt
- : case_<terminal<int>, negate<_>(_)>
+ : when<terminal<int>, negate<_>(_)>
 {};
 //]
 
 #ifndef BOOST_MSVC
 //[ SquareAndPromoteInt
 struct SquareAndPromoteInt
- : case_<
+ : when<
         terminal<int>
       , multiplies<terminal<long>::type, terminal<long>::type>::type
             (terminal<long>::type(_arg), terminal<long>::type(_arg))

Modified: branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/lambda.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -63,9 +63,9 @@
     // The lambda grammar, with the transforms for calculating the max arity
     struct Lambda
       : or_<
- case_< terminal< placeholder<_> >, mpl::next<placeholder_arity<_arg> >() >
- , case_< terminal<_>, zero() >
- , case_< nary_expr<_, vararg<_> >, fold<_, zero(), mpl::max<Lambda,_state>()> >
+ when< terminal< placeholder<_> >, mpl::next<placeholder_arity<_arg> >() >
+ , when< terminal<_>, zero() >
+ , when< nary_expr<_, vararg<_> >, fold<_, zero(), mpl::max<Lambda,_state>()> >
>
     {};
 }

Modified: branches/proto/v3/libs/xpressive/proto3/test/main.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/main.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/main.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -87,11 +87,11 @@
 // be compatible with the ops role as a meta-function.
 struct Promote
   : or_<
- case_< terminal<float>, terminal<double>::type(_arg) >
- , case_< posit<Promote>, make_negate(Promote(_arg)) >
- , case_< terminal<char const *>, std::string(_arg) >
- , case_< terminal<_> >
- , case_< nary_expr<_, vararg<Promote> > >
+ when< terminal<float>, terminal<double>::type(_arg) >
+ , when< posit<Promote>, make_negate(Promote(_arg)) >
+ , when< terminal<char const *>, std::string(_arg) >
+ , when< terminal<_> >
+ , when< nary_expr<_, vararg<Promote> > >
>
 {};
 
@@ -107,20 +107,20 @@
 
 struct Arity
   : or_<
- case_< terminal<placeholder<_> >
+ when< terminal<placeholder<_> >
              , _arg
>
- , case_< terminal<_>
+ , when< terminal<_>
              , zero()
>
- , case_< nary_expr<_, vararg<Arity> >
+ , when< nary_expr<_, vararg<Arity> >
              , fold<_, zero(), mpl::max<Arity, _state>() >
>
>
 {};
 
 struct ArgsAsList
- : case_<
+ : when<
         function<terminal<_>, vararg<terminal<_> > >
       , reverse_fold<
             pop_front(_)
@@ -132,13 +132,13 @@
 
 struct FoldTreeToList
   : or_<
- case_<assign<_, terminal<_> >
+ when<assign<_, terminal<_> >
              , _arg(_right)
>
- , case_<terminal<_>
+ , when<terminal<_>
              , _arg
>
- , case_<
+ , when<
             comma<FoldTreeToList, FoldTreeToList>
           , reverse_fold_tree<
                 _

Modified: branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp 2007-11-27 16:36:52 EST (Tue, 27 Nov 2007)
@@ -200,11 +200,11 @@
         // Extract the arg from terminals
         struct SpiritTerminal
           : or_<
- case_< AnyChar, _arg >
- , case_< CharLiteral, if_<_icase, ichar(_arg), _arg> >
- , case_< CharParser, if_<_icase, ichar(_arg(_arg1)), _arg(_arg1)> > // char_('a')
- , case_< NTBSLiteral, if_<_icase, istr(_arg), char const*(_arg)> >
- , case_< CharRangeParser, if_<_icase
+ when< AnyChar, _arg >
+ , when< CharLiteral, if_<_icase, ichar(_arg), _arg> >
+ , when< CharParser, if_<_icase, ichar(_arg(_arg1)), _arg(_arg1)> > // char_('a')
+ , when< NTBSLiteral, if_<_icase, istr(_arg), char const*(_arg)> >
+ , when< CharRangeParser, if_<_icase
                                             , ichar_range(_arg(_arg1), _arg(_arg2))
                                             , char_range(_arg(_arg1), _arg(_arg2))> >// char_('a','z')
>
@@ -217,18 +217,18 @@
         // sequence rule folds all >>'s together into a list
         // and wraps the result in a sequence<> wrapper
         struct SpiritSequence
- : case_< shift_right<SpiritExpr, SpiritExpr>, sequence<FoldToList>(FoldToList) >
+ : when< shift_right<SpiritExpr, SpiritExpr>, sequence<FoldToList>(FoldToList) >
         {};
 
         // alternate rule folds all |'s together into a list
         // and wraps the result in a alternate<> wrapper
         struct SpiritAlternate
- : case_< bitwise_or<SpiritExpr, SpiritExpr>, alternate<FoldToList>(FoldToList) >
+ : when< bitwise_or<SpiritExpr, SpiritExpr>, alternate<FoldToList>(FoldToList) >
         {};
 
         // Directives such as no_case are handled here
         struct SpiritDirective
- : case_< subscript<NoCase, SpiritExpr>, SpiritExpr(_right, _state, True()) >
+ : when< subscript<NoCase, SpiritExpr>, SpiritExpr(_right, _state, True()) >
         {};
 
         // A SpiritExpr is an alternate, a sequence, a directive or a terminal


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