Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-27 16:05:55


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

Log:
begin porting xpressive to proto3 (work in progress)
Added:
   branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp (contents, props changed)
Text files modified:
   branches/proto/v3/boost/xpressive/basic_regex.hpp | 4
   branches/proto/v3/boost/xpressive/detail/core/linker.hpp | 8
   branches/proto/v3/boost/xpressive/detail/core/matcher/optional_matcher.hpp | 8
   branches/proto/v3/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp | 5
   branches/proto/v3/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp | 4
   branches/proto/v3/boost/xpressive/detail/core/peeker.hpp | 6
   branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp | 11 +
   branches/proto/v3/boost/xpressive/detail/dynamic/dynamic.hpp | 16 +-
   branches/proto/v3/boost/xpressive/detail/static/compile.hpp | 6
   branches/proto/v3/boost/xpressive/detail/static/is_pure.hpp | 20 ++--
   branches/proto/v3/boost/xpressive/detail/static/modifier.hpp | 2
   branches/proto/v3/boost/xpressive/detail/static/width_of.hpp | 38 +++---
   branches/proto/v3/boost/xpressive/detail/utility/symbols.hpp | 2
   branches/proto/v3/boost/xpressive/proto3/make_expr.hpp | 47 +++++++-
   branches/proto/v3/boost/xpressive/proto3/matches.hpp | 54 +++++++---
   branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp | 47 +++++++++
   branches/proto/v3/boost/xpressive/proto3/traits.hpp | 22 ++--
   branches/proto/v3/boost/xpressive/proto3/transform/apply.hpp | 4
   branches/proto/v3/boost/xpressive/proto3/transform/arg.hpp | 27 +++++
   branches/proto/v3/boost/xpressive/proto3/transform/case.hpp | 137 ++++++++++++++++-----------
   branches/proto/v3/boost/xpressive/regex_primitives.hpp | 191 ++++++++++++++++++++-------------------
   branches/proto/v3/boost/xpressive/xpressive_fwd.hpp | 7 +
   branches/proto/v3/boost/xpressive/xpressive_typeof.hpp | 10 +-
   branches/proto/v3/libs/xpressive/proto3/test/make_expr.cpp | 22 ++--
   branches/proto/v3/libs/xpressive/proto3/test/matches.cpp | 19 ++-
   branches/proto/v3/libs/xpressive/proto3/test/toy_spirit.cpp | 38 +------
   26 files changed, 440 insertions(+), 315 deletions(-)

Modified: branches/proto/v3/boost/xpressive/basic_regex.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/basic_regex.hpp (original)
+++ branches/proto/v3/boost/xpressive/basic_regex.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -23,8 +23,8 @@
 
 // Doxygen can't handle proto :-(
 #ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-# include <boost/xpressive/detail/static/grammar.hpp>
-# include <boost/xpressive/proto/extends.hpp>
+# include <boost/xpressive/detail/static/grammar2.hpp>
+# include <boost/xpressive/proto3/extends.hpp>
 #endif
 
 #if BOOST_XPRESSIVE_HAS_MS_STACK_GUARD

Modified: branches/proto/v3/boost/xpressive/detail/core/linker.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/linker.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/linker.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -159,7 +159,7 @@
         this->back_stack_.push(next);
     }
 
- template<bool Greedy>
+ template<typename Greedy>
     void accept(repeat_end_matcher<Greedy> const &matcher, void const *)
     {
         matcher.back_ = this->back_stack_.top();
@@ -179,14 +179,14 @@
         this->back_stack_.pop();
     }
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     void accept(optional_matcher<Xpr, Greedy> const &matcher, void const *next)
     {
         this->back_stack_.push(next);
         matcher.xpr_.link(*this);
     }
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     void accept(optional_mark_matcher<Xpr, Greedy> const &matcher, void const *next)
     {
         this->back_stack_.push(next);
@@ -211,7 +211,7 @@
         matcher.xpr_.link(*this);
     }
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     void accept(simple_repeat_matcher<Xpr, Greedy> const &matcher, void const *)
     {
         matcher.xpr_.link(*this);

Modified: branches/proto/v3/boost/xpressive/detail/core/matcher/optional_matcher.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/matcher/optional_matcher.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/matcher/optional_matcher.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -23,7 +23,7 @@
 
     ///////////////////////////////////////////////////////////////////////////////
     // optional_matcher
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     struct optional_matcher
       : quant_style<quant_variable_width, unknown_width::value, Xpr::pure>
     {
@@ -37,7 +37,7 @@
         template<typename BidiIter, typename Next>
         bool match(match_state<BidiIter> &state, Next const &next) const
         {
- return this->match_(state, next, mpl::bool_<Greedy>());
+ return this->match_(state, next, Greedy());
         }
 
     private:
@@ -79,7 +79,7 @@
 
     ///////////////////////////////////////////////////////////////////////////////
     // optional_mark_matcher
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     struct optional_mark_matcher
       : quant_style<quant_variable_width, unknown_width::value, Xpr::pure>
     {
@@ -95,7 +95,7 @@
         template<typename BidiIter, typename Next>
         bool match(match_state<BidiIter> &state, Next const &next) const
         {
- return this->match_(state, next, mpl::bool_<Greedy>());
+ return this->match_(state, next, Greedy());
         }
 
     private:

Modified: branches/proto/v3/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -24,11 +24,10 @@
     ///////////////////////////////////////////////////////////////////////////////
     // repeat_end_matcher
     //
- template<bool Greedy>
+ template<typename Greedy>
     struct repeat_end_matcher
       : quant_style<quant_none, 0, false>
     {
- typedef mpl::bool_<Greedy> greedy_type;
         int mark_number_;
         unsigned int min_, max_;
         mutable void const *back_;
@@ -55,7 +54,7 @@
             bool old_zero_width = br.zero_width_;
             br.zero_width_ = (br.begin_ == state.cur_);
 
- if(this->match_(state, next, greedy_type()))
+ if(this->match_(state, next, Greedy()))
             {
                 return true;
             }

Modified: branches/proto/v3/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -55,12 +55,12 @@
     ///////////////////////////////////////////////////////////////////////////////
     // simple_repeat_matcher
     //
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     struct simple_repeat_matcher
       : quant_style_variable_width
     {
         typedef Xpr xpr_type;
- typedef mpl::bool_<Greedy> greedy_type;
+ typedef mpl::bool_<Greedy::value> greedy_type;
 
         Xpr xpr_;
         unsigned int min_, max_;

Modified: branches/proto/v3/boost/xpressive/detail/core/peeker.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/peeker.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/peeker.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -174,14 +174,14 @@
         return mpl::false_();
     }
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     mpl::false_ accept(optional_matcher<Xpr, Greedy> const &)
     {
         this->fail(); // a union of xpr and next
         return mpl::false_();
     }
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     mpl::false_ accept(optional_mark_matcher<Xpr, Greedy> const &)
     {
         this->fail(); // a union of xpr and next
@@ -225,7 +225,7 @@
         return mpl::false_();
     }
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     mpl::false_ accept(simple_repeat_matcher<Xpr, Greedy> const &xpr)
     {
         0 != xpr.min_ ? xpr.xpr_.peek(*this) : this->fail(); // could be a union of xpr and next

Modified: branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -120,12 +120,12 @@
     template<typename Traits, int Size>
     struct set_matcher;
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     struct simple_repeat_matcher;
 
     struct repeat_begin_matcher;
 
- template<bool Greedy>
+ template<typename Greedy>
     struct repeat_end_matcher;
 
     template<typename Traits, bool ICase, bool Not>
@@ -140,10 +140,10 @@
     template<typename Predicate>
     struct predicate_matcher;
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     struct optional_matcher;
 
- template<typename Xpr, bool Greedy>
+ template<typename Xpr, typename Greedy>
     struct optional_mark_matcher;
 
     template<typename Matcher, typename Traits, bool ICase>
@@ -384,6 +384,9 @@
     };
     #endif
 
+ struct greedy_t : mpl::true_ {};
+ struct non_greedy_t : mpl::false_ {};
+
 }}} // namespace boost::xpressive::detail
 
 namespace boost { namespace xpressive { namespace op

Modified: branches/proto/v3/boost/xpressive/detail/dynamic/dynamic.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/dynamic/dynamic.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/dynamic/dynamic.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -213,12 +213,12 @@
 {
     if(spec.greedy_)
     {
- simple_repeat_matcher<Xpr, true> quant(xpr, spec.min_, spec.max_, seq.width().value());
+ simple_repeat_matcher<Xpr, greedy_t> quant(xpr, spec.min_, spec.max_, seq.width().value());
         seq = make_dynamic<BidiIter>(quant);
     }
     else
     {
- simple_repeat_matcher<Xpr, false> quant(xpr, spec.min_, spec.max_, seq.width().value());
+ simple_repeat_matcher<Xpr, non_greedy_t> quant(xpr, spec.min_, spec.max_, seq.width().value());
         seq = make_dynamic<BidiIter>(quant);
     }
 }
@@ -243,12 +243,12 @@
     seq += make_dynamic<BidiIter>(alternate_end_matcher());
     if(spec.greedy_)
     {
- optional_matcher<xpr_type, true> opt(seq.xpr());
+ optional_matcher<xpr_type, greedy_t> opt(seq.xpr());
         seq = make_dynamic<BidiIter>(opt);
     }
     else
     {
- optional_matcher<xpr_type, false> opt(seq.xpr());
+ optional_matcher<xpr_type, non_greedy_t> opt(seq.xpr());
         seq = make_dynamic<BidiIter>(opt);
     }
 }
@@ -263,12 +263,12 @@
     seq += make_dynamic<BidiIter>(alternate_end_matcher());
     if(spec.greedy_)
     {
- optional_mark_matcher<xpr_type, true> opt(seq.xpr(), mark_nbr);
+ optional_mark_matcher<xpr_type, greedy_t> opt(seq.xpr(), mark_nbr);
         seq = make_dynamic<BidiIter>(opt);
     }
     else
     {
- optional_mark_matcher<xpr_type, false> opt(seq.xpr(), mark_nbr);
+ optional_mark_matcher<xpr_type, non_greedy_t> opt(seq.xpr(), mark_nbr);
         seq = make_dynamic<BidiIter>(opt);
     }
 }
@@ -313,13 +313,13 @@
         repeat_begin_matcher repeat_begin(mark_nbr);
         if(spec.greedy_)
         {
- repeat_end_matcher<true> repeat_end(mark_nbr, min, spec.max_);
+ repeat_end_matcher<greedy_t> repeat_end(mark_nbr, min, spec.max_);
             seq = make_dynamic<BidiIter>(repeat_begin) + seq
                 + make_dynamic<BidiIter>(repeat_end);
         }
         else
         {
- repeat_end_matcher<false> repeat_end(mark_nbr, min, spec.max_);
+ repeat_end_matcher<non_greedy_t> repeat_end(mark_nbr, min, spec.max_);
             seq = make_dynamic<BidiIter>(repeat_begin) + seq
                 + make_dynamic<BidiIter>(repeat_end);
         }

Modified: branches/proto/v3/boost/xpressive/detail/static/compile.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/compile.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/compile.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -15,7 +15,7 @@
 
 #include <boost/mpl/bool.hpp>
 #include <boost/iterator/iterator_traits.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
 #include <boost/xpressive/regex_traits.hpp>
 #include <boost/xpressive/detail/core/regex_impl.hpp>
 #include <boost/xpressive/detail/core/linker.hpp>
@@ -24,7 +24,7 @@
 #include <boost/xpressive/detail/core/matcher/end_matcher.hpp>
 #include <boost/xpressive/detail/static/static.hpp>
 #include <boost/xpressive/detail/static/visitor.hpp>
-#include <boost/xpressive/detail/static/grammar.hpp>
+#include <boost/xpressive/detail/static/grammar2.hpp>
 
 namespace boost { namespace xpressive { namespace detail
 {
@@ -41,7 +41,7 @@
         // "compile" the regex and wrap it in an xpression_adaptor.
         xpression_visitor<BidiIter, mpl::false_, Traits> visitor(traits, impl);
         intrusive_ptr<matchable_ex<BidiIter> const> adxpr = make_adaptor<matchable_ex<BidiIter> >(
- Grammar<char_type>::call(xpr, end_xpression(), visitor)
+ Grammar<char_type>::call(xpr >> end_matcher(), no_next(), visitor)
         );
 
         // Link and optimize the regex

Added: branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp
==============================================================================
--- (empty file)
+++ branches/proto/v3/boost/xpressive/detail/static/grammar2.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -0,0 +1,444 @@
+///////////////////////////////////////////////////////////////////////////////
+// grammar.hpp
+//
+// 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_XPRESSIVE_DETAIL_STATIC_GRAMMAR2_HPP_EAN_11_12_2006
+#define BOOST_XPRESSIVE_DETAIL_STATIC_GRAMMAR2_HPP_EAN_11_12_2006
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/fusion/include/cons.hpp>
+#include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/transform.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/detail/static/is_pure.hpp>
+
+#define BOOST_XPRESSIVE_CHECK_REGEX(Expr, Char)\
+ BOOST_MPL_ASSERT\
+ ((\
+ typename boost::mpl::if_<\
+ boost::xpressive::is_valid_regex<Expr, Char>\
+ , boost::mpl::true_\
+ , boost::xpressive::INVALID_REGULAR_EXPRESSION\
+ >::type\
+ ));
+
+//////////////////////////////////////////////////////////////////////////
+//**********************************************************************//
+//* << NOTE! >> *//
+//* *//
+//* Whenever you change this grammar, you MUST also make corresponding *//
+//* changes to width_of.hpp and is_pure.hpp. *//
+//* *//
+//**********************************************************************//
+//////////////////////////////////////////////////////////////////////////
+
+namespace boost { namespace proto
+{
+ template<>
+ struct is_aggregate<xpressive::detail::mark_placeholder>
+ : mpl::true_
+ {};
+
+ // work around gcc bug.
+ template<unsigned int Min, unsigned int Max>
+ struct transform_category<xpressive::detail::generic_quant_tag<Min, Max> >
+ {
+ typedef no_transform type;
+ };
+}}
+
+namespace boost { namespace xpressive
+{
+ template<typename Char>
+ struct Grammar;
+
+ namespace detail
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // generic_quant_tag
+ template<uint_t Min, uint_t Max>
+ struct generic_quant_tag
+ {
+ typedef mpl::integral_c<uint_t, Min> min_type;
+ typedef mpl::integral_c<uint_t, Max> max_type;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // min_type / max_type
+ template<typename Tag>
+ struct min_type : Tag::min_type {};
+
+ template<>
+ struct min_type<proto::tag::posit> : mpl::integral_c<uint_t, 1> {};
+
+ template<>
+ struct min_type<proto::tag::dereference> : mpl::integral_c<uint_t, 0> {};
+
+ template<>
+ struct min_type<proto::tag::logical_not> : mpl::integral_c<uint_t, 0> {};
+
+ template<typename Tag>
+ struct max_type : Tag::max_type {};
+
+ template<>
+ struct max_type<proto::tag::posit> : mpl::integral_c<uint_t, UINT_MAX-1> {};
+
+ template<>
+ struct max_type<proto::tag::dereference> : mpl::integral_c<uint_t, UINT_MAX-1> {};
+
+ template<>
+ struct max_type<proto::tag::logical_not> : mpl::integral_c<uint_t, 1> {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // alternates_list
+ // a fusion-compatible sequence of alternate expressions, that also keeps
+ // track of the list's width and purity.
+ template<typename Head, typename Tail>
+ struct alternates_list
+ : fusion::cons<Head, Tail>
+ {
+ BOOST_STATIC_CONSTANT(std::size_t, width = Head::width == Tail::width ? Head::width : unknown_width::value);
+ BOOST_STATIC_CONSTANT(bool, pure = Head::pure && Tail::pure);
+
+ alternates_list(Head const &head, Tail const &tail)
+ : fusion::cons<Head, Tail>(head, tail)
+ {
+ }
+ };
+
+ template<typename Head>
+ struct alternates_list<Head, fusion::nil>
+ : fusion::cons<Head, fusion::nil>
+ {
+ BOOST_STATIC_CONSTANT(std::size_t, width = Head::width);
+ BOOST_STATIC_CONSTANT(bool, pure = Head::pure);
+
+ alternates_list(Head const &head, fusion::nil const &tail)
+ : fusion::cons<Head, fusion::nil>(head, tail)
+ {
+ }
+ };
+ }
+
+ namespace grammar_detail
+ {
+ using namespace proto;
+ using namespace transform;
+ using namespace xpressive::detail;
+
+ struct as_matcher : function_transform
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename T, typename Visitor>
+ struct result<This(T, Visitor)>
+ : Visitor::template apply<T>
+ {};
+
+ template<typename T, typename Visitor>
+ typename Visitor::template apply<T>::type
+ operator()(T const &t, Visitor &visitor) const
+ {
+ return visitor.call(t);
+ }
+ };
+
+ struct get_width : function_transform
+ {
+ typedef std::size_t result_type;
+
+ template<typename Xpr>
+ std::size_t operator()(Xpr const &xpr) const
+ {
+ return xpr.get_width().value();
+ }
+ };
+
+ struct mark_number : function_transform
+ {
+ typedef int result_type;
+
+ template<typename Expr>
+ int operator()(Expr const &expr) const
+ {
+ return expr.mark_number_;
+ }
+ };
+
+ struct get_hidden_mark : function_transform
+ {
+ typedef int result_type;
+
+ template<typename Visitor>
+ int operator()(Visitor &visitor) const
+ {
+ return visitor.get_hidden_mark();
+ }
+ };
+
+ // BUGBUG make_expr uses as_expr, not as_arg. Is that right?
+ typedef functional::make_expr<tag::shift_right> _make_shift_right;
+ typedef functional::make_expr<tag::terminal> _make_terminal;
+ typedef functional::make_expr<tag::assign> _make_assign;
+ typedef functional::make_expr<tag::logical_not> _make_logical_not;
+
+ template<typename Visitor>
+ struct traits_type
+ {
+ typedef typename Visitor::traits_type type;
+ };
+
+ struct greedy : mpl::true_ {};
+ struct non_greedy : mpl::false_ {};
+
+ // Place a head and a tail in sequence, if it's not
+ // already in sequence.
+ struct in_sequence : function_transform
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Matcher, typename Next>
+ struct result<This(Matcher, Next)>
+ {
+ typedef static_xpression<Matcher, Next> type;
+ };
+
+ template<typename This, typename Matcher, typename Next, typename Next2>
+ struct result<This(static_xpression<Matcher, Next>, Next2)>
+ {
+ typedef static_xpression<Matcher, Next> type;
+ };
+
+ template<typename Matcher, typename Next>
+ static_xpression<Matcher, Next>
+ operator()(Matcher const &matcher, Next const &next) const
+ {
+ return static_xpression<Matcher, Next>(matcher, next);
+ }
+
+ template<typename Matcher, typename Next, typename Next2>
+ static_xpression<Matcher, Next> const &
+ operator()(static_xpression<Matcher, Next> const &xpr, Next2 const &) const
+ {
+ return xpr;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Cases
+ template<typename Char, typename Gram>
+ struct Cases
+ {
+ // Here are some transforms ...
+ struct as_independent
+ : apply_<Gram, _make_shift_right(_, true_matcher()), no_next()>
+ {};
+
+ struct as_alternate
+ : apply_<Gram, _make_shift_right(_, alternate_end_matcher()), no_next()>
+ {};
+
+ struct as_marker
+ : apply_<
+ _
+ , _make_shift_right(
+ mark_begin_matcher(mark_number(_arg(_left)))
+ , _make_shift_right(
+ _right
+ , mark_end_matcher(mark_number(_arg(_left)))
+ )
+ )
+ >
+ {};
+
+ struct MarkedSubExpr
+ : assign<terminal<mark_placeholder>, _>
+ {};
+
+ struct add_hidden_mark
+ : if_<
+ matches<_, MarkedSubExpr>()
+ , _
+ , _make_assign(mark_placeholder(get_hidden_mark(_visitor)), _)
+ >
+ {};
+
+ template<typename Tag>
+ struct as_repeater
+ : apply_<
+ _
+ , _make_shift_right(
+ repeat_begin_matcher(mark_number(_arg(_left)))
+ , _make_shift_right(
+ _right
+ , repeat_end_matcher<greedy_t>(
+ mark_number(_arg(_left))
+ // BUGBUG work around gcc bug
+ //, min_type<Tag>()
+ //, max_type<Tag>()
+ , always<min_type<Tag> >
+ , always<max_type<Tag> >
+ )
+ )
+ )
+ >
+ {};
+
+ template<typename Tag, uint_t, uint_t>
+ 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>)>
+ {};
+
+ template<typename Tag>
+ struct as_default_repeat_impl<Tag, 0, 1>
+ : apply_<_, _make_logical_not(_arg)>
+ {};
+
+ template<typename Tag>
+ struct as_default_repeat
+ : as_default_repeat_impl<Tag, min_type<Tag>::value, max_type<Tag>::value>
+ {};
+
+ struct as_simple_repeat
+ : apply_<
+ _
+ , simple_repeat_matcher<as_independent(_arg), greedy_t>(
+ as_independent(_arg)
+ , min_type<tag_of<_> >()
+ , max_type<tag_of<_> >()
+ , get_width(as_independent(_arg))
+ )
+ >
+ {};
+
+ struct as_repeat
+ : if_<
+ use_simple_repeat<_arg, Char>()
+ , as_simple_repeat
+ , Gram(as_default_repeat<tag_of<_> >(_))
+ >
+ {};
+
+ // Here are the cases, which use the transforms defined above.
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : not_<_>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::terminal, Dummy>
+ : proto::case_< terminal<_>, as_matcher(_arg, _visitor) >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::shift_right, Dummy>
+ : proto::case_<
+ 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_<
+ bitwise_or<Gram, Gram>
+ , alternate_matcher<as_alternates_list, traits_type<_visitor> >(as_alternates_list)
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::dereference, Dummy>
+ : proto::case_<dereference<Gram>, as_repeat>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::posit, Dummy>
+ : proto::case_<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>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::logical_not, Dummy>
+ : proto::or_<
+ proto::case_<
+ 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_<
+ logical_not<Gram>
+ , optional_matcher<as_alternate(_arg), greedy_t>(
+ as_alternate(_arg)
+ )
+ >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::assign, Dummy>
+ : proto::case_<
+ assign<terminal<mark_placeholder>, Gram>
+ , Gram(as_marker)
+ >
+ {};
+
+ };
+
+ } // namespace detail
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Grammar
+ template<typename Char>
+ struct Grammar
+ : proto::switch_<grammar_detail::Cases<Char, Grammar<Char> > >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // INVALID_REGULAR_EXPRESSION
+ struct INVALID_REGULAR_EXPRESSION
+ : mpl::false_
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // is_valid_regex
+ template<typename Expr, typename Char>
+ struct is_valid_regex
+ : proto::matches<Expr, Grammar<Char> >
+ {};
+
+}} // namespace boost::xpressive
+
+#endif

Modified: branches/proto/v3/boost/xpressive/detail/static/is_pure.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/is_pure.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/is_pure.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -69,8 +69,8 @@
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, proto::tag::shift_right>
       : mpl::and_<
- use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
- , use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ use_simple_repeat_<typename proto::result_of::arg_c<Expr, 0>::type, Char>
+ , use_simple_repeat_<typename proto::result_of::arg_c<Expr, 1>::type, Char>
>
     {};
 
@@ -78,8 +78,8 @@
     struct use_simple_repeat_<Expr, Char, proto::tag::bitwise_or>
       : mpl::and_<
             mpl::not_equal_to<unknown_width, width_of<Expr, Char> >
- , use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
- , use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ , use_simple_repeat_<typename proto::result_of::arg_c<Expr, 0>::type, Char>
+ , use_simple_repeat_<typename proto::result_of::arg_c<Expr, 1>::type, Char>
>
     {};
 
@@ -105,12 +105,12 @@
     // either (s1 = ...) or (a1 = ...) or (set = ...)
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, proto::tag::assign>
- : use_simple_repeat_assign<typename proto::result_of::arg<typename Expr::proto_arg0>::type>
+ : use_simple_repeat_assign<typename proto::result_of::arg<typename proto::result_of::arg_c<Expr, 0>::type>::type>
     {};
 
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, modifier_tag>
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename proto::result_of::arg_c<Expr, 0>::type, Char>
     {};
 
     template<typename Expr, typename Char>
@@ -131,7 +131,7 @@
     // when complementing a set or an assertion, the purity is that of the set (true) or the assertion
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, proto::tag::complement>
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename proto::result_of::arg_c<Expr, 0>::type, Char>
     {};
 
     // The comma is used in list-initialized sets, which are pure
@@ -154,7 +154,7 @@
 
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, proto::tag::subscript>
- : use_simple_repeat_subscript<Expr, Char, typename Expr::proto_arg0::proto_base_expr>
+ : use_simple_repeat_subscript<Expr, Char, typename proto::result_of::arg_c<Expr, 0>::type>
     {};
 
     // Quantified expressions are variable-width and cannot use the simple quantifier
@@ -180,12 +180,12 @@
 
     template<typename Expr, typename Char, uint_t Count>
     struct use_simple_repeat_<Expr, Char, generic_quant_tag<Count, Count> >
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename proto::result_of::arg_c<Expr, 0>::type, Char>
     {};
 
     template<typename Expr, typename Char>
     struct use_simple_repeat_<Expr, Char, proto::tag::negate>
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename proto::result_of::arg_c<Expr, 0>::type, Char>
     {};
 
     ///////////////////////////////////////////////////////////////////////////////

Modified: branches/proto/v3/boost/xpressive/detail/static/modifier.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/modifier.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/modifier.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -17,7 +17,7 @@
 #endif
 
 #include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto3/traits.hpp>
 #include <boost/xpressive/regex_constants.hpp>
 
 namespace boost { namespace xpressive { namespace detail

Modified: branches/proto/v3/boost/xpressive/detail/static/width_of.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/width_of.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/width_of.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -23,7 +23,7 @@
 #include <boost/mpl/equal_to.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto3/traits.hpp>
 
 namespace boost { namespace xpressive { namespace detail
 {
@@ -99,13 +99,13 @@
     struct width_of<Expr, Char, proto::tag::shift_right>
       : mpl::if_<
             mpl::or_<
- mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
- , mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg1::proto_base_expr, Char> >
+ mpl::equal_to<unknown_width, width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char> >
+ , mpl::equal_to<unknown_width, width_of<typename proto::result_of::arg_c<Expr, 1>::type, Char> >
>
           , unknown_width
           , mpl::plus<
- width_of<typename Expr::proto_arg0::proto_base_expr, Char>
- , width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>
+ , width_of<typename proto::result_of::arg_c<Expr, 1>::type, Char>
>
>::type
     {};
@@ -114,14 +114,14 @@
     struct width_of<Expr, Char, proto::tag::bitwise_or>
       : mpl::if_<
             mpl::or_<
- mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
+ mpl::equal_to<unknown_width, width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char> >
               , mpl::not_equal_to<
- width_of<typename Expr::proto_arg0::proto_base_expr, Char>
- , width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>
+ , width_of<typename proto::result_of::arg_c<Expr, 1>::type, Char>
>
>
           , unknown_width
- , width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ , width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>
>::type
     {};
 
@@ -131,7 +131,7 @@
 
     template<typename Expr, typename Char>
     struct width_of_assign<Expr, Char, mark_placeholder>
- : width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ : width_of<typename proto::result_of::arg_c<Expr, 1>::type, Char>
     {};
 
     template<typename Expr, typename Char>
@@ -147,12 +147,12 @@
     // either (s1 = ...) or (a1 = ...) or (set = ...)
     template<typename Expr, typename Char>
     struct width_of<Expr, Char, proto::tag::assign>
- : width_of_assign<Expr, Char, typename proto::result_of::arg<typename Expr::proto_arg0>::type>
+ : width_of_assign<Expr, Char, typename proto::result_of::arg<typename proto::result_of::arg_c<Expr, 0>::type>::type>
     {};
 
     template<typename Expr, typename Char>
     struct width_of<Expr, Char, modifier_tag>
- : width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ : width_of<typename proto::result_of::arg_c<Expr, 1>::type, Char>
     {};
 
     template<typename Expr, typename Char>
@@ -174,7 +174,7 @@
         // If this assert fires, you put something that doesn't require backtracking
         // in a keep(). In that case, the keep() is not necessary and you should just
         // remove it.
- BOOST_MPL_ASSERT_RELATION((width_of<typename Expr::proto_arg0::proto_base_expr, Char>::value), ==, unknown_width::value);
+ BOOST_MPL_ASSERT_RELATION((width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>::value), ==, unknown_width::value);
     };
 
     template<typename Expr, typename Char>
@@ -200,10 +200,10 @@
     template<typename Expr, typename Char, uint_t Count>
     struct width_of<Expr, Char, generic_quant_tag<Count, Count> >
       : mpl::if_<
- mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
+ mpl::equal_to<unknown_width, width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char> >
           , unknown_width
           , mpl::times<
- width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>
               , mpl::size_t<Count>
>
>::type
@@ -211,13 +211,13 @@
 
     template<typename Expr, typename Char>
     struct width_of<Expr, Char, proto::tag::negate>
- : width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ : width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>
     {};
 
     // when complementing a set or an assertion, the width is that of the set (1) or the assertion (0)
     template<typename Expr, typename Char>
     struct width_of<Expr, Char, proto::tag::complement>
- : width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ : width_of<typename proto::result_of::arg_c<Expr, 0>::type, Char>
     {};
 
     // The comma is used in list-initialized sets, and the width of sets are 1
@@ -238,12 +238,12 @@
       : mpl::size_t<1>
     {
         // If Left is "set" then make sure that Right has a width_of 1
- BOOST_MPL_ASSERT_RELATION(1, ==, (width_of<typename Expr::proto_arg1::proto_base_expr, Char>::value));
+ BOOST_MPL_ASSERT_RELATION(1, ==, (width_of<typename proto::result_of::arg_c<Expr, 1>::type, Char>::value));
     };
 
     template<typename Expr, typename Char>
     struct width_of<Expr, Char, proto::tag::subscript>
- : width_of_subscript<Expr, Char, typename Expr::proto_arg0::proto_base_expr>
+ : width_of_subscript<Expr, Char, typename proto::result_of::arg_c<Expr, 0>::type>
     {};
 
 }}} // namespace boost::xpressive::detail

Modified: branches/proto/v3/boost/xpressive/detail/utility/symbols.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/utility/symbols.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/utility/symbols.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -168,7 +168,7 @@
         // conditional rotation : the goal is to minimize the overall
         // weighted path length of each binary search tree
         //
- bool const cond_rotation(bool left, node* const i, node* const j) const
+ bool cond_rotation(bool left, node* const i, node* const j) const
         {
             // don't rotate top node in binary search tree
             if (i == j)

Modified: branches/proto/v3/boost/xpressive/proto3/make_expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/make_expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/make_expr.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -325,7 +325,7 @@
                     make_args_fun
                   , fusion::transform_view<
                         Sequence const
- , functional::as_arg<Domain>
+ , functional::/*as_arg*/ as_expr<Domain>
>
>::type
> expr_type;
@@ -336,8 +336,8 @@
             {
                 fusion::transform_view<
                     Sequence const
- , functional::as_arg<Domain>
- > seq(sequence, functional::as_arg<Domain>());
+ , functional::/*as_arg*/ as_expr<Domain>
+ > seq(sequence, functional::/*as_arg*/ as_expr<Domain>());
 
                 expr_type that = {
                     fusion::invoke_function_object(argsns_::make_cons_fun(), seq)
@@ -386,13 +386,13 @@
         template<typename Tag, typename Domain, typename... Args>
         struct make_expr_
         {
- typedef expr<Tag, args<typename proto::result_of::as_arg<Args, Domain>::type...> > expr_type;
+ typedef expr<Tag, args<typename proto::result_of::/*as_arg*/ as_expr<Args, Domain>::type...> > expr_type;
             typedef typename Domain::template apply<expr_type>::type type;
 
- static type const call(Args &... args)
+ static type call(Args &... args)
             {
                 expr_type that = {
- argsns_::make_cons(proto::result_of::as_arg<Args, Domain>::call(args)...)
+ argsns_::make_cons(proto::result_of::/*as_arg*/ as_expr<Args, Domain>::call(args)...)
                 };
                 return Domain::make(that);
             }
@@ -401,11 +401,20 @@
         template<typename Domain, typename A>
         struct make_expr_<tag::terminal, Domain, A>
         {
- typedef typename add_reference<A>::type reference;
- typedef expr<tag::terminal, term<reference> > expr_type;
+ //typedef typename add_reference<A>::type reference;
+ //typedef expr<tag::terminal, term<reference> > expr_type;
+ //typedef typename Domain::template apply<expr_type>::type type;
+
+ //static type const call(reference a)
+ //{
+ // expr_type that = {{a}};
+ // return Domain::make(that);
+ //}
+
+ typedef expr<tag::terminal, term<UNCVREF(A)> > expr_type;
             typedef typename Domain::template apply<expr_type>::type type;
 
- static type const call(reference a)
+ static type call(A const &a)
             {
                 expr_type that = {{a}};
                 return Domain::make(that);
@@ -564,6 +573,26 @@
     {
         return result_of::make_expr<Tag, Domain, Head, Tail...>::call(head, tail...);
     }
+
+
+ template<typename Tag, typename Domain>
+ struct transform_category<functional::make_expr<Tag, Domain> >
+ {
+ typedef function_transform type;
+ };
+
+ template<typename Tag, typename Domain>
+ struct transform_category<functional::unpack_expr<Tag, Domain> >
+ {
+ typedef function_transform type;
+ };
+
+ template<typename Tag, typename Domain>
+ struct transform_category<functional::unfused_expr<Tag, Domain> >
+ {
+ typedef function_transform type;
+ };
+
 }}
 
 #undef CV

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:05:53 EST (Tue, 27 Nov 2007)
@@ -11,9 +11,12 @@
 
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/bool.hpp>
+#include <boost/mpl/void.hpp>
 #include <boost/mpl/apply.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/identity.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/apply_wrap.hpp>
 #include <boost/type_traits.hpp>
 #include <boost/xpressive/proto3/proto_fwd.hpp>
 #include <boost/xpressive/proto3/transform/arg.hpp>
@@ -361,9 +364,13 @@
             {};
 
             // handle proto::if_
- template<typename Expr, typename Condition>
- struct matches_<Expr, proto::if_<Condition> >
- : mpl::apply1<Condition, Expr>::type
+ 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
+ , matches_<Expr, typename Then::proto_base_expr>
+ , matches_<Expr, typename Else::proto_base_expr>
+ >::type
             {};
 
             // handle proto::not_
@@ -448,23 +455,34 @@
         };
 
         // if_
- template<typename Condition, typename Then, typename Else>
- struct if_
- : or_<
- and_<if_<Condition>, Then>
- , and_<not_<if_<Condition> >, Else>
- >
- {};
-
- template<typename Condition, typename Then>
- struct if_<Condition, Then, void>
- : and_<if_<Condition>, Then>
- {};
-
- template<typename Condition>
- struct if_<Condition, void, void> : _expr
+ template<typename If, typename Then, typename Else>
+ struct if_ : raw_transform
         {
             typedef if_ proto_base_expr;
+
+ 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>
+ >
+ {};
+
+ template<typename Expr, typename State, typename Visitor>
+ static typename apply<Expr, State, Visitor>::type
+ call(Expr const &expr, State const &state, Visitor &visitor)
+ {
+ typedef
+ typename mpl::if_<
+ typename mpl::apply_wrap3<case_<_, If>, Expr, State, Visitor>::type
+ , case_<_, Then>
+ , case_<_, Else>
+ >::type
+ branch;
+
+ return branch::call(expr, state, visitor);
+ }
         };
 
         template<typename Grammar>

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:05:53 EST (Tue, 27 Nov 2007)
@@ -295,15 +295,15 @@
         template<typename... Alts>
         struct and_;
 
- template<typename Condition, typename Then = void, typename Else = void>
+ template<typename Grammar>
+ struct not_;
+
+ template<typename If, typename Then = _, typename Else = not_<_> >
         struct if_;
 
         template<typename Cases>
         struct switch_;
 
- template<typename Grammar>
- struct not_;
-
         template<typename T>
         struct exact;
 
@@ -329,6 +329,9 @@
     template<typename T>
     struct transform_category;
 
+ template<typename T>
+ struct is_aggregate;
+
     namespace transform
     {
         // Transforms can be of these 3 types
@@ -370,14 +373,50 @@
         struct _expr;
         struct _state;
         struct _visitor;
+
+ template<int I>
+ struct _arg_c;
+
+ template<typename T>
+ struct always;
+
+ 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;
     }
 
     using transform::case_;
+ 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::bind;
     using transform::fold;
+ using transform::always;
     using transform::reverse_fold;
     using transform::fold_tree;
     using transform::reverse_fold_tree;

Modified: branches/proto/v3/boost/xpressive/proto3/traits.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/traits.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/traits.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -12,6 +12,7 @@
 #include <boost/type_traits.hpp>
 #include <boost/mpl/logical.hpp>
 #include <boost/xpressive/proto3/proto_fwd.hpp>
+#include <boost/xpressive/proto3/args.hpp>
 
 #define CV(T)\
     typename add_const<T>::type
@@ -302,7 +303,7 @@
 
         template<typename Expr, long N>
         struct arg_c
- : detail::arg_c<typename Expr::proto_args::cons_type, N>
+ : detail::arg_c<typename Expr::proto_args::cons_type, N>
         {};
 
         template<typename Expr>
@@ -332,9 +333,8 @@
 
             typedef expr<tag::terminal, term<value_type> > expr_type;
             typedef typename Domain::template apply<expr_type>::type type;
- typedef type const result_type;
 
- static result_type call(CVREF(T) t)
+ static type call(CVREF(T) t)
             {
                 return Domain::make(expr_type::make(t));
             }
@@ -343,10 +343,9 @@
         template<typename T, typename Domain>
         struct as_expr<T, Domain, typename T::proto_is_expr_>
         {
- typedef typename T::proto_derived_expr type;
- typedef T const &result_type;
+ typedef typename T::proto_derived_expr type; // strips the cv-qualification
 
- static T const &call(T const &t)
+ static type call(T const &t)
             {
                 return t;
             }
@@ -355,10 +354,9 @@
         template<typename T, typename Domain>
         struct as_expr<T &, Domain, typename T::proto_is_expr_>
         {
- typedef typename T::proto_derived_expr type;
- typedef T &result_type;
+ typedef typename T::proto_derived_expr type; // strips the cv-qualification
 
- static T &call(T &t)
+ static type call(T &t)
             {
                 return t;
             }
@@ -427,7 +425,7 @@
             {};
 
             template<typename T>
- typename result_of::as_expr<T, Domain>::result_type
+ typename result_of::as_expr<T, Domain>::type
             operator ()(T &&t) const
             {
                 return result_of::as_expr<T, Domain>::call(t);
@@ -558,13 +556,13 @@
     }
 
     template<typename T>
- typename result_of::as_expr<T>::result_type as_expr(T &&t)
+ typename result_of::as_expr<T>::type as_expr(T &&t)
     {
         return result_of::as_expr<T>::call(t);
     }
 
     template<typename Domain, typename T>
- typename result_of::as_expr<T, Domain>::result_type as_expr(T &&t)
+ typename result_of::as_expr<T, Domain>::type as_expr(T &&t)
     {
         return result_of::as_expr<T, Domain>::call(t);
     }

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:05:53 EST (Tue, 27 Nov 2007)
@@ -55,7 +55,7 @@
         };
 
         template<typename Trans, typename ExprTfx, typename StateTfx>
- struct apply_<Trans, ExprTfx, StateTfx>
+ struct apply_<Trans, ExprTfx, StateTfx> : raw_transform
         {
             template<typename Expr, typename State, typename Visitor>
             struct apply
@@ -79,7 +79,7 @@
         };
 
         template<typename Trans, typename ExprTfx, typename StateTfx, typename VisitorTfx>
- struct apply_<Trans, ExprTfx, StateTfx, VisitorTfx>
+ struct apply_<Trans, ExprTfx, StateTfx, VisitorTfx> : raw_transform
         {
             template<typename Expr, typename State, typename Visitor>
             struct apply

Modified: branches/proto/v3/boost/xpressive/proto3/transform/arg.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/transform/arg.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/transform/arg.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -97,8 +97,35 @@
         typedef _arg0 _left;
         typedef _arg1 _right;
 
+ template<typename T>
+ struct always : raw_transform
+ {
+ template<typename, typename, typename>
+ struct apply
+ {
+ typedef T type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ static T call(Expr const &, State const &, Visitor &)
+ {
+ return T();
+ }
+ };
     }
 
+ template<typename T>
+ struct transform_category<transform::always<T> >
+ {
+ typedef raw_transform type;
+ };
+
+ template<int I>
+ struct transform_category<transform::_arg_c<I> >
+ {
+ typedef raw_transform type;
+ };
+
 }}
 
 #endif

Modified: 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/case.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -11,6 +11,8 @@
 
 #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>
@@ -20,6 +22,60 @@
 
 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
@@ -30,16 +86,6 @@
                 typedef void type;
             };
 
- 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_
- {};
-
             template<typename T, bool HasType = mpl::aux::has_type<T>::value>
             struct nested_type
             {
@@ -67,7 +113,7 @@
             template<typename R, typename Expr, typename State, typename Visitor
                 , typename Category = typename transform_category<R>::type
>
- struct apply_lambda_; // function-style transforms cannot be part of lambdas
+ struct apply_lambda_;
 
             template<typename R, typename Expr, typename State, typename Visitor>
             struct apply_lambda_aux_
@@ -143,14 +189,37 @@
>
             struct apply_
             {
- typedef typename apply_lambda_<Return, Expr, State, Visitor>::type type;
+ 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<
@@ -242,50 +311,6 @@
 
     }
 
- 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;
- };
-
 }}
 
 #endif

Modified: branches/proto/v3/boost/xpressive/regex_primitives.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_primitives.hpp (original)
+++ branches/proto/v3/boost/xpressive/regex_primitives.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -21,8 +21,8 @@
 
 // Doxygen can't handle proto :-(
 #ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-# include <boost/xpressive/proto/proto.hpp>
-# include <boost/xpressive/proto/transform/arg.hpp>
+# include <boost/xpressive/proto3/proto.hpp>
+# include <boost/xpressive/proto3/transform/arg.hpp>
 # include <boost/xpressive/detail/core/icase.hpp>
 # include <boost/xpressive/detail/static/compile.hpp>
 # include <boost/xpressive/detail/static/modifier.hpp>
@@ -52,50 +52,51 @@
         using proto::extends<basic_mark_tag, mark_tag>::operator =;
     };
 
- template<typename Grammar>
- struct push_back_sub
- : proto::transform::identity<Grammar>
- {
- template<typename Sub>
- static int to_sub(Sub const &sub, proto::tag::terminal)
- {
- return proto::arg(sub).mark_number_;
- }
-
- template<typename Sub>
- static int to_sub(Sub const &, proto::tag::negate)
- {
- return -1;
- }
-
- template<typename Expr, typename State, typename Visitor>
- static Expr const &call(Expr const &expr, State const &, Visitor &subs)
- {
- subs.push_back(push_back_sub::to_sub(expr, typename Expr::proto_tag()));
- return expr;
- }
- };
-
- // s1 or -s1
- struct SubMatch
- : push_back_sub<proto::or_<basic_mark_tag, proto::negate<basic_mark_tag > > >
- {};
-
- struct SubMatchList
- : proto::or_<SubMatch, proto::comma<SubMatchList, SubMatch> >
- {};
-
- template<typename Subs>
- typename enable_if<
- mpl::and_<proto::is_expr<Subs>, proto::matches<Subs, SubMatchList> >
- , std::vector<int>
- >::type
- to_vector(Subs const &subs)
- {
- std::vector<int> subs_;
- SubMatchList::call(subs, 0, subs_);
- return subs_;
- }
+ //template<typename Grammar>
+ //struct push_back_sub
+ // //: proto::transform::identity<Grammar>
+ // : proto::_expr
+ //{
+ // template<typename Sub>
+ // static int to_sub(Sub const &sub, proto::tag::terminal)
+ // {
+ // return proto::arg(sub).mark_number_;
+ // }
+
+ // template<typename Sub>
+ // static int to_sub(Sub const &, proto::tag::negate)
+ // {
+ // return -1;
+ // }
+
+ // template<typename Expr, typename State, typename Visitor>
+ // static Expr const &call(Expr const &expr, State const &, Visitor &subs)
+ // {
+ // subs.push_back(push_back_sub::to_sub(expr, typename Expr::proto_tag()));
+ // return expr;
+ // }
+ //};
+
+ //// s1 or -s1
+ //struct SubMatch
+ // : push_back_sub<proto::or_<basic_mark_tag, proto::negate<basic_mark_tag > > >
+ //{};
+
+ //struct SubMatchList
+ // : proto::or_<SubMatch, proto::comma<SubMatchList, SubMatch> >
+ //{};
+
+ //template<typename Subs>
+ //typename enable_if<
+ // mpl::and_<proto::is_expr<Subs>, proto::matches<Subs, SubMatchList> >
+ // , std::vector<int>
+ //>::type
+ //to_vector(Subs const &subs)
+ //{
+ // std::vector<int> subs_;
+ // SubMatchList::call(subs, 0, subs_);
+ // return subs_;
+ //}
 
 
 /*
@@ -139,14 +140,14 @@
 unsigned int const inf = UINT_MAX-1;
 
 /// INTERNAL ONLY (for backwards compatibility)
-proto::terminal<detail::epsilon_matcher>::type const epsilon = {{}};
+proto::terminal<detail::epsilon_matcher>::type const epsilon = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Successfully matches nothing.
 ///
 /// Successfully matches a zero-width sequence. nil always succeeds and
 /// never consumes any characters.
-proto::terminal<detail::epsilon_matcher>::type const nil = {{}};
+proto::terminal<detail::epsilon_matcher>::type const nil = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches an alpha-numeric character.
@@ -156,7 +157,7 @@
 ///
 /// \attention alnum is equivalent to /[[:alnum:]]/ in perl. ~alnum is equivalent
 /// to /[[:^alnum:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const alnum = {{"alnum", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const alnum = {{{"alnum", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches an alphabetic character.
@@ -166,7 +167,7 @@
 ///
 /// \attention alpha is equivalent to /[[:alpha:]]/ in perl. ~alpha is equivalent
 /// to /[[:^alpha:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const alpha = {{"alpha", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const alpha = {{{"alpha", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a blank (horizonal white-space) character.
@@ -176,7 +177,7 @@
 ///
 /// \attention blank is equivalent to /[[:blank:]]/ in perl. ~blank is equivalent
 /// to /[[:^blank:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const blank = {{"blank", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const blank = {{{"blank", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a control character.
@@ -186,7 +187,7 @@
 ///
 /// \attention cntrl is equivalent to /[[:cntrl:]]/ in perl. ~cntrl is equivalent
 /// to /[[:^cntrl:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const cntrl = {{"cntrl", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const cntrl = {{{"cntrl", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a digit character.
@@ -196,7 +197,7 @@
 ///
 /// \attention digit is equivalent to /[[:digit:]]/ in perl. ~digit is equivalent
 /// to /[[:^digit:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const digit = {{"digit", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const digit = {{{"digit", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a graph character.
@@ -206,7 +207,7 @@
 ///
 /// \attention graph is equivalent to /[[:graph:]]/ in perl. ~graph is equivalent
 /// to /[[:^graph:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const graph = {{"graph", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const graph = {{{"graph", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a lower-case character.
@@ -216,7 +217,7 @@
 ///
 /// \attention lower is equivalent to /[[:lower:]]/ in perl. ~lower is equivalent
 /// to /[[:^lower:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const lower = {{"lower", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const lower = {{{"lower", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a printable character.
@@ -226,7 +227,7 @@
 ///
 /// \attention print is equivalent to /[[:print:]]/ in perl. ~print is equivalent
 /// to /[[:^print:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const print = {{"print", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const print = {{{"print", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a punctuation character.
@@ -236,7 +237,7 @@
 ///
 /// \attention punct is equivalent to /[[:punct:]]/ in perl. ~punct is equivalent
 /// to /[[:^punct:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const punct = {{"punct", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const punct = {{{"punct", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a space character.
@@ -246,7 +247,7 @@
 ///
 /// \attention space is equivalent to /[[:space:]]/ in perl. ~space is equivalent
 /// to /[[:^space:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const space = {{"space", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const space = {{{"space", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches an upper-case character.
@@ -256,7 +257,7 @@
 ///
 /// \attention upper is equivalent to /[[:upper:]]/ in perl. ~upper is equivalent
 /// to /[[:^upper:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const upper = {{"upper", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const upper = {{{"upper", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a hexadecimal digit character.
@@ -266,14 +267,14 @@
 ///
 /// \attention xdigit is equivalent to /[[:xdigit:]]/ in perl. ~xdigit is equivalent
 /// to /[[:^xdigit:]]/ in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const xdigit = {{"xdigit", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const xdigit = {{{"xdigit", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Beginning of sequence assertion.
 ///
 /// For the character sequence [begin, end), 'bos' matches the
 /// zero-width sub-sequence [begin, begin).
-proto::terminal<detail::assert_bos_matcher>::type const bos = {{}};
+proto::terminal<detail::assert_bos_matcher>::type const bos = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief End of sequence assertion.
@@ -284,7 +285,7 @@
 /// \attention Unlike the perl end of sequence assertion \$, 'eos' will
 /// not match at the position [end-1, end-1) if *(end-1) is '\\n'. To
 /// get that behavior, use (!_n >> eos).
-proto::terminal<detail::assert_eos_matcher>::type const eos = {{}};
+proto::terminal<detail::assert_eos_matcher>::type const eos = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Beginning of line assertion.
@@ -292,7 +293,7 @@
 /// 'bol' matches the zero-width sub-sequence
 /// immediately following a logical newline sequence. The regex traits
 /// is used to determine what constitutes a logical newline sequence.
-proto::terminal<detail::assert_bol_placeholder>::type const bol = {{}};
+proto::terminal<detail::assert_bol_placeholder>::type const bol = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief End of line assertion.
@@ -300,7 +301,7 @@
 /// 'eol' matches the zero-width sub-sequence
 /// immediately preceeding a logical newline sequence. The regex traits
 /// is used to determine what constitutes a logical newline sequence.
-proto::terminal<detail::assert_eol_placeholder>::type const eol = {{}};
+proto::terminal<detail::assert_eol_placeholder>::type const eol = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Beginning of word assertion.
@@ -308,7 +309,7 @@
 /// 'bow' matches the zero-width sub-sequence
 /// immediately following a non-word character and preceeding a word character.
 /// The regex traits are used to determine what constitutes a word character.
-proto::terminal<detail::assert_word_begin>::type const bow = {{}};
+proto::terminal<detail::assert_word_begin>::type const bow = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief End of word assertion.
@@ -316,7 +317,7 @@
 /// 'eow' matches the zero-width sub-sequence
 /// immediately following a word character and preceeding a non-word character.
 /// The regex traits are used to determine what constitutes a word character.
-proto::terminal<detail::assert_word_end>::type const eow = {{}};
+proto::terminal<detail::assert_word_end>::type const eow = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Word boundary assertion.
@@ -326,7 +327,7 @@
 /// constitutes a word character. To match a non-word boundary, use ~_b.
 ///
 /// \attention _b is like \\b in perl. ~_b is like \\B in perl.
-proto::terminal<detail::assert_word_boundary>::type const _b = {{}};
+proto::terminal<detail::assert_word_boundary>::type const _b = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a word character.
@@ -336,7 +337,7 @@
 /// character.
 ///
 /// \attention _w is like \\w in perl. ~_w is like \\W in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const _w = {{"w", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const _w = {{{"w", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a digit character.
@@ -346,7 +347,7 @@
 /// character.
 ///
 /// \attention _d is like \\d in perl. ~_d is like \\D in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const _d = {{"d", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const _d = {{{"d", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a space character.
@@ -356,7 +357,7 @@
 /// character.
 ///
 /// \attention _s is like \\s in perl. ~_s is like \\S in perl.
-proto::terminal<detail::posix_charset_placeholder>::type const _s = {{"s", false}};
+proto::terminal<detail::posix_charset_placeholder>::type const _s = {{{"s", false}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a literal newline character, '\\n'.
@@ -365,7 +366,7 @@
 /// that is not a newline.
 ///
 /// \attention ~_n is like '.' in perl without the /s modifier.
-proto::terminal<char>::type const _n = {'\n'};
+proto::terminal<char>::type const _n = {{'\n'}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches a logical newline sequence.
@@ -374,7 +375,7 @@
 /// line separator class, as determined by the regex traits, or the '\\r\\n' sequence.
 /// For the purpose of back-tracking, '\\r\\n' is treated as a unit.
 /// To match any one character that is not a logical newline, use ~_ln.
-detail::logical_newline_xpression const _ln = {{}};
+detail::logical_newline_xpression const _ln = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Matches any one character.
@@ -383,7 +384,7 @@
 /// '_' matches any one character, including the newline.
 ///
 /// \attention To match any character except the newline, use ~_n
-proto::terminal<detail::any_matcher>::type const _ = {{}};
+proto::terminal<detail::any_matcher>::type const _ = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Reference to the current regex object
@@ -392,7 +393,7 @@
 /// identifier is a short-hand for the current regex object. For instance,
 /// sregex rx = '(' >> (self | nil) >> ')'; will create a regex object that
 /// matches balanced parens such as "((()))".
-proto::terminal<detail::self_placeholder>::type const self = {{}};
+proto::terminal<detail::self_placeholder>::type const self = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Used to create character sets.
@@ -409,11 +410,11 @@
 ///
 /// Sets can be composed of other, possibly complemented, sets. For instance,
 /// set[ ~digit | ~(set= 'a','b','c') ].
-detail::set_initializer_type const set = {{}};
+detail::set_initializer_type const set = {{{}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Sub-match placeholder, like $& in Perl
-mark_tag::proto_base_expr const s0 = {{0}};
+mark_tag::proto_base_expr const s0 = {{{0}}};
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Sub-match placeholder, like $1 in perl.
@@ -427,15 +428,15 @@
 /// After a successful regex_match() or regex_search(), the sub-match placeholders
 /// can be used to index into the match_results\<\> object to retrieve the Nth
 /// sub-match.
-mark_tag::proto_base_expr const s1 = {{1}};
-mark_tag::proto_base_expr const s2 = {{2}};
-mark_tag::proto_base_expr const s3 = {{3}};
-mark_tag::proto_base_expr const s4 = {{4}};
-mark_tag::proto_base_expr const s5 = {{5}};
-mark_tag::proto_base_expr const s6 = {{6}};
-mark_tag::proto_base_expr const s7 = {{7}};
-mark_tag::proto_base_expr const s8 = {{8}};
-mark_tag::proto_base_expr const s9 = {{9}};
+mark_tag::proto_base_expr const s1 = {{{1}}};
+mark_tag::proto_base_expr const s2 = {{{2}}};
+mark_tag::proto_base_expr const s3 = {{{3}}};
+mark_tag::proto_base_expr const s4 = {{{4}}};
+mark_tag::proto_base_expr const s5 = {{{5}}};
+mark_tag::proto_base_expr const s6 = {{{6}}};
+mark_tag::proto_base_expr const s7 = {{{7}}};
+mark_tag::proto_base_expr const s8 = {{{8}}};
+mark_tag::proto_base_expr const s9 = {{{9}}};
 
 // NOTE: For the purpose of xpressive's documentation, make icase() look like an
 // ordinary function. In reality, it is a function object defined in detail/icase.hpp
@@ -491,7 +492,7 @@
 inline typename proto::terminal<detail::range_placeholder<Char> >::type const
 range(Char ch_min, Char ch_max)
 {
- detail::range_placeholder<Char> that = {ch_min, ch_max, false};
+ detail::range_placeholder<Char> that = {{ch_min, ch_max, false}};
     return proto::terminal<detail::range_placeholder<Char> >::type::make(that);
 }
 
@@ -610,15 +611,15 @@
     return mod;
 }
 
-proto::terminal<detail::attribute_placeholder<mpl::int_<1> > >::type const a1 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<2> > >::type const a2 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<3> > >::type const a3 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<4> > >::type const a4 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<5> > >::type const a5 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<6> > >::type const a6 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<7> > >::type const a7 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<8> > >::type const a8 = {{}};
-proto::terminal<detail::attribute_placeholder<mpl::int_<9> > >::type const a9 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<1> > >::type const a1 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<2> > >::type const a2 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<3> > >::type const a3 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<4> > >::type const a4 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<5> > >::type const a5 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<6> > >::type const a6 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<7> > >::type const a7 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<8> > >::type const a8 = {{{}}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<9> > >::type const a9 = {{{}}};
 
 namespace detail
 {

Modified: branches/proto/v3/boost/xpressive/xpressive_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/xpressive_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/xpressive_fwd.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -50,13 +50,16 @@
 # endif
 #endif
 
-#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto3/proto_fwd.hpp>
+#include <boost/xpressive/proto3/traits.hpp>
 
 namespace boost { namespace xpressive
 {
 
     template<typename Char>
+ struct Grammar;
+
+ template<typename Char>
     struct cpp_regex_traits;
 
     template<typename Char>

Modified: branches/proto/v3/boost/xpressive/xpressive_typeof.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/xpressive_typeof.hpp (original)
+++ branches/proto/v3/boost/xpressive/xpressive_typeof.hpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -19,7 +19,7 @@
 #ifndef BOOST_NO_STL_LOCALE
 # include <boost/typeof/std/locale.hpp>
 #endif
-#include <boost/xpressive/proto/proto_typeof.hpp>
+#include <boost/xpressive/proto3/proto_typeof.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
 
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
@@ -85,11 +85,11 @@
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::charset_matcher, (typename)(bool)(typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::logical_newline_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::mark_matcher, (typename)(bool))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::repeat_end_matcher, (bool))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::repeat_end_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::alternate_matcher, (typename)(typename))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::optional_matcher, (typename)(bool))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::optional_mark_matcher, (typename)(bool))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::simple_repeat_matcher, (typename)(bool))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::optional_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::optional_mark_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::simple_repeat_matcher, (typename)(typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::regex_byref_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::regex_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::posix_charset_matcher, (typename))

Modified: branches/proto/v3/libs/xpressive/proto3/test/make_expr.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/make_expr.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/make_expr.cpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -30,16 +30,16 @@
 void test_make_expr()
 {
     int i = 42;
- posit<terminal<int const &>::type>::type p1 = make_expr<tag::posit>(1);
- posit<terminal<int &>::type>::type p2 = make_expr<tag::posit>(i);
+ posit<terminal<int>::type>::type p1 = make_expr<tag::posit>(1);
+ posit<terminal<int>::type>::type p2 = make_expr<tag::posit>(i);
     BOOST_CHECK_EQUAL(arg(arg(p2)), 42);
 
- ewrap<posit<ewrap<terminal<int &>::type> >::type> p3 = make_expr<tag::posit, mydomain>(i);
+ ewrap<posit<ewrap<terminal<int>::type> >::type> p3 = make_expr<tag::posit, mydomain>(i);
     BOOST_CHECK_EQUAL(arg(arg(p3)), 42);
 
     ewrap<plus<
- ewrap<posit<ewrap<terminal<int &>::type> >::type> &
- , ewrap<terminal<int const &>::type>
+ ewrap<posit<ewrap<terminal<int>::type> >::type>
+ , ewrap<terminal<int>::type>
>::type> p4 = make_expr<tag::plus>(p3, 0);
     BOOST_CHECK_EQUAL(arg(arg(left(p4))), 42);
 }
@@ -49,17 +49,17 @@
     int i = 42;
     fusion::vector<int> v1(1);
     fusion::vector<int&> v2(i);
- posit<terminal<int const &>::type>::type p1 = unpack_expr<tag::posit>(v1);
- posit<terminal<int &>::type>::type p2 = unpack_expr<tag::posit>(v2);
+ posit<terminal<int>::type>::type p1 = unpack_expr<tag::posit>(v1);
+ posit<terminal<int>::type>::type p2 = unpack_expr<tag::posit>(v2);
     BOOST_CHECK_EQUAL(arg(arg(p2)), 42);
 
- ewrap<posit<ewrap<terminal<int &>::type> >::type> p3 = unpack_expr<tag::posit, mydomain>(v2);
+ ewrap<posit<ewrap<terminal<int>::type> >::type> p3 = unpack_expr<tag::posit, mydomain>(v2);
     BOOST_CHECK_EQUAL(arg(arg(p3)), 42);
 
- fusion::vector<ewrap<posit<ewrap<terminal<int &>::type> >::type> &, int> v3(p3, 0);
+ fusion::vector<ewrap<posit<ewrap<terminal<int>::type> >::type>, int> v3(p3, 0);
     ewrap<plus<
- ewrap<posit<ewrap<terminal<int &>::type> >::type> &
- , ewrap<terminal<int const &>::type>
+ ewrap<posit<ewrap<terminal<int>::type> >::type>
+ , ewrap<terminal<int>::type>
>::type> p4 = unpack_expr<tag::plus>(v3);
     BOOST_CHECK_EQUAL(arg(arg(left(p4))), 42);
 }

Modified: branches/proto/v3/libs/xpressive/proto3/test/matches.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/matches.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/matches.cpp 2007-11-27 16:05:53 EST (Tue, 27 Nov 2007)
@@ -11,6 +11,7 @@
 #include <boost/mpl/placeholders.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/xpressive/proto3/proto.hpp>
+#include <boost/xpressive/proto3/transform.hpp>
 #include <boost/test/unit_test.hpp>
 
 using namespace boost;
@@ -130,20 +131,22 @@
     assert_matches< terminal<convertible_to<int> > >( as_arg((int_convertible())) );
     assert_matches< terminal<convertible_to<int> > >( as_expr((int_convertible())) );
 
- assert_matches< if_<is_same<proto::result_of::arg<mpl::_>, int> > >( lit(1) );
- assert_not_matches< if_<is_same<proto::result_of::arg<mpl::_>, int> > >( lit('a') );
+ using transform::_arg;
+
+ assert_matches< if_<is_same<_arg, int>() > >( lit(1) );
+ assert_not_matches< if_<is_same<_arg, int>() > >( lit('a') );
 
     assert_matches<
         and_<
             terminal<_>
- , if_<is_same<proto::result_of::arg<mpl::_>, int> >
+ , if_<is_same<_arg, int>() >
>
>( lit(1) );
 
     assert_not_matches<
         and_<
             terminal<_>
- , if_<is_same<proto::result_of::arg<mpl::_>, int> >
+ , if_<is_same<_arg, int>() >
>
>( lit('a') );
 
@@ -201,15 +204,15 @@
 
     assert_matches<
         or_<
- if_<is_same<proto::result_of::arg<mpl::_>, char> >
- , if_<is_same<proto::result_of::arg<mpl::_>, int> >
+ if_<is_same<_arg, char>() >
+ , if_<is_same<_arg, int>() >
>
>( lit(1) );
 
     assert_not_matches<
         or_<
- if_<is_same<proto::result_of::arg<mpl::_>, char> >
- , if_<is_same<proto::result_of::arg<mpl::_>, int> >
+ if_<is_same<_arg, char>() >
+ , if_<is_same<_arg, int>() >
>
>( lit(1u) );
 

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:05:53 EST (Tue, 27 Nov 2007)
@@ -159,31 +159,6 @@
 
     struct True : mpl::true_ {};
 
- // remove_case specializations for stripping case-sensitivity from parsers
- template<typename T, typename CaseSensitive>
- struct remove_case
- {
- typedef T type;
- };
-
- template<>
- struct remove_case<char, True>
- {
- typedef ichar type;
- };
-
- template<>
- struct remove_case<char const *, True>
- {
- typedef istr type;
- };
-
- template<>
- struct remove_case<char_range, True>
- {
- typedef ichar_range type;
- };
-
     ///////////////////////////////////////////////////////////////////////////////
     /// Begin Spirit grammar here
     ///////////////////////////////////////////////////////////////////////////////
@@ -219,14 +194,19 @@
           : terminal<no_case_tag>
         {};
 
+ // The visitor determines the case-sensitivity of the terminals
+ typedef _visitor _icase;
+
         // Extract the arg from terminals
         struct SpiritTerminal
           : or_<
                 case_< AnyChar, _arg >
- , case_< CharLiteral, remove_case<char, _visitor>(_arg) >
- , case_< CharParser, remove_case<char, _visitor>(_arg(_arg1))> // char_('a')
- , case_< NTBSLiteral, remove_case<char const *, _visitor>(_arg) >
- , case_< CharRangeParser, remove_case<char_range, _visitor>(_arg(_arg1), _arg(_arg2))> // char_('a','z')
+ , 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
+ , ichar_range(_arg(_arg1), _arg(_arg2))
+ , char_range(_arg(_arg1), _arg(_arg2))> >// char_('a','z')
>
         {};
 


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