Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56509 - in trunk/boost/spirit/home: karma/detail qi/detail qi/directive qi/nonterminal qi/operator support
From: joel_at_[hidden]
Date: 2009-10-02 05:04:58


Author: djowel
Date: 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
New Revision: 56509
URL: http://svn.boost.org/trac/boost/changeset/56509

Log:
kleene, plus and repeat attribute customization points.
Text files modified:
   trunk/boost/spirit/home/karma/detail/pass_container.hpp | 2
   trunk/boost/spirit/home/qi/detail/pass_container.hpp | 6 +-
   trunk/boost/spirit/home/qi/directive/repeat.hpp | 2
   trunk/boost/spirit/home/qi/nonterminal/rule.hpp | 4 +
   trunk/boost/spirit/home/qi/operator/kleene.hpp | 2
   trunk/boost/spirit/home/qi/operator/list.hpp | 2
   trunk/boost/spirit/home/qi/operator/plus.hpp | 2
   trunk/boost/spirit/home/support/container.hpp | 85 ++++++++++++++++++++-------------------
   8 files changed, 55 insertions(+), 50 deletions(-)

Modified: trunk/boost/spirit/home/karma/detail/pass_container.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/pass_container.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/pass_container.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -154,7 +154,7 @@
         template <typename Component>
         bool operator()(Component const& component) const
         {
- typedef typename traits::result_of::value<Attr>::type rhs;
+ typedef typename traits::container_value<Attr>::type rhs;
             typedef typename traits::attribute_of<
                 Component, context_type>::type lhs_attribute;
 

Modified: trunk/boost/spirit/home/qi/detail/pass_container.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/pass_container.hpp (original)
+++ trunk/boost/spirit/home/qi/detail/pass_container.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -67,8 +67,8 @@
         bool dispatch_attribute_element(Component const& component, mpl::false_) const
         {
             // synthesized attribute needs to be default constructed
- typename traits::result_of::value<Attr>::type val =
- typename traits::result_of::value<Attr>::type();
+ typename traits::container_value<Attr>::type val =
+ typename traits::container_value<Attr>::type();
 
             bool r = f(component, val);
             if (!r)
@@ -144,7 +144,7 @@
         template <typename Component>
         bool operator()(Component const& component) const
         {
- typedef typename traits::result_of::value<Attr>::type lhs;
+ typedef typename traits::container_value<Attr>::type lhs;
             typedef typename traits::attribute_of<
                 Component, context_type, iterator_type>::type
             rhs_attribute;

Modified: trunk/boost/spirit/home/qi/directive/repeat.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/repeat.hpp (original)
+++ trunk/boost/spirit/home/qi/directive/repeat.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -143,7 +143,7 @@
           , Attribute& attr) const
         {
             // create a local value if Attribute is not unused_type
- typedef typename traits::result_of::value<Attribute>::type
+ typedef typename traits::container_value<Attribute>::type
                 value_type;
             value_type val = value_type();
             typename LoopIter::type i = iter.start();

Modified: trunk/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/rule.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -210,6 +210,8 @@
           , Context& /*context*/, Skipper const& skipper
           , Attribute& attr) const
         {
+ //$$$ do a preskip if this is an implied lexeme $$$
+
             if (f)
             {
                 // Create an attribute if none is supplied.
@@ -241,6 +243,8 @@
           , Context& caller_context, Skipper const& skipper
           , Attribute& attr, Params const& params) const
         {
+ //$$$ do a preskip if this is an implied lexeme $$$
+
             if (f)
             {
                 // Create an attribute if none is supplied.

Modified: trunk/boost/spirit/home/qi/operator/kleene.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/kleene.hpp (original)
+++ trunk/boost/spirit/home/qi/operator/kleene.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -62,7 +62,7 @@
           , Attribute& attr) const
         {
             // create a local value if Attribute is not unused_type
- typedef typename traits::result_of::value<Attribute>::type
+ typedef typename traits::container_value<Attribute>::type
                 value_type;
             value_type val = value_type();
 

Modified: trunk/boost/spirit/home/qi/operator/list.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/list.hpp (original)
+++ trunk/boost/spirit/home/qi/operator/list.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -60,7 +60,7 @@
           , Attribute& attr) const
         {
             // create a local value if Attribute is not unused_type
- typedef typename traits::result_of::value<Attribute>::type
+ typedef typename traits::container_value<Attribute>::type
                 value_type;
             value_type val = value_type();
 

Modified: trunk/boost/spirit/home/qi/operator/plus.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/plus.hpp (original)
+++ trunk/boost/spirit/home/qi/operator/plus.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -58,7 +58,7 @@
           , Attribute& attr) const
         {
             // create a local value if Attribute is not unused_type
- typedef typename traits::result_of::value<Attribute>::type
+ typedef typename traits::container_value<Attribute>::type
                 value_type;
             value_type val = value_type();
 

Modified: trunk/boost/spirit/home/support/container.hpp
==============================================================================
--- trunk/boost/spirit/home/support/container.hpp (original)
+++ trunk/boost/spirit/home/support/container.hpp 2009-10-02 05:04:57 EDT (Fri, 02 Oct 2009)
@@ -85,53 +85,54 @@
         };
     }
 
- namespace result_of
+ ///////////////////////////////////////////////////////////////////////
+ template <typename Container>
+ struct container_value
     {
- ///////////////////////////////////////////////////////////////////////
- template <typename Container>
- struct value
- {
- typedef typename detail::remove_value_const<
- typename Container::value_type>::type
- type;
- };
+ typedef typename detail::remove_value_const<
+ typename Container::value_type>::type
+ type;
+ };
 
- // this will be instantiated if the optional holds a container
- template <typename T>
- struct value<optional<T> > : value<T> {};
+ // this will be instantiated if the optional holds a container
+ template <typename T>
+ struct container_value<optional<T> > : container_value<T> {};
 
- // this will be instantiated if the variant holds a container
- template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
- struct value<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
- {
- typedef typename
- variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
- types;
- typedef typename
- mpl::find_if<types, is_container<mpl::_1> >::type
- iter;
-
- typedef typename value<
- typename mpl::if_<
- is_same<iter, typename mpl::end<types>::type>
- , unused_type, typename mpl::deref<iter>::type
- >::type
- >::type type;
- };
+ // this will be instantiated if the variant holds a container
+ template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+ struct container_value<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+ {
+ typedef typename
+ variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
+ types;
+ typedef typename
+ mpl::find_if<types, is_container<mpl::_1> >::type
+ iter;
+
+ typedef typename container_value<
+ typename mpl::if_<
+ is_same<iter, typename mpl::end<types>::type>
+ , unused_type, typename mpl::deref<iter>::type
+ >::type
+ >::type type;
+ };
+
+ template <>
+ struct container_value<unused_type>
+ {
+ typedef unused_type type;
+ };
 
- template <>
- struct value<unused_type>
- {
- typedef unused_type type;
- };
-
- template <>
- struct value<unused_type const>
- {
- typedef unused_type type;
- };
+ template <>
+ struct container_value<unused_type const>
+ {
+ typedef unused_type type;
+ };
 
- ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+
+ namespace result_of
+ {
         template <typename Container>
         struct iterator
         {


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