Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59348 - in trunk: boost/spirit/home/qi/auxiliary boost/spirit/home/qi/nonterminal boost/spirit/home/support boost/spirit/repository/home/qi/nonterminal libs/spirit/example/qi libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-29 12:13:56


Author: hkaiser
Date: 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
New Revision: 59348
URL: http://svn.boost.org/trac/boost/changeset/59348

Log:
Spirit: fixing remaining problems from changing transform_attribute
Text files modified:
   trunk/boost/spirit/home/qi/auxiliary/attr_cast.hpp | 1 +
   trunk/boost/spirit/home/qi/nonterminal/rule.hpp | 4 ++--
   trunk/boost/spirit/home/support/attributes.hpp | 8 ++++----
   trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp | 4 ++--
   trunk/libs/spirit/example/qi/parse_date.cpp | 4 ++++
   trunk/libs/spirit/example/qi/reference.cpp | 1 +
   trunk/libs/spirit/test/qi/attribute.cpp | 2 ++
   7 files changed, 16 insertions(+), 8 deletions(-)

Modified: trunk/boost/spirit/home/qi/auxiliary/attr_cast.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/attr_cast.hpp (original)
+++ trunk/boost/spirit/home/qi/auxiliary/attr_cast.hpp 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -94,6 +94,7 @@
             if (!compile<qi::domain>(subject).
                     parse(first, last, context, skipper, attr_))
             {
+ transform::fail(attr);
                 return false;
             }
 

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 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -247,7 +247,7 @@
                 }
 
                 // inform attribute transformation of failed rhs
- transform::fail(attr);
+ traits::fail_transform(attr, attr_);
             }
             return false;
         }
@@ -290,7 +290,7 @@
                 }
 
                 // inform attribute transformation of failed rhs
- transform::fail(attr);
+ traits::fail_transform(attr, attr_);
             }
             return false;
         }

Modified: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes.hpp (original)
+++ trunk/boost/spirit/home/support/attributes.hpp 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -435,7 +435,7 @@
         }
 
         // fail() will be called by Qi rule's if the rhs failed parsing
- static void fail(Exposed& val) {}
+ static void fail(Exposed&) {}
     };
 
     template <typename Exposed, typename Transformed>
@@ -471,7 +471,7 @@
         typedef Attribute& type;
         static Attribute& pre(Attribute& val) { return val; }
         static void post(Attribute&, Attribute const&) {}
- static void fail(Attribute& val) {}
+ static void fail(Attribute&) {}
     };
 
     template <typename Attribute>
@@ -494,7 +494,7 @@
         typedef Attribute& type;
         static Attribute& pre(Attribute& val) { return val; }
         static void post(Attribute&, Attribute const&) {}
- static void fail(Attribute& val) {}
+ static void fail(Attribute&) {}
     };
 
     template <typename Attribute>
@@ -509,7 +509,7 @@
         typedef unused_type type;
         static unused_type pre(unused_type) { return unused; }
         static void post(unused_type, unused_type) {}
- static void fail(unused_type& val) {}
+ static void fail(unused_type) {}
     };
 
     template <>

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 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -221,7 +221,7 @@
             }
 
             // inform attribute transformation of failed rhs
- transform::fail(attr);
+ traits::fail_transform(attr, attr_);
             return false;
         }
 
@@ -274,7 +274,7 @@
             }
 
             // inform attribute transformation of failed rhs
- transform::fail(attr);
+ traits::fail_transform(attr, attr_);
             return false;
         }
 

Modified: trunk/libs/spirit/example/qi/parse_date.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/parse_date.cpp (original)
+++ trunk/libs/spirit/example/qi/parse_date.cpp 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -59,6 +59,10 @@
             d = boost::gregorian::date(fusion::at_c<0>(v), fusion::at_c<1>(v)
               , fusion::at_c<2>(v));
         }
+
+ // The function fail() is called whenever the parsing of the right hand
+ // side of the rule fails. We don't need to do anything here.
+ static void fail(boost::gregorian::date&) {}
     };
 }}}
 

Modified: trunk/libs/spirit/example/qi/reference.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/reference.cpp (original)
+++ trunk/libs/spirit/example/qi/reference.cpp 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -285,6 +285,7 @@
         typedef int& type;
         static int& pre(int_data& d) { return d.i; }
         static void post(int_data& val, int const& attr) {}
+ static void fail(int_data&) {}
     };
 }}}
 //]

Modified: trunk/libs/spirit/test/qi/attribute.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/attribute.cpp (original)
+++ trunk/libs/spirit/test/qi/attribute.cpp 2010-01-29 12:13:53 EST (Fri, 29 Jan 2010)
@@ -59,6 +59,7 @@
         typedef int type;
         static int pre(test_int_data1& d) { return d.i; }
         static void post(test_int_data1& d, int i) { d.i = i; }
+ static void fail(test_int_data1&) {}
     };
 }}}
 
@@ -78,6 +79,7 @@
         typedef int& type;
         static int& pre(test_int_data2& d) { return d.i; }
         static void post(test_int_data2&, int const&) {}
+ static void fail(test_int_data2&) {}
     };
 }}}
 


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