|
Boost-Commit : |
From: hartmut.kaiser_at_[hidden]
Date: 2008-04-20 17:39:37
Author: hkaiser
Date: 2008-04-20 17:39:36 EDT (Sun, 20 Apr 2008)
New Revision: 44655
URL: http://svn.boost.org/trac/boost/changeset/44655
Log:
Spirit.Lex: Fixed wrap_action
Text files modified:
trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp | 83 +++++++++++++--------------------------
1 files changed, 28 insertions(+), 55 deletions(-)
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp 2008-04-20 17:39:36 EDT (Sun, 20 Apr 2008)
@@ -15,8 +15,6 @@
#include <boost/spirit/home/phoenix/bind.hpp>
#include <boost/spirit/home/phoenix/scope.hpp>
-#include <boost/bind.hpp>
-
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace lex { namespace detail
{
@@ -31,50 +29,30 @@
}
// wrap phoenix actor, make sure first argument is a fusion sequence
- //~ template <typename Eval>
- //~ static void phoenix_action(phoenix::actor<Eval> const& f,
- //~ Attribute const& attr, std::size_t id, bool& pass, Context& ctx)
- //~ {
- //~ f(spirit::detail::pass_value<Attribute const>::call(attr), id, pass, ctx);
- //~ }
-
- struct phoenix_action
- {
- template <typename F, typename T1, typename T2, typename T3, typename T4>
- struct result { typedef void type; };
-
- template <typename Eval>
- void
- operator()(phoenix::actor<Eval> const& f, Attribute const& attr,
- std::size_t id, bool& pass, Context& ctx) const
- {
- f(spirit::detail::pass_value<Attribute const>::call(attr), id, pass, ctx);
- }
- };
+ struct phoenix_action
+ {
+ template <typename F, typename T1, typename T2, typename T3, typename T4>
+ struct result { typedef void type; };
+
+ template <typename Eval>
+ void
+ operator()(phoenix::actor<Eval> const& f, Attribute const& attr,
+ std::size_t id, bool& pass, Context& ctx) const
+ {
+ f (spirit::detail::pass_value<Attribute const>::call(attr),
+ id, pass, ctx);
+ }
+ };
template <typename Eval>
static FunctionType call(phoenix::actor<Eval> const& f)
{
- using phoenix::arg_names::_1;
- using phoenix::arg_names::_2;
- using phoenix::arg_names::_3;
- using phoenix::arg_names::_4;
-
- //~ void (*pf)(phoenix::actor<Eval> const&,
- //~ Attribute const&, std::size_t, bool&, Context&) =
- //~ &wrap_action::phoenix_action;
-
- //~ return phoenix::bind(pf, f, arg1, arg2, arg3, arg4);
-
- return phoenix::bind(phoenix_action(), phoenix::lambda[f], _1, _2, _3, _4);
-
- //~ return phoenix::bind(phoenix::lambda[f], f, _1, _2, _3, _4);
-
- //~ return boost::bind(pf, f, _1, _2, _3, _4);
- //~ return phoenix::bind(pf, f, _1, _2, _3, _4);
-
- //~ return boost::bind(
- //~ &wrap_action::phoenix_action<Eval>, f, _1, _2, _3, _4);
+ using phoenix::arg_names::_1;
+ using phoenix::arg_names::_2;
+ using phoenix::arg_names::_3;
+ using phoenix::arg_names::_4;
+ return phoenix::bind(phoenix_action(), phoenix::lambda[f],
+ _1, _2, _3, _4);
}
// semantic actions with 3 arguments
@@ -88,14 +66,12 @@
template <typename A0, typename A1, typename A2>
static FunctionType call(void(*f)(A0, A1, A2))
{
+ void (*pf)(void(*)(A0, A1, A2), Attribute const&, std::size_t,
+ bool&, Context&) = &wrap_action::arg3_action;
+
using phoenix::arg_names::_1;
using phoenix::arg_names::_2;
using phoenix::arg_names::_3;
-
- void (*pf)(void(*)(A0, A1, A2), Attribute const&, std::size_t, bool&, Context&) =
- &wrap_action::arg3_action;
-
- //~ return boost::bind(pf, f, _1, _2, _3);
return phoenix::bind(pf, f, _1, _2, _3);
}
@@ -110,13 +86,11 @@
template <typename A0, typename A1>
static FunctionType call(void(*f)(A0, A1))
{
+ void (*pf)(void(*)(A0, A1), Attribute const&, std::size_t,
+ bool&, Context&) = &wrap_action::arg2_action;
+
using phoenix::arg_names::_1;
using phoenix::arg_names::_2;
-
- void (*pf)(void(*)(A0, A1), Attribute const&, std::size_t, bool&, Context&) =
- &wrap_action::arg2_action;
-
- //~ return boost::bind(pf, f, _1, _2);
return phoenix::bind(pf, f, _1, _2);
}
@@ -131,12 +105,11 @@
template <typename A0>
static FunctionType call(void(*f)(A0))
{
- void (*pf)(void(*)(A0), Attribute const&, std::size_t, bool&, Context&) =
- &arg1_action;
+ void (*pf)(void(*)(A0), Attribute const&, std::size_t,
+ bool&, Context&) = &arg1_action;
using phoenix::arg_names::_1;
return phoenix::bind(pf, f, _1);
- //~ return boost::bind(pf, f, _1);
}
};
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