Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71643 - in branches/release: . boost boost/spirit boost/spirit/home boost/spirit/home/qi/operator boost/spirit/home/support libs libs/spirit libs/spirit/test libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2011-04-30 22:00:30


Author: hkaiser
Date: 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
New Revision: 71643
URL: http://svn.boost.org/trac/boost/changeset/71643

Log:
Spirit: merging from trunk
Added:
   branches/release/libs/spirit/test/qi/regression_adapt_adt.cpp
      - copied, changed from r71631, /trunk/libs/spirit/test/qi/regression_adapt_adt.cpp
Properties modified:
   branches/release/ (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (contents, props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
Text files modified:
   branches/release/boost/spirit/home/qi/operator/optional.hpp | 3 +
   branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp | 14 ++++++++++
   branches/release/boost/spirit/home/support/argument.hpp | 24 ++++++++--------
   branches/release/boost/spirit/home/support/attributes.hpp | 12 +++++++-
   branches/release/boost/spirit/home/support/context.hpp | 56 ++++++++++++++++++++--------------------
   branches/release/libs/spirit/test/Jamfile | 13 +++++---
   branches/release/libs/spirit/test/qi/regression_adapt_adt.cpp | 2
   7 files changed, 75 insertions(+), 49 deletions(-)

Modified: branches/release/boost/spirit/home/qi/operator/optional.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/optional.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/optional.hpp 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -65,7 +65,8 @@
           , Attribute& attr, mpl::false_) const
         {
             // create a local value if Attribute is not unused_type
- typename spirit::result_of::optional_value<Attribute>::type val;
+ typename spirit::result_of::optional_value<Attribute>::type val =
+ spirit::result_of::optional_value<Attribute>::type();
 
             if (subject.parse(first, last, context, skipper, val))
             {

Modified: branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp (original)
+++ branches/release/boost/spirit/home/support/adapt_adt_attributes.hpp 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -389,4 +389,18 @@
     };
 }}}
 
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace result_of
+{
+ template <typename T, int N, bool Const>
+ struct optional_value<fusion::extension::adt_attribute_proxy<T, N, Const> >
+ : result_of::optional_value<
+ typename remove_const<
+ typename remove_reference<
+ typename fusion::extension::adt_attribute_proxy<T, N, Const>::type
+ >::type
+ >::type>
+ {};
+}}}
+
 #endif

Modified: branches/release/boost/spirit/home/support/argument.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/argument.hpp (original)
+++ branches/release/boost/spirit/home/support/argument.hpp 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -26,7 +26,7 @@
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
 #define SPIRIT_DECLARE_ARG(z, n, data) \
- typedef phoenix::actor<argument<n> > const \
+ typedef phoenix::actor<argument<n> > \
         BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
     phoenix::actor<argument<n> > const \
         BOOST_PP_CAT(_, BOOST_PP_INC(n)) = \
@@ -41,7 +41,7 @@
 #else
 
 #define SPIRIT_DECLARE_ARG(z, n, data) \
- typedef phoenix::actor<argument<n> > const \
+ typedef phoenix::actor<argument<n> > \
         BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
         /***/
 
@@ -175,27 +175,27 @@
     };
 
     // _0 refers to the whole attribute as generated by the lhs parser
- typedef phoenix::actor<attribute_context<void> > const _0_type;
+ typedef phoenix::actor<attribute_context<void> > _0_type;
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _0_type _0 = _0_type();
+ _0_type const _0 = _0_type();
 #endif
 
     // _1, _2, ... refer to the attributes of the single components the lhs
     // parser is composed of
- typedef phoenix::actor<argument<0> > const _1_type;
- typedef phoenix::actor<argument<1> > const _2_type;
- typedef phoenix::actor<argument<2> > const _3_type;
+ typedef phoenix::actor<argument<0> > _1_type;
+ typedef phoenix::actor<argument<1> > _2_type;
+ typedef phoenix::actor<argument<2> > _3_type;
 
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _1_type _1 = _1_type();
- _2_type _2 = _2_type();
- _3_type _3 = _3_type();
+ _1_type const _1 = _1_type();
+ _2_type const _2 = _2_type();
+ _3_type const _3 = _3_type();
 #endif
 
     // '_pass' may be used to make a match fail in retrospective
- typedef phoenix::arg_names::_3_type const _pass_type;
+ typedef phoenix::arg_names::_3_type _pass_type;
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _pass_type _pass = _pass_type();
+ _pass_type const _pass = _pass_type();
 #endif
 
     // Bring in the rest of the arguments and attributes (_4 .. _N+1), using PP

Modified: branches/release/boost/spirit/home/support/attributes.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/attributes.hpp (original)
+++ branches/release/boost/spirit/home/support/attributes.hpp 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -468,8 +468,16 @@
 
     template <typename Attribute>
     struct attribute_size<optional<Attribute> >
- : attribute_size<Attribute>
- {};
+ {
+ typedef typename attribute_size<Attribute>::type type;
+
+ static type call(optional<Attribute> const& val)
+ {
+ if (!val)
+ return 0;
+ return val.get();
+ }
+ };
 
     template <typename Iterator>
     struct attribute_size<iterator_range<Iterator> >

Modified: branches/release/boost/spirit/home/support/context.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/context.hpp (original)
+++ branches/release/boost/spirit/home/support/context.hpp 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -230,47 +230,47 @@
         }
     };
     
- typedef phoenix::actor<attribute<0> > const _val_type;
- typedef phoenix::actor<attribute<0> > const _r0_type;
- typedef phoenix::actor<attribute<1> > const _r1_type;
- typedef phoenix::actor<attribute<2> > const _r2_type;
+ typedef phoenix::actor<attribute<0> > _val_type;
+ typedef phoenix::actor<attribute<0> > _r0_type;
+ typedef phoenix::actor<attribute<1> > _r1_type;
+ typedef phoenix::actor<attribute<2> > _r2_type;
 
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
     // _val refers to the 'return' value of a rule (same as _r0)
     // _r1, _r2, ... refer to the rule arguments
- _val_type _val = _val_type();
- _r0_type _r0 = _r0_type();
- _r1_type _r1 = _r1_type();
- _r2_type _r2 = _r2_type();
+ _val_type const _val = _val_type();
+ _r0_type const _r0 = _r0_type();
+ _r1_type const _r1 = _r1_type();
+ _r2_type const _r2 = _r2_type();
 #endif
 
     // Bring in the rest of the attributes (_r4 .. _rN+1), using PP
     BOOST_PP_REPEAT_FROM_TO(
         3, SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_DECLARE_ATTRIBUTE, _)
 
- typedef phoenix::actor<local_variable<0> > const _a_type;
- typedef phoenix::actor<local_variable<1> > const _b_type;
- typedef phoenix::actor<local_variable<2> > const _c_type;
- typedef phoenix::actor<local_variable<3> > const _d_type;
- typedef phoenix::actor<local_variable<4> > const _e_type;
- typedef phoenix::actor<local_variable<5> > const _f_type;
- typedef phoenix::actor<local_variable<6> > const _g_type;
- typedef phoenix::actor<local_variable<7> > const _h_type;
- typedef phoenix::actor<local_variable<8> > const _i_type;
- typedef phoenix::actor<local_variable<9> > const _j_type;
+ typedef phoenix::actor<local_variable<0> > _a_type;
+ typedef phoenix::actor<local_variable<1> > _b_type;
+ typedef phoenix::actor<local_variable<2> > _c_type;
+ typedef phoenix::actor<local_variable<3> > _d_type;
+ typedef phoenix::actor<local_variable<4> > _e_type;
+ typedef phoenix::actor<local_variable<5> > _f_type;
+ typedef phoenix::actor<local_variable<6> > _g_type;
+ typedef phoenix::actor<local_variable<7> > _h_type;
+ typedef phoenix::actor<local_variable<8> > _i_type;
+ typedef phoenix::actor<local_variable<9> > _j_type;
 
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
     // _a, _b, ... refer to the local variables of a rule
- _a_type _a = _a_type();
- _b_type _b = _b_type();
- _c_type _c = _c_type();
- _d_type _d = _d_type();
- _e_type _e = _e_type();
- _f_type _f = _f_type();
- _g_type _g = _g_type();
- _h_type _h = _h_type();
- _i_type _i = _i_type();
- _j_type _j = _j_type();
+ _a_type const _a = _a_type();
+ _b_type const _b = _b_type();
+ _c_type const _c = _c_type();
+ _d_type const _d = _d_type();
+ _e_type const _e = _e_type();
+ _f_type const _f = _f_type();
+ _g_type const _g = _g_type();
+ _h_type const _h = _h_type();
+ _i_type const _i = _i_type();
+ _j_type const _j = _j_type();
 #endif
 
     // You can bring these in with the using directive

Modified: branches/release/libs/spirit/test/Jamfile
==============================================================================
--- branches/release/libs/spirit/test/Jamfile (original)
+++ branches/release/libs/spirit/test/Jamfile 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -145,10 +145,15 @@
     ###########################################################################
     test-suite spirit_v2/qi_regressions :
 
+ [ compile qi/pass_container3.cpp : : qi_pass_container3 ]
      [ compile qi/regression_attr_with_action.cpp : : qi_regression_attr_with_action ]
+ [ compile qi/regression_container_attribute.cpp : : qi_regression_container_attribute ]
      [ compile qi/regression_debug_optional.cpp : : qi_regression_debug_optional ]
+ [ compile qi/regression_fusion_proto_spirit.cpp : : qi_regression_fusion_proto_spirit ]
      [ compile qi/regression_one_element_fusion_sequence.cpp : : qi_regression_one_element_fusion_sequence ]
      [ compile qi/regression_one_element_sequence_attribute.cpp : : qi_regression_one_element_sequence_attribute ]
+
+ [ run qi/regression_adapt_adt.cpp : : : : qi_regression_adapt_adt ]
      [ run qi/regression_clear.cpp : : : : qi_regression_clear ]
      #[ run qi/regression_float_fraction.cpp : : : : qi_regression_float_fraction ]
      [ run qi/regression_lazy_repeat.cpp : : : : qi_regression_lazy_repeat ]
@@ -156,9 +161,6 @@
      [ run qi/regression_reorder.cpp : : : : qi_regression_reorder ]
      [ run qi/regression_repeat.cpp : : : : qi_regression_repeat ]
      [ run qi/regression_transform_assignment.cpp : : : : qi_regression_transform_assignment ]
- [ compile qi/regression_fusion_proto_spirit.cpp : : qi_regression_fusion_proto_spirit ]
- [ compile qi/pass_container3.cpp : : qi_pass_container3 ]
- [ compile qi/regression_container_attribute.cpp : : qi_regression_container_attribute ]
     ;
 
     ###########################################################################
@@ -240,11 +242,12 @@
     ###########################################################################
     test-suite spirit_v2/karma_regressions :
 
+ [ compile karma/regression_const_real_policies.cpp : : regression_const_real_policies ]
+
+ [ run karma/regression_adapt_adt.cpp : : : : karma_regression_adapt_adt ]
      [ run karma/regression_optional_double.cpp : : : : karma_regression_optional_double ]
      [ run karma/regression_semantic_action_attribute.cpp : : : : karma_regression_semantic_action_attribute ]
      [ run karma/regression_real_scientific.cpp : : : : karma_regression_real_scientific ]
- [ compile karma/regression_const_real_policies.cpp : : regression_const_real_policies ]
- [ run karma/regression_adapt_adt.cpp : : : : karma_regression_adapt_adt ]
 
     ;
 

Copied: branches/release/libs/spirit/test/qi/regression_adapt_adt.cpp (from r71631, /trunk/libs/spirit/test/qi/regression_adapt_adt.cpp)
==============================================================================
--- /trunk/libs/spirit/test/qi/regression_adapt_adt.cpp (original)
+++ branches/release/libs/spirit/test/qi/regression_adapt_adt.cpp 2011-04-30 22:00:27 EDT (Sat, 30 Apr 2011)
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 Roji Philip
+// Copyright (c) 2011 Philip Roji
 // Copyright (c) 2001-2011 Hartmut Kaiser
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying


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