|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61425 - in trunk/boost/spirit/home: karma/action karma/detail qi/action qi/detail support
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-20 10:30:21
Author: hkaiser
Date: 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
New Revision: 61425
URL: http://svn.boost.org/trac/boost/changeset/61425
Log:
Spirit: added transform_attribute customization point to Qi and Karma semantic actions
Text files modified:
trunk/boost/spirit/home/karma/action/action.hpp | 6 +++++-
trunk/boost/spirit/home/karma/detail/attributes.hpp | 1 +
trunk/boost/spirit/home/qi/action/action.hpp | 6 +++++-
trunk/boost/spirit/home/qi/detail/attributes.hpp | 1 +
trunk/boost/spirit/home/support/action_dispatch.hpp | 1 -
trunk/boost/spirit/home/support/attributes.hpp | 2 --
trunk/boost/spirit/home/support/attributes_fwd.hpp | 12 ++++++++++++
7 files changed, 24 insertions(+), 5 deletions(-)
Modified: trunk/boost/spirit/home/karma/action/action.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/action/action.hpp (original)
+++ trunk/boost/spirit/home/karma/action/action.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -56,7 +56,11 @@
// create a attribute if none is supplied
// this creates a _copy_ of the attribute because the semantic
// action will likely change parts of this
- typename make_attribute::value_type attr = make_attribute::call(attr_);
+ typedef traits::transform_attribute<
+ typename make_attribute::type, attr_type, domain> transform;
+
+ typename transform::type attr =
+ traits::pre_transform<domain, attr_type>(make_attribute::call(attr_));
// call the function, passing the attribute, the context and a bool
// flag that the client can set to false to fail generating.
Modified: trunk/boost/spirit/home/karma/detail/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/attributes.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/attributes.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -8,6 +8,7 @@
#define SPIRIT_KARMA_DETAIL_ATTRIBUTES_APR_18_2010_0453PM
#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/support/attributes_fwd.hpp>
#include <boost/spirit/home/support/attributes.hpp>
///////////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/spirit/home/qi/action/action.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/action/action.hpp (original)
+++ trunk/boost/spirit/home/qi/action/action.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -53,7 +53,11 @@
typedef traits::make_attribute<attr_type, Attribute> make_attribute;
// create an attribute if one is not supplied
- typename make_attribute::type attr = make_attribute::call(attr_);
+ typedef traits::transform_attribute<
+ typename make_attribute::type, attr_type, domain> transform;
+
+ typename make_attribute::type made_attr = make_attribute::call(attr_);
+ typename transform::type attr = transform::pre(made_attr);
if (subject.parse(first, last, context, skipper, attr))
{
Modified: trunk/boost/spirit/home/qi/detail/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/attributes.hpp (original)
+++ trunk/boost/spirit/home/qi/detail/attributes.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -8,6 +8,7 @@
#define SPIRIT_QI_DETAIL_ATTRIBUTES_APR_18_2010_0458PM
#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/support/attributes_fwd.hpp>
#include <boost/spirit/home/support/attributes.hpp>
///////////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/spirit/home/support/action_dispatch.hpp
==============================================================================
--- trunk/boost/spirit/home/support/action_dispatch.hpp (original)
+++ trunk/boost/spirit/home/support/action_dispatch.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -78,7 +78,6 @@
return true;
}
};
-
}}}
#endif
Modified: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes.hpp (original)
+++ trunk/boost/spirit/home/support/attributes.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -17,8 +17,6 @@
#include <boost/spirit/home/support/attributes_fwd.hpp>
#include <boost/spirit/home/support/detail/hold_any.hpp>
#include <boost/spirit/home/support/detail/as_variant.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
#include <boost/optional/optional.hpp>
#include <boost/fusion/include/transform.hpp>
#include <boost/fusion/include/filter_if.hpp>
Modified: trunk/boost/spirit/home/support/attributes_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes_fwd.hpp (original)
+++ trunk/boost/spirit/home/support/attributes_fwd.hpp 2010-04-20 10:30:19 EDT (Tue, 20 Apr 2010)
@@ -82,9 +82,21 @@
template <typename Attribute, typename Iterator, typename Enable = void>
struct assign_to_attribute_from_iterators;
+ template <typename Iterator, typename Attribute>
+ void assign_to(Iterator const& first, Iterator const& last, Attribute& attr);
+
+ template <typename Iterator>
+ void assign_to(Iterator const&, Iterator const&, unused_type);
+
template <typename Attribute, typename T, typename Enable = void>
struct assign_to_attribute_from_value;
+ template <typename T, typename Attribute>
+ void assign_to(T const& val, Attribute& attr);
+
+ template <typename T>
+ void assign_to(T const&, unused_type);
+
///////////////////////////////////////////////////////////////////////////
// Karma only
template <typename Attribute, typename Exposed, typename Enable = void>
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