Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-12-04 17:55:27


Author: eric_niebler
Date: 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
New Revision: 41706
URL: http://svn.boost.org/trac/boost/changeset/41706

Log:
partial implementation of actions
Text files modified:
   branches/proto/v3/boost/xpressive/detail/core/matcher/action_matcher.hpp | 181 ++++++++++------------------
   branches/proto/v3/boost/xpressive/detail/core/matcher/attr_matcher.hpp | 6
   branches/proto/v3/boost/xpressive/detail/core/peeker.hpp | 4
   branches/proto/v3/boost/xpressive/detail/detail_fwd.hpp | 2
   branches/proto/v3/boost/xpressive/detail/static/grammar.hpp | 250 +++++++++++++++++++++++++++++++++------
   branches/proto/v3/boost/xpressive/proto/fusion.hpp | 25 ++++
   branches/proto/v3/boost/xpressive/proto/make_expr.hpp | 11 +
   branches/proto/v3/boost/xpressive/regex_actions.hpp | 134 ++++++++++----------
   branches/proto/v3/boost/xpressive/xpressive_typeof.hpp | 2
   9 files changed, 384 insertions(+), 231 deletions(-)

Modified: branches/proto/v3/boost/xpressive/detail/core/matcher/action_matcher.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/matcher/action_matcher.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/matcher/action_matcher.hpp 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -27,10 +27,10 @@
 #include <boost/xpressive/detail/core/quant_style.hpp>
 #include <boost/xpressive/detail/core/action.hpp>
 #include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/static/grammar.hpp>
 #include <boost/xpressive/proto/proto.hpp>
 #include <boost/xpressive/proto/context.hpp>
 #include <boost/xpressive/match_results.hpp> // for type_info_less
-#include <boost/xpressive/detail/static/transforms/as_action.hpp> // for 'read_attr'
 #if BOOST_VERSION >= 103500
 # include <boost/xpressive/proto/fusion.hpp>
 # include <boost/fusion/include/transform_view.hpp>
@@ -75,7 +75,7 @@
         typedef
             fusion::transform_view<
                 typename fusion::result_of::push_front<
- typename fusion::result_of::pop_front<proto::children<right_type> >::type const
+ typename fusion::result_of::pop_front<right_type>::type const
                   , reference_wrapper<left_type>
>::type const
               , proto::eval_fun<Context>
@@ -91,7 +91,10 @@
             return fusion::invoke<function_type>(
                 proto::arg(proto::arg_c<0>(proto::right(expr)))
               , evaluated_args(
- fusion::push_front(fusion::pop_front(proto::children_of(proto::right(expr))), boost::ref(proto::left(expr)))
+ fusion::push_front(
+ fusion::pop_front(proto::right(expr))
+ , boost::ref(proto::left(expr))
+ )
                   , proto::eval_fun<Context>(ctx)
                 )
             );
@@ -260,49 +263,42 @@
         Actor actor_;
     };
 
- ///////////////////////////////////////////////////////////////////////////////
- // subreg_transform
- //
- template<typename Grammar>
- struct subreg_transform
- : Grammar
+ struct get_sub_match : proto::transform_base
     {
- subreg_transform();
+ template<typename Sig>
+ struct result;
 
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : proto::terminal<sub_match<typename State::iterator> >
- {};
+ template<typename This, typename State, typename Index>
+ struct result<This(State, Index)>
+ {
+ typedef sub_match<typename State::iterator> type;
+ };
 
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &, State const &state, Visitor &visitor)
+ template<typename State, typename Index>
+ sub_match<typename State::iterator> operator()(State const &state, Index i)
         {
- sub_match<typename State::iterator> const &sub = state.sub_matches_[ visitor ];
- return proto::as_expr(sub);
+ return state.sub_matches_[i];
         }
     };
 
- ///////////////////////////////////////////////////////////////////////////////
- // mark_transform
- //
- template<typename Grammar>
- struct mark_transform
- : Grammar
+ struct get_attr_slot : proto::transform_base
     {
- mark_transform();
+ template<typename Sig>
+ struct result;
 
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : proto::terminal<sub_match<typename State::iterator> >
- {};
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &)
+ template<typename This, typename State, typename Attr>
+ struct result<This(State, Attr)>
         {
- sub_match<typename State::iterator> const &sub = state.sub_matches_[ proto::arg(expr).mark_number_ ];
- return proto::as_expr(sub);
+ typedef typename Attr::matcher_type::value_type::second_type const *type;
+ };
+
+ template<typename State, typename Attr>
+ typename Attr::matcher_type::value_type::second_type const *
+ operator()(State const &state, Attr const &)
+ {
+ typedef typename Attr::matcher_type::value_type::second_type attr_type;
+ int slot = typename Attr::nbr_type();
+ return static_cast<attr_type const *>(state.attr_context_.attr_slots_[slot-1]);
         }
     };
 
@@ -328,99 +324,54 @@
         T const *t_;
     };
 
- ///////////////////////////////////////////////////////////////////////////////
- // attr_transform
- //
- template<typename Grammar>
- struct attr_transform
- : Grammar
+ template<typename Attr>
+ struct attr_value_type
     {
- attr_transform();
-
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : proto::result_of::as_expr<
- opt<typename Expr::proto_arg0::matcher_type::value_type::second_type>
- >
- {};
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &, State const &state, Visitor &)
- {
- typedef typename Expr::proto_arg0::matcher_type::value_type::second_type attr_type;
- int slot = typename Expr::proto_arg0::nbr_type();
- attr_type const *attr = static_cast<attr_type const *>(state.attr_context_.attr_slots_[slot-1]);
- return proto::as_expr(opt<attr_type>(attr));
- }
+ typedef typename Attr::matcher_type::value_type::second_type type;
     };
 
- ///////////////////////////////////////////////////////////////////////////////
- // attr_with_default_transform
- //
- template<typename Grammar>
- struct attr_with_default_transform
- : Grammar
+ template<typename Expr>
+ struct const_reference
     {
- attr_with_default_transform();
-
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : proto::unary_expr<
- attr_with_default_tag
- , typename Grammar::template apply<Expr, State, Visitor>::type
- >
- {};
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
- {
- typename apply<Expr, State, Visitor>::type that = {
- Grammar::call(expr, state, visitor)
- };
- return that;
- }
+ typedef typename proto::result_of::arg<Expr>::const_reference type;
     };
 
- ///////////////////////////////////////////////////////////////////////////////
- // by_ref_transform
- //
- template<typename Grammar>
- struct by_ref_transform
- : Grammar
- {
- by_ref_transform();
-
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : proto::terminal<typename proto::result_of::arg<Expr>::const_reference>
- {};
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &, Visitor &)
- {
- return apply<Expr, State, Visitor>::type::make(proto::arg(expr));
- }
- };
+ using grammar_detail::mark_number;
+ using grammar_detail::read_attr;
 
     ///////////////////////////////////////////////////////////////////////////////
     // BindActionArgs
     //
     struct BindActionArgs
       : proto::or_<
- subreg_transform<proto::terminal<any_matcher> >
- , mark_transform<proto::terminal<mark_placeholder> >
- , attr_transform<proto::terminal<read_attr<proto::_, proto::_> > >
- , by_ref_transform<proto::terminal<proto::_> >
- , attr_with_default_transform<
+ proto::when<
+ proto::terminal<any_matcher>
+ , proto::_make_terminal(get_sub_match(proto::_state, proto::_visitor))
+ >
+ , proto::when<
+ proto::terminal<mark_placeholder>
+ , proto::_make_terminal(get_sub_match(proto::_state, mark_number(proto::_arg)))
+ >
+ , proto::when<
+ proto::terminal<read_attr<proto::_, proto::_> >
+ , proto::_make_terminal(opt<attr_value_type<proto::_arg> >(get_attr_slot(proto::_state, proto::_arg)))
+ >
+ , proto::when<
+ proto::terminal<proto::_>
+ , proto::terminal<const_reference<proto::_> >(proto::_arg)
+ >
+ , proto::when<
                 proto::bitwise_or<
- attr_transform<proto::terminal<read_attr<proto::_, proto::_> > >
+ proto::terminal<read_attr<proto::_, proto::_> >
                   , BindActionArgs
>
+ , proto::functional::make_expr<attr_with_default_tag>(
+ proto::bitwise_or<BindActionArgs, BindActionArgs>
+ )
+ >
+ , proto::otherwise<
+ proto::nary_expr<proto::_, proto::vararg<BindActionArgs> >
>
- , proto::nary_expr<proto::_, proto::vararg<BindActionArgs> >
>
     {};
 
@@ -444,8 +395,8 @@
         bool match(match_state<BidiIter> &state, Next const &next) const
         {
             // Bind the arguments
- typedef typename BindActionArgs::apply<Actor, match_state<BidiIter>, int>::type action_type;
- action<action_type> actor(BindActionArgs::call(this->actor_, state, this->sub_));
+ typedef typename boost::result_of<BindActionArgs(Actor, match_state<BidiIter>, int)>::type action_type;
+ action<action_type> actor(BindActionArgs()(this->actor_, state, this->sub_));
 
             // Put the action in the action list
             actionable const **action_list_tail = state.action_list_tail_;

Modified: branches/proto/v3/boost/xpressive/detail/core/matcher/attr_matcher.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/core/matcher/attr_matcher.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/core/matcher/attr_matcher.hpp 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -65,7 +65,7 @@
     ///////////////////////////////////////////////////////////////////////////////
     // attr_matcher
     // Note: the Matcher is a std::map
- template<typename Matcher, typename Traits, bool ICase>
+ template<typename Matcher, typename Traits, typename ICase>
     struct attr_matcher
       : quant_style<quant_none, 0, false>
     {
@@ -74,7 +74,7 @@
         attr_matcher(int slot, Matcher const &matcher, Traits const& traits)
           : slot_(slot-1)
         {
- char_translate<Traits, ICase> trans(traits);
+ char_translate<Traits, ICase::value> trans(traits);
             this->sym_.load(matcher, trans);
         }
 
@@ -82,7 +82,7 @@
         bool match(match_state<BidiIter> &state, Next const &next) const
         {
             BidiIter tmp = state.cur_;
- char_translate<Traits, ICase> trans(traits_cast<Traits>(state));
+ char_translate<Traits, ICase::value> trans(traits_cast<Traits>(state));
             result_type const &result = this->sym_(state.cur_, state.end_, trans);
             if(result)
             {

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-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -167,10 +167,10 @@
         return mpl::false_();
     }
 
- template<typename Matcher, typename Traits, bool ICase>
+ template<typename Matcher, typename Traits, typename ICase>
     mpl::false_ accept(attr_matcher<Matcher, Traits, ICase> const &xpr)
     {
- xpr.sym_.peek(char_sink<Traits, ICase>(this->bset_, this->get_traits_<Traits>()));
+ xpr.sym_.peek(char_sink<Traits, ICase::value>(this->bset_, this->get_traits_<Traits>()));
         return mpl::false_();
     }
 

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-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -146,7 +146,7 @@
     template<typename Xpr, typename Greedy>
     struct optional_mark_matcher;
 
- template<typename Matcher, typename Traits, bool ICase>
+ template<typename Matcher, typename Traits, typename ICase>
     struct attr_matcher;
 
     template<typename Nbr>

Modified: branches/proto/v3/boost/xpressive/detail/static/grammar.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/grammar.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/grammar.hpp 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -17,6 +17,7 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/min_max.hpp>
 #include <boost/mpl/next_prior.hpp>
 #include <boost/fusion/include/cons.hpp>
 #include <boost/xpressive/proto/proto.hpp>
@@ -58,6 +59,9 @@
     template<typename Char>
     struct Grammar;
 
+ template<typename Char>
+ struct ActionableGrammar;
+
     namespace detail
     {
         ///////////////////////////////////////////////////////////////////////////////
@@ -132,6 +136,21 @@
         using namespace transform;
         using namespace xpressive::detail;
 
+ struct MarkedSubExpr
+ : assign<terminal<mark_placeholder>, _>
+ {};
+
+ struct MarkedSubExprEx
+ : or_<
+ assign<terminal<mark_placeholder>, _>
+ , shift_right<terminal<mark_begin_matcher>, _>
+ , shift_right<
+ terminal<repeat_begin_matcher>
+ , shift_right<shift_right<terminal<mark_begin_matcher>, _>, _>
+ >
+ >
+ {};
+
         template<typename Tag>
         struct is_generic_quant_tag
           : mpl::false_
@@ -260,14 +279,6 @@
             typedef typename Visitor::icase_type type;
         };
 
- // TODO make_expr uses as_expr, not as_arg. Is that right?
- typedef functional::make_expr<tag::assign> _make_assign;
- typedef functional::make_expr<tag::negate> _make_negate;
- typedef functional::make_expr<tag::terminal> _make_terminal;
- typedef functional::make_expr<tag::complement> _make_complement;
- typedef functional::make_expr<tag::logical_not> _make_logical_not;
- typedef functional::make_expr<tag::shift_right> _make_shift_right;
-
         // Place a head and a tail in sequence, if it's not
         // already in sequence.
         struct in_sequence : transform_base
@@ -317,7 +328,8 @@
           : proto::terminal<char>
         {};
 
- struct _one : mpl::int_<1> {};
+ struct _zero : mpl::int_<0> {};
+ struct _one : mpl::int_<1> {};
 
         ///////////////////////////////////////////////////////////////////////////
         // ListSet
@@ -465,27 +477,167 @@
             }
         };
 
+ struct as_marker
+ : call<
+ _make_shift_right(
+ mark_begin_matcher(mark_number(_arg(_left)))
+ , _make_shift_right(
+ _right
+ , mark_end_matcher(mark_number(_arg(_left)))
+ )
+ )
+ >
+ {};
+
+ struct add_hidden_mark
+ : or_<
+ when<MarkedSubExpr, _>
+ , otherwise<_make_assign(mark_placeholder(get_hidden_mark(_visitor)), _)>
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // FindAttr
+ // Look for patterns like (a1= terminal<RHS>) and return the type of the RHS.
+ template<typename Nbr>
+ struct FindAttr
+ : or_<
+ // Ignore nested actions, because attributes are scoped
+ when< subscript<_, _>, _state >
+ , when< terminal<_>, _state >
+ , when< assign<terminal<attribute_placeholder<Nbr> >, _>, _arg(_right) >
+ , when< nary_expr<_, vararg<_> >, fold<_, _state, FindAttr<Nbr> > >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // read_attr
+ // Placeholder that knows the slot number of an attribute as well as the type
+ // of the object stored in it.
+ template<typename Nbr, typename Matcher>
+ struct read_attr
+ {
+ read_attr() {}
+ typedef Nbr nbr_type;
+ typedef Matcher matcher_type;
+ };
+
+ template<typename Attr>
+ struct attr_number
+ {
+ typedef typename Attr::nbr_type type;
+ };
+
+ struct as_read_attr
+ : call<
+ _make_terminal(
+ read_attr<
+ attr_number<_>
+ , bind<FindAttr<attr_number<_> >(_state, mpl::void_(), mpl::void_())>
+ >
+ )
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // DeepCopy
+ // Turn all refs into values, and also bind all attribute placeholders with
+ // the types from which they are being assigned.
+ struct DeepCopy
+ : or_<
+ when< terminal<attribute_placeholder<_> >, as_read_attr(_arg) >
+ , when< terminal<_>, _make_terminal(_arg) >
+ , otherwise< fold<_, _state, DeepCopy> >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // MaxAttr
+ // In an action (rx)[act], find the largest attribute slot being used.
+ struct MaxAttr
+ : or_<
+ when< terminal<attribute_placeholder<_> >, attr_number<_arg>() >
+ , when< terminal<_>, _zero() >
+ // Ignore nested actions, because attributes are scoped:
+ , when< subscript<_, _>, _zero() >
+ , otherwise< fold<_, _zero(), mpl::max<MaxAttr, _state>() > >
+ >
+ {};
+
+ // _expr is (a1 = sym)
+ struct as_attr_matcher
+ : make<
+ attr_matcher<
+ _arg(_right)
+ , traits(_visitor)
+ , icase<_visitor>
+ >(attr_number<_arg(_left)>(), _arg(_right), traits(_visitor))
+ >
+ {};
+
+ struct add_attrs
+ : call<
+ _make_shift_right(
+ attr_begin_matcher<MaxAttr(_, _zero(), int())>()
+ , _make_shift_right(
+ _
+ , attr_end_matcher()
+ )
+ )
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // add_attrs_if
+ struct add_attrs_if
+ : if_<MaxAttr(_, _zero(), int()), add_attrs, _>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // CheckAssertion
+ struct CheckAssertion
+ : proto::function<terminal<check_tag>, _>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // action_transform
+ // Turn A[B] into (mark_begin(n) >> A >> mark_end(n) >> action_matcher<B>(n))
+ // If A and B use attributes, wrap the above expression in
+ // a attr_begin_matcher<Count> / attr_end_matcher pair, where Count is
+ // the number of attribute slots used by the pattern/action.
+ struct as_action
+ : call<
+ add_attrs_if(
+ _make_shift_right(
+ _left
+ , _make_terminal(
+ or_<
+ when<
+ subscript<_, CheckAssertion>
+ , predicate_matcher<DeepCopy(_right, _left, int())>(
+ DeepCopy(_right, _left, int())
+ , mark_number(arg(_left(_left)))
+ )
+ >
+ , otherwise<
+ action_matcher<DeepCopy(_right, _left, int())>(
+ DeepCopy(_right, _left, int())
+ , mark_number(arg(_left(_left)))
+ )
+ >
+ >
+ )
+ )
+ )
+ >
+ {};
+
         ///////////////////////////////////////////////////////////////////////////
         // Cases
         template<typename Char, typename Gram>
         struct Cases
         {
             // Some simple grammars...
- struct MarkedSubExpr
- : assign<terminal<mark_placeholder>, _>
- {};
-
- struct MarkedSubExprEx
- : or_<
- assign<terminal<mark_placeholder>, _>
- , shift_right<terminal<mark_begin_matcher>, _>
- , shift_right<
- terminal<repeat_begin_matcher>
- , shift_right<shift_right<terminal<mark_begin_matcher>, _>, _>
- >
- >
- {};
-
             struct GenericQuant
               : and_<
                     if_<is_generic_quant_tag<tag_of<_> >()>
@@ -514,25 +666,6 @@
>
             {};
 
- struct as_marker
- : call<
- _make_shift_right(
- mark_begin_matcher(mark_number(_arg(_left)))
- , _make_shift_right(
- _right
- , mark_end_matcher(mark_number(_arg(_left)))
- )
- )
- >
- {};
-
- struct add_hidden_mark
- : or_<
- when<MarkedSubExpr, _>
- , otherwise<_make_assign(mark_placeholder(get_hidden_mark(_visitor)), _)>
- >
- {};
-
             template<typename Greedy, typename Tag, typename Base = transform_base>
             struct as_repeater
               : call<
@@ -841,6 +974,10 @@
                         subscript<terminal<set_initializer>, complement<terminal<_> > >
                       , as_regex(_right)
>
+ , when<
+ subscript<ActionableGrammar<Char>, _>
+ , as_regex(as_action(_make_subscript(add_hidden_mark(_left), _right)))
+ >
>
             {};
 
@@ -853,6 +990,28 @@
             {};
         };
 
+ ///////////////////////////////////////////////////////////////////////////
+ // ActionableCases
+ template<typename Char, typename Gram>
+ struct ActionableCases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : Cases<Char, Gram>::template case_<Tag>
+ {};
+
+ // Only in sub-expressions with actions attached do we allow attribute assignements
+ template<typename Dummy>
+ struct case_<tag::assign, Dummy>
+ : or_<
+ typename Cases<Char, Gram>::template case_<tag::assign>
+ , when<
+ assign<terminal<attribute_placeholder<_> >, _>
+ , as_attr_matcher
+ >
+ >
+ {};
+ };
     } // namespace detail
 
     ///////////////////////////////////////////////////////////////////////////
@@ -862,6 +1021,11 @@
       : proto::switch_<grammar_detail::Cases<Char, Grammar<Char> > >
     {};
 
+ template<typename Char>
+ struct ActionableGrammar
+ : proto::switch_<grammar_detail::ActionableCases<Char, ActionableGrammar<Char> > >
+ {};
+
     ///////////////////////////////////////////////////////////////////////////
     // INVALID_REGULAR_EXPRESSION
     struct INVALID_REGULAR_EXPRESSION

Modified: branches/proto/v3/boost/xpressive/proto/fusion.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/fusion.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/fusion.hpp 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -151,6 +151,31 @@
 
     functional::flatten const flatten = {};
 
+ template<typename Context>
+ struct eval_fun
+ {
+ explicit eval_fun(Context &ctx)
+ : ctx_(ctx)
+ {}
+
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : proto::result_of::eval<UNREF(Expr), Context>
+ {};
+
+ template<typename Expr>
+ typename proto::result_of::eval<Expr, Context>::type
+ operator()(Expr &expr) const
+ {
+ return proto::eval(expr, this->ctx_);
+ }
+
+ private:
+ Context &ctx_;
+ };
 }}
 
 namespace boost { namespace fusion

Modified: branches/proto/v3/boost/xpressive/proto/make_expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/make_expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/make_expr.hpp 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -589,6 +589,17 @@
       : mpl::true_
     {};
 
+
+
+ // TODO make_expr uses as_expr, not as_arg. Is that right?
+ typedef functional::make_expr<tag::assign> _make_assign;
+ typedef functional::make_expr<tag::negate> _make_negate;
+ typedef functional::make_expr<tag::terminal> _make_terminal;
+ typedef functional::make_expr<tag::complement> _make_complement;
+ typedef functional::make_expr<tag::logical_not> _make_logical_not;
+ typedef functional::make_expr<tag::shift_right> _make_shift_right;
+
+
 }}
 
 #undef CV

Modified: branches/proto/v3/boost/xpressive/regex_actions.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_actions.hpp (original)
+++ branches/proto/v3/boost/xpressive/regex_actions.hpp 2007-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -86,18 +86,19 @@
         struct check_tag
         {};
 
- template<typename Grammar>
         struct BindArg
- : Grammar
         {
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
             {
                 typedef State type;
             };
 
             template<typename Expr, typename State, typename Visitor>
- static State call(Expr const &expr, State const &state, Visitor &visitor)
+ State operator()(Expr const &expr, State const &state, Visitor &visitor) const
             {
                 visitor.let(expr);
                 return state;
@@ -108,11 +109,12 @@
         {};
 
         struct BindArgs
- : boost::proto::transform::fold<
- boost::proto::function<
- boost::proto::transform::state<boost::proto::terminal<let_tag> >
- , boost::proto::vararg< BindArg< boost::proto::assign<boost::proto::_, boost::proto::_> > >
+ : proto::when<
+ proto::function<
+ proto::terminal<let_tag>
+ , proto::vararg<proto::assign<proto::_, proto::_> >
>
+ , proto::fold<proto::_pop_front(proto::_), proto::_state, BindArg>
>
         {};
 
@@ -130,7 +132,7 @@
         template<typename Args, typename BidiIter>
         void bind_args(let_<Args> const &args, match_results<BidiIter> &what)
         {
- BindArgs::call(args, 0, what);
+ BindArgs()(args, 0, what);
         }
     }
 
@@ -684,45 +686,45 @@
         }
     };
 
- /// as (a.k.a., lexical_cast)
- ///
- BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
- 1
- , as
- , boost::proto::default_domain
- , (boost::proto::tag::function)
- , ((op::as)(typename))
- )
-
- /// static_cast_
- ///
- BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
- 1
- , static_cast_
- , boost::proto::default_domain
- , (boost::proto::tag::function)
- , ((op::static_cast_)(typename))
- )
-
- /// dynamic_cast_
- ///
- BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
- 1
- , dynamic_cast_
- , boost::proto::default_domain
- , (boost::proto::tag::function)
- , ((op::dynamic_cast_)(typename))
- )
-
- /// const_cast_
- ///
- BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
- 1
- , const_cast_
- , boost::proto::default_domain
- , (boost::proto::tag::function)
- , ((op::const_cast_)(typename))
- )
+ ///// as (a.k.a., lexical_cast)
+ /////
+ //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ // 1
+ // , as
+ // , boost::proto::default_domain
+ // , (boost::proto::tag::function)
+ // , ((op::as)(typename))
+ //)
+
+ ///// static_cast_
+ /////
+ //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ // 1
+ // , static_cast_
+ // , boost::proto::default_domain
+ // , (boost::proto::tag::function)
+ // , ((op::static_cast_)(typename))
+ //)
+
+ ///// dynamic_cast_
+ /////
+ //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ // 1
+ // , dynamic_cast_
+ // , boost::proto::default_domain
+ // , (boost::proto::tag::function)
+ // , ((op::dynamic_cast_)(typename))
+ //)
+
+ ///// const_cast_
+ /////
+ //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ // 1
+ // , const_cast_
+ // , boost::proto::default_domain
+ // , (boost::proto::tag::function)
+ // , ((op::const_cast_)(typename))
+ //)
 
     /// val()
     ///
@@ -771,23 +773,23 @@
         BOOST_PROTO_EXTENDS_FUNCTION(action_arg_type, this_type, proto::default_domain)
     };
 
- /// Usage: construct\<Type\>(arg1, arg2)
- ///
- BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
- construct
- , boost::proto::default_domain
- , (boost::proto::tag::function)
- , ((op::construct)(typename))
- )
-
- /// Usage: throw_\<Exception\>(arg1, arg2)
- ///
- BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
- throw_
- , boost::proto::default_domain
- , (boost::proto::tag::function)
- , ((op::throw_)(typename))
- )
+ ///// Usage: construct\<Type\>(arg1, arg2)
+ /////
+ //BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
+ // construct
+ // , boost::proto::default_domain
+ // , (boost::proto::tag::function)
+ // , ((op::construct)(typename))
+ //)
+
+ ///// Usage: throw_\<Exception\>(arg1, arg2)
+ /////
+ //BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
+ // throw_
+ // , boost::proto::default_domain
+ // , (boost::proto::tag::function)
+ // , ((op::throw_)(typename))
+ //)
 
     namespace detail
     {

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-12-04 17:55:26 EST (Tue, 04 Dec 2007)
@@ -101,7 +101,7 @@
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::set_matcher, (typename)(typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::predicate_matcher, (typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::action_matcher, (typename))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::attr_matcher, (typename)(typename)(bool))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::attr_matcher, (typename)(typename)(typename))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::attr_begin_matcher, (typename))
 
 ///////////////////////////////////////////////////////////////////////////////


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