Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56632 - in trunk/boost/spirit/repository/home: karma/nonterminal qi/nonterminal
From: hartmut.kaiser_at_[hidden]
Date: 2009-10-07 09:32:20


Author: hkaiser
Date: 2009-10-07 09:32:20 EDT (Wed, 07 Oct 2009)
New Revision: 56632
URL: http://svn.boost.org/trac/boost/changeset/56632

Log:
Spirit: fixing subrules after recent changes to customization points
Text files modified:
   trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp | 17 ++++++++++-------
   trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp | 38 ++++++++++++++++++++++++++++++++------
   2 files changed, 42 insertions(+), 13 deletions(-)

Modified: trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp
==============================================================================
--- trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp (original)
+++ trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp 2009-10-07 09:32:20 EDT (Wed, 07 Oct 2009)
@@ -200,13 +200,15 @@
             context_type;
 
             // Create an attribute if none is supplied.
- typedef traits::make_transformed_attribute<
- subrule_attr_type, Attribute const> make_attribute;
+ typedef traits::make_attribute<subrule_attr_type, Attribute>
+ make_attribute;
 
             // If you are seeing a compilation error here, you are probably
             // trying to use a subrule which has inherited attributes,
             // without passing values for them.
- context_type context(*this, make_attribute::call(attr));
+ context_type context(*this
+ , traits::pre_transform<subrule_attr_type>(
+ make_attribute::call(attr)));
 
             return def.binder(sink, context, delimiter);
         }
@@ -233,14 +235,15 @@
             context_type;
 
             // Create an attribute if none is supplied.
- typedef traits::make_transformed_attribute<
- subrule_attr_type, Attribute const> make_attribute;
+ typedef traits::make_attribute<subrule_attr_type, Attribute>
+ make_attribute;
 
             // If you are seeing a compilation error here, you are probably
             // trying to use a subrule which has inherited attributes,
             // passing values of incompatible types for them.
- context_type context(*this, make_attribute::call(attr), params
- , caller_context);
+ context_type context(*this
+ , traits::pre_transform<subrule_attr_type>(
+ make_attribute::call(attr)), params, caller_context);
 
             return def.binder(sink, context, delimiter);
         }

Modified: trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp
==============================================================================
--- trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp (original)
+++ trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp 2009-10-07 09:32:20 EDT (Wed, 07 Oct 2009)
@@ -196,17 +196,30 @@
             context_type;
 
             // prepare attribute
- typedef traits::make_transformed_attribute<
+ typedef traits::make_attribute<
                 subrule_attr_type, Attribute> make_attribute;
 
- typename make_attribute::type attr_ = make_attribute::call(attr);
+ // do down-stream transformation, provides attribute for
+ // rhs parser
+ typedef traits::transform_attribute<
+ typename make_attribute::type, subrule_attr_type> transform;
+
+ typename transform::type attr_ =
+ transform::pre(make_attribute::call(attr));
 
             // If you are seeing a compilation error here, you are probably
             // trying to use a subrule which has inherited attributes,
             // without passing values for them.
             context_type context(*this, attr_);
 
- return def.binder(first, last, context, skipper);
+ if (def.binder(first, last, context, skipper))
+ {
+ // do up-stream transformation, this integrates the results
+ // back into the original attribute value, if appropriate
+ traits::post_transform(attr, attr_);
+ return true;
+ }
+ return false;
         }
 
         template <typename Def
@@ -233,17 +246,30 @@
             context_type;
 
             // prepare attribute
- typedef traits::make_transformed_attribute<
+ typedef traits::make_attribute<
                 subrule_attr_type, Attribute> make_attribute;
 
- typename make_attribute::type attr_ = make_attribute::call(attr);
+ // do down-stream transformation, provides attribute for
+ // rhs parser
+ typedef traits::transform_attribute<
+ typename make_attribute::type, subrule_attr_type> transform;
+
+ typename transform::type attr_ =
+ transform::pre(make_attribute::call(attr));
 
             // If you are seeing a compilation error here, you are probably
             // trying to use a subrule which has inherited attributes,
             // passing values of incompatible types for them.
             context_type context(*this, attr_, params, caller_context);
 
- return def.binder(first, last, context, skipper);
+ if (def.binder(first, last, context, skipper))
+ {
+ // do up-stream transformation, this integrates the results
+ // back into the original attribute value, if appropriate
+ traits::post_transform(attr, attr_);
+ return true;
+ }
+ return false;
         }
 
         template <typename Context>


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