$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: hartmut.kaiser_at_[hidden]
Date: 2008-04-30 16:33:24
Author: hkaiser
Date: 2008-04-30 16:33:23 EDT (Wed, 30 Apr 2008)
New Revision: 44950
URL: http://svn.boost.org/trac/boost/changeset/44950
Log:
Spirit.Karma: Fixed rule tests (pattern.cpp)
Text files modified: 
   trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp          |     2 +-                                      
   trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp |     6 +++---                                  
   trunk/libs/spirit/test/karma/pattern.cpp                           |    38 +++++++++++++++++++++-----------------  
   3 files changed, 25 insertions(+), 21 deletions(-)
Modified: trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp	(original)
+++ trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp	2008-04-30 16:33:23 EDT (Wed, 30 Apr 2008)
@@ -82,7 +82,7 @@
             fusion::result_of::as_vector<Locals>::type 
         locals_type;
 
-        //  The overall context_type consist of a tuple with:
+        //  The overall context_type consists of a tuple with:
         //      1) a tuple of the return value and parameters
         //      2) the locals
         typedef fusion::vector<retval_param_types, locals_type> context_type;
Modified: trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp	(original)
+++ trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp	2008-04-30 16:33:23 EDT (Wed, 30 Apr 2008)
@@ -53,7 +53,7 @@
             Parameter const& param)
         {
             typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Parameter const&> front(param);
+            fusion::vector<Parameter const&> front(param);
             NonterminalContext context(front, locals_type());
             return x.obj.generate(sink, context, delim);
         }
@@ -69,7 +69,7 @@
             Parameter const& param)
         {
             typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Parameter const&> front(param);
+            fusion::vector<Parameter const&> front(param);
             NonterminalContext context(front, locals_type());
             return ptr->generate(sink, context, delim);
         }
@@ -85,7 +85,7 @@
             Parameter const& param)
         {
             typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Parameter const&> front(param);
+            fusion::vector<Parameter const&> front(param);
             NonterminalContext context(
                 fusion::join(
                     front,
Modified: trunk/libs/spirit/test/karma/pattern.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/pattern.cpp	(original)
+++ trunk/libs/spirit/test/karma/pattern.cpp	2008-04-30 16:33:23 EDT (Wed, 30 Apr 2008)
@@ -19,6 +19,7 @@
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
+#include <boost/spirit/include/phoenix_fusion.hpp>
 
 #include "test.hpp"
 
@@ -57,29 +58,27 @@
     // basic tests involving a direct parameter
     {
         typedef variant<char, int, double> var_type;
-        fusion::vector<unused_type, var_type> v (unused, 'a');
+        var_type v ('a');
 
-        rule<outiter_type, void(var_type)> start;
+        rule<outiter_type, var_type()> start;
 
-        start = (char_ | int_ | double_)[_1 = _r1];
+        start = (char_ | int_ | double_)[_1 = _r0];
         BOOST_TEST(test("a", start, v));
 
-        v = fusion::vector<unused_type, var_type>(unused, 10);
+        v = 10;
         BOOST_TEST(test("10", start, v));
-        v = fusion::vector<unused_type, var_type>(unused, 12.4);
+        v = 12.4;
         BOOST_TEST(test("12.4", start, v));
     }
 
     {
         rule<outiter_type, void(char, int, double)> start;
-        fusion::vector<unused_type, char, int, double> vec(unused, 'a', 10, 12.4);
+        fusion::vector<char, int, double> vec('a', 10, 12.4);
 
         start = char_[_1 = _r1] << int_[_1 = _r2] << double_[_1 = _r3];
-        BOOST_TEST(test("a1012.4", start, vec));
         BOOST_TEST(test("a1012.4", start('a', 10, 12.4)));
 
         start = (char_ << int_ << double_)[_1 = _r1, _2 = _r2, _3 = _r3];
-        BOOST_TEST(test("a1012.4", start, vec));
         BOOST_TEST(test("a1012.4", start('a', 10, 12.4)));
 
         rule<outiter_type, void(char)> a;
@@ -90,29 +89,34 @@
         b = int_[_1 = _r1];
         c = double_[_1 = _r1];
         start = a(_r1) << b(_r2) << c(_r3);
-        BOOST_TEST(test("a1012.4", start, vec));
         BOOST_TEST(test("a1012.4", start('a', 10, 12.4)));
     }
 
     // test rule parameter propagation
     {
-        rule<outiter_type, void(char, int, double)> start;
-        fusion::vector<unused_type, char, int, double> vec(unused, 'a', 10, 12.4);
+        using boost::phoenix::at_c;
+        
+        rule<outiter_type, fusion::vector<char, int, double>()> start;
+        fusion::vector<char, int, double> vec('a', 10, 12.4);
 
         start %= char_ << int_ << double_;
         BOOST_TEST(test("a1012.4", start, vec));
-        BOOST_TEST(test("a1012.4", start('a', 10, 12.4)));
 
-        rule<outiter_type, void(char)> a;
-        rule<outiter_type, void(int)> b;
-        rule<outiter_type, void(double)> c;
+        rule<outiter_type, char()> a;
+        rule<outiter_type, int()> b;
+        rule<outiter_type, double()> c;
 
         a %= char_ << eps;
         b %= int_;
         c %= double_;
-        start = a(_r1) << b(_r2) << c(_r3);
+        start = a[_1 = at_c<0>(_r0)] << b[_1 = at_c<1>(_r0)] << c[_1 = at_c<2>(_r0)];
+        BOOST_TEST(test("a1012.4", start, vec));
+
+        start = (a << b << c)[_1 = at_c<0>(_r0), _2 = at_c<1>(_r0), _3 = at_c<2>(_r0)];
+        BOOST_TEST(test("a1012.4", start, vec));
+
+        start %= a << b << c;
         BOOST_TEST(test("a1012.4", start, vec));
-        BOOST_TEST(test("a1012.4", start('a', 10, 12.4)));
     }
 
     // basic tests with delimiter