Update of /cvsroot/boost/boost/boost/xpressive
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20098

Modified Files:
        match_results.hpp regex_primitives.hpp sub_match.hpp 
Added Files:
        regex_actions.hpp 
Log Message:
experimental xpressive actions

--- NEW FILE: regex_actions.hpp ---
///////////////////////////////////////////////////////////////////////////////
/// \file regex_actions.hpp
/// Defines the syntax elements of xpressive's action expressions.
//
//  Copyright 2004 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_ACTIONS_HPP_EAN_03_22_2007
#define BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

#include <boost/lexical_cast.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/state.hpp>
#include <boost/xpressive/detail/core/matcher/action_matcher.hpp>

namespace boost { namespace xpressive
{

    namespace detail
    {
        template<typename T>
        T &unconst(T const &t)
        {
            return const_cast<T &>(t);
        }

        struct push_back_impl
        {
            typedef void result_type;

            template<typename Sequence, typename Value>
            void operator()(Sequence &seq, Value const &val) const
            {
                detail::unconst(seq).push_back(val);
            }
        };

        struct push_front_impl
        {
            typedef void result_type;

            template<typename Sequence, typename Value>
            void operator()(Sequence &seq, Value const &val) const
            {
                detail::unconst(seq).push_front(val);
            }
        };

        template<typename T>
        struct as_impl
        {
            typedef T result_type;

            template<typename Value>
            T operator()(Value const &val) const
            {
                return lexical_cast<T>(val);
            }
        };
    }

    proto::terminal<detail::push_back_impl>::type const push_back = {{}};
    proto::terminal<detail::push_front_impl>::type const push_front = {{}};

    template<typename T, typename D>
    typename proto::function<
        typename proto::terminal<detail::as_impl<T> >::type
      , typename proto::result_of::as_arg<D const>::type
    >::type as(D const &d)
    {
        typename proto::function<
            typename proto::terminal<detail::as_impl<T> >::type
          , typename proto::result_of::as_arg<D const>::type
        >::type that = {{{}}, proto::as_arg(d)};
        return that;
    }

    template<typename T>
    typename proto::result_of::as_arg<T>::type var(T &t)
    {
        return proto::as_arg(t);
    }

}}

#endif // BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007

Index: match_results.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/match_results.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- match_results.hpp   18 Mar 2007 21:46:52 -0000      1.12
+++ match_results.hpp   22 Mar 2007 17:37:16 -0000      1.13
@@ -31,7 +31,7 @@
 #include <boost/xpressive/detail/core/sub_match_vector.hpp>
 #include <boost/xpressive/detail/utility/sequence_stack.hpp>
 #include <boost/xpressive/detail/core/results_cache.hpp>
-#include <boost/xpressive/detail/core/action_state.hpp>
+//#include <boost/xpressive/detail/core/action_state.hpp>
 #include <boost/xpressive/detail/utility/literals.hpp>
 #include <boost/xpressive/detail/utility/algorithm.hpp>
 #include <boost/xpressive/detail/utility/counted_base.hpp>
@@ -231,7 +231,7 @@
       , prefix_()
       , suffix_()
       , nested_results_()
-      , action_state_()
+      //, action_state_()
       , extras_ptr_()
       , traits_()
     {
@@ -254,7 +254,7 @@
       , prefix_()
       , suffix_()
       , nested_results_()
-      , action_state_(that.action_state_)
+      //, action_state_(that.action_state_)
       , extras_ptr_()
       , traits_()
     {
@@ -467,7 +467,7 @@
         std::swap(this->prefix_, that.prefix_);
         std::swap(this->suffix_, that.suffix_);
         this->nested_results_.swap(that.nested_results_);
-        std::swap(this->action_state_, that.action_state_);
+        //std::swap(this->action_state_, that.action_state_);
         this->extras_ptr_.swap(that.extras_ptr_);
         this->traits_.swap(that.traits_);
     }
@@ -498,19 +498,19 @@
     // state:
     /// INTERNAL ONLY
     ///
-    template<typename State>
-    void set_action_state(State &state)
-    {
-        this->action_state_.set(state);
-    }
+    //template<typename State>
+    //void set_action_state(State &state)
+    //{
+    //    this->action_state_.set(state);
+    //}
 
     /// INTERNAL ONLY
     ///
-    template<typename State>
-    State &get_action_state() const
-    {
-        return this->action_state_.BOOST_NESTED_TEMPLATE get<State>();
-    }
+    //template<typename State>
+    //State &get_action_state() const
+    //{
+    //    return this->action_state_.BOOST_NESTED_TEMPLATE get<State>();
+    //}
 
 private:
 
@@ -936,7 +936,7 @@
     sub_match<BidiIter> prefix_;
     sub_match<BidiIter> suffix_;
     nested_results_type nested_results_;
-    detail::action_state action_state_;
+    //detail::action_state action_state_;
     intrusive_ptr<extras_type> extras_ptr_;
     intrusive_ptr<detail::traits<char_type> const> traits_;
 };
@@ -945,11 +945,11 @@
 // action_state_cast
 /// INTERNAL ONLY
 ///
-template<typename State, typename BidiIter>
-inline State &action_state_cast(match_results<BidiIter> const &what)
-{
-    return what.BOOST_NESTED_TEMPLATE get_action_state<State>();
-}
+//template<typename State, typename BidiIter>
+//inline State &action_state_cast(match_results<BidiIter> const &what)
+//{
+//    return what.BOOST_NESTED_TEMPLATE get_action_state<State>();
+//}
 
 ///////////////////////////////////////////////////////////////////////////////
 // regex_id_filter_predicate

Index: regex_primitives.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/regex_primitives.hpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- regex_primitives.hpp        12 Mar 2007 22:11:29 -0000      1.25
+++ regex_primitives.hpp        22 Mar 2007 17:37:16 -0000      1.26
@@ -16,7 +16,6 @@
 #include <boost/xpressive/proto/proto.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
 #include <boost/xpressive/detail/core/icase.hpp>
-#include <boost/xpressive/detail/core/action.hpp>
 #include <boost/xpressive/detail/core/matchers.hpp>
 #include <boost/xpressive/detail/static/compile.hpp>
 #include <boost/xpressive/detail/static/grammar.hpp>

Index: sub_match.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/sub_match.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sub_match.hpp       17 Apr 2006 19:36:52 -0000      1.5
+++ sub_match.hpp       22 Mar 2007 17:37:16 -0000      1.6
@@ -328,6 +328,56 @@
     return lhs.str() <= rhs;
 }
 
+// Operator+ convenience function
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+    return lhs.str() + rhs.str();
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, typename 
iterator_value<BidiIter>::type const &rhs)
+{
+    return lhs.str() + rhs;
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (typename iterator_value<BidiIter>::type const &lhs, 
sub_match<BidiIter> const &rhs)
+{
+    return lhs + rhs.str();
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, typename 
iterator_value<BidiIter>::type const *rhs)
+{
+    return lhs.str() + rhs;
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (typename iterator_value<BidiIter>::type const *lhs, 
sub_match<BidiIter> const &rhs)
+{
+    return lhs + rhs.str();
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, typename 
sub_match<BidiIter>::string_type const &rhs)
+{
+    return lhs.str() + rhs;
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (typename sub_match<BidiIter>::string_type const &lhs, 
sub_match<BidiIter> const &rhs)
+{
+    return lhs + rhs.str();
+}
+
 }} // namespace boost::xpressive
 
 #endif


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to