Update of /cvsroot/boost/boost/boost/xpressive/detail/core/matcher
In directory 
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7032/boost/xpressive/detail/core/matcher

Modified Files:
        action_matcher.hpp 
Log Message:
support for late-bound arguments in actions

Index: action_matcher.hpp
===================================================================
RCS file: 
/cvsroot/boost/boost/boost/xpressive/detail/core/matcher/action_matcher.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- action_matcher.hpp  23 Mar 2007 21:43:13 -0000      1.7
+++ action_matcher.hpp  24 Mar 2007 10:07:30 -0000      1.8
@@ -94,12 +94,43 @@
     };
 
     
///////////////////////////////////////////////////////////////////////////////
+    // action_arg_transform
+    //
+    template<typename Grammar>
+    struct action_arg_transform
+      : Grammar
+    {
+        action_arg_transform();
+
+        template<typename Expr, typename State, typename Visitor>
+        struct apply
+        {
+            typedef typename proto::result_of::arg<Expr>::type action_arg_type;
+            typedef typename action_arg_type::type arg_type;
+            typedef typename proto::terminal<arg_type &>::type type;
+        };
+        
+        template<typename Expr, typename State, typename Visitor>
+        static typename apply<Expr, State, Visitor>::type
+        call(Expr const &expr, State const &state, Visitor &)
+        {
+            detail::action_args_type::iterator where = 
state.action_args_->find(&typeid(proto::arg(expr)));
+            if(where == state.action_args_->end())
+            {
+                throw regex_error(regex_constants::error_badarg, "An argument 
to an action was unspecified");
+            }
+            return proto::as_arg(proto::arg(expr).cast(where->second));
+        }
+    };
+
+    
///////////////////////////////////////////////////////////////////////////////
     // BindActionArgs
     //
     struct BindActionArgs
       : proto::or_<
             subreg_transform< proto::terminal<detail::any_matcher> >
           , mark_transform< detail::mark_tag >
+          , action_arg_transform< proto::terminal< action_arg<proto::_, 
proto::_> > >
           , proto::terminal<proto::_>
           , proto::nary_expr<proto::_, proto::vararg<BindActionArgs> >
         >


-------------------------------------------------------------------------
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