Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52878 - in trunk/libs/spirit/test: karma qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-10 12:47:55


Author: hkaiser
Date: 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
New Revision: 52878
URL: http://svn.boost.org/trac/boost/changeset/52878

Log:
Spirit: Disambiguating phoenix::ref/boost::ref
Text files modified:
   trunk/libs/spirit/test/karma/lit.cpp | 16 ++++++++--------
   trunk/libs/spirit/test/karma/stream.cpp | 10 +++++-----
   trunk/libs/spirit/test/qi/list.cpp | 4 ++--
   trunk/libs/spirit/test/qi/lit.cpp | 7 +++----
   trunk/libs/spirit/test/qi/match_manip.cpp | 32 ++++++++++++++++----------------
   trunk/libs/spirit/test/qi/rule.cpp | 30 ++++++++++++++----------------
   6 files changed, 48 insertions(+), 51 deletions(-)

Modified: trunk/libs/spirit/test/karma/lit.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/lit.cpp (original)
+++ trunk/libs/spirit/test/karma/lit.cpp 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
@@ -132,25 +132,25 @@
     }
 
     { // test action
- using namespace boost::phoenix;
+ namespace phx = boost::phoenix;
         using namespace boost::spirit::ascii;
 
         std::string str("abc");
- BOOST_TEST(test("abc", string[_1 = ref(str)]));
- BOOST_TEST(test_delimited("abc ", string[_1 = ref(str)], space));
+ BOOST_TEST(test("abc", string[_1 = phx::ref(str)]));
+ BOOST_TEST(test_delimited("abc ", string[_1 = phx::ref(str)], space));
     }
 
     { // lazy strings
- using namespace boost::phoenix;
+ namespace phx = boost::phoenix;
         using namespace boost::spirit::ascii;
 
         std::basic_string<char> s("abc");
- BOOST_TEST((test("abc", lit(val(s)))));
- BOOST_TEST((test("abc", string(val(s)))));
+ BOOST_TEST((test("abc", lit(phx::val(s)))));
+ BOOST_TEST((test("abc", string(phx::val(s)))));
 
         std::basic_string<wchar_t> ws(L"abc");
- BOOST_TEST((test(L"abc", lit(ref(ws)))));
- BOOST_TEST((test(L"abc", string(ref(ws)))));
+ BOOST_TEST((test(L"abc", lit(phx::ref(ws)))));
+ BOOST_TEST((test(L"abc", string(phx::ref(ws)))));
     }
 
     return boost::report_errors();

Modified: trunk/libs/spirit/test/karma/stream.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/stream.cpp (original)
+++ trunk/libs/spirit/test/karma/stream.cpp 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
@@ -129,15 +129,15 @@
     }
 
     { // lazy streams
- using namespace boost::phoenix;
+ namespace phx = boost::phoenix;
 
         std::basic_string<char> s("abc");
- BOOST_TEST((test("abc", stream(val(s)))));
- BOOST_TEST((test("abc", stream(ref(s)))));
+ BOOST_TEST((test("abc", stream(phx::val(s)))));
+ BOOST_TEST((test("abc", stream(phx::ref(s)))));
 
         std::basic_string<wchar_t> ws(L"abc");
- BOOST_TEST((test(L"abc", wstream(val(ws)))));
- BOOST_TEST((test(L"abc", wstream(ref(ws)))));
+ BOOST_TEST((test(L"abc", wstream(phx::val(ws)))));
+ BOOST_TEST((test(L"abc", wstream(phx::ref(ws)))));
     }
 
     return boost::report_errors();

Modified: trunk/libs/spirit/test/qi/list.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/list.cpp (original)
+++ trunk/libs/spirit/test/qi/list.cpp 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
@@ -66,7 +66,7 @@
     }
 
     { // actions
- using boost::phoenix::ref;
+ namespace phx = boost::phoenix;
         using boost::phoenix::begin;
         using boost::phoenix::end;
         using boost::phoenix::construct;
@@ -74,7 +74,7 @@
 
         std::string s;
         BOOST_TEST(test("a,b,c,d,e,f,g,h", (char_ % ',')
- [ref(s) = construct<std::string>(begin(_1), end(_1))]));
+ [phx::ref(s) = construct<std::string>(begin(_1), end(_1))]));
     }
 
     return boost::report_errors();

Modified: trunk/libs/spirit/test/qi/lit.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/lit.cpp (original)
+++ trunk/libs/spirit/test/qi/lit.cpp 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
@@ -85,13 +85,12 @@
     { // lazy string
 
         using namespace boost::spirit::ascii;
- using boost::phoenix::ref;
- using boost::phoenix::val;
+ namespace phx = boost::phoenix;
 
- BOOST_TEST((test("x", string(val("x")))));
+ BOOST_TEST((test("x", string(phx::val("x")))));
 
         std::string str; // make sure lazy lits have an attribute
- BOOST_TEST(test("x", string(val("x"))[ref(str) = _1]));
+ BOOST_TEST(test("x", string(phx::val("x"))[phx::ref(str) = _1]));
         BOOST_TEST(str == "x");
     }
 

Modified: trunk/libs/spirit/test/qi/match_manip.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/match_manip.cpp (original)
+++ trunk/libs/spirit/test/qi/match_manip.cpp 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
@@ -69,25 +69,25 @@
     using boost::spirit::qi::typed_stream;
     using boost::spirit::qi::stream;
     using boost::spirit::qi::int_;
- using boost::phoenix::ref;
 
     using namespace boost::spirit::ascii;
     namespace fusion = boost::fusion;
+ namespace phx = boost::phoenix;
 
     {
         char c = '\0';
         BOOST_TEST(test( "a",
- char_[ref(c) = _1]
+ char_[phx::ref(c) = _1]
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( "a",
- match(char_[ref(c) = _1])
+ match(char_[phx::ref(c) = _1])
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( " a",
- phrase_match(char_[ref(c) = _1], space)
+ phrase_match(char_[phx::ref(c) = _1], space)
         ) && c == 'a');
 
         c = '\0';
@@ -112,32 +112,32 @@
         ///////////////////////////////////////////////////////////////////////
         char c = '\0';
         BOOST_TEST(test( "a",
- char_stream[ref(c) = _1]
+ char_stream[phx::ref(c) = _1]
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( "a",
- match(char_stream[ref(c) = _1])
+ match(char_stream[phx::ref(c) = _1])
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( " a",
- phrase_match(char_stream[ref(c) = _1], space)
+ phrase_match(char_stream[phx::ref(c) = _1], space)
         ) && c == 'a');
 
         int i = 0;
         BOOST_TEST(test( "42",
- int_stream[ref(i) = _1]
+ int_stream[phx::ref(i) = _1]
         ) && i == 42);
 
         i = 0;
         BOOST_TEST(test( "42",
- match(int_stream[ref(i) = _1])
+ match(int_stream[phx::ref(i) = _1])
         ) && i == 42);
 
         i = 0;
         BOOST_TEST(test( " 42",
- phrase_match(int_stream[ref(i) = _1], space)
+ phrase_match(int_stream[phx::ref(i) = _1], space)
         ) && i == 42);
 
         ///////////////////////////////////////////////////////////////////////
@@ -165,17 +165,17 @@
     {
         char a = '\0', b = '\0';
         BOOST_TEST(test( "ab",
- char_[ref(a) = _1] >> char_[ref(b) = _1]
+ char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1]
         ) && a == 'a' && b == 'b');
 
         a = '\0', b = '\0';
         BOOST_TEST(test( "ab",
- match(char_[ref(a) = _1] >> char_[ref(b) = _1])
+ match(char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1])
         ) && a == 'a' && b == 'b');
 
         a = '\0', b = '\0';
         BOOST_TEST(test( " a b",
- phrase_match(char_[ref(a) = _1] >> char_[ref(b) = _1], space)
+ phrase_match(char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1], space)
         ) && a == 'a' && b == 'b');
 
         fusion::vector<char, char> t;
@@ -192,7 +192,7 @@
     {
         char a = '\0', b = '\0', c = '\0';
         BOOST_TEST(test( "abc",
- char_[ref(a) = _1] >> char_[ref(b) = _1] >> char_[ref(c) = _1]
+ char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1] >> char_[phx::ref(c) = _1]
         ) && a == 'a' && b == 'b' && c == 'c');
 
         BOOST_TEST(test( "abc",
@@ -226,7 +226,7 @@
         char a = '\0';
         int i = 0;
         BOOST_TEST(test( "a2",
- (char_ >> int_)[ref(a) = _1, ref(i) = _2]
+ (char_ >> int_)[phx::ref(a) = _1, phx::ref(i) = _2]
         ) && a == 'a' && i == 2);
 
         fusion::vector<char, int> t;
@@ -251,7 +251,7 @@
         // output all elements of a vector
         std::vector<char> v;
         BOOST_TEST(test( "abc",
- (*char_)[ref(v) = _1]
+ (*char_)[phx::ref(v) = _1]
         ) && 3 == v.size() && v[0] == 'a' && v[1] == 'b' && v[2] == 'c');
 
         v.clear();

Modified: trunk/libs/spirit/test/qi/rule.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/rule.cpp (original)
+++ trunk/libs/spirit/test/qi/rule.cpp 2009-05-10 12:47:54 EDT (Sun, 10 May 2009)
@@ -38,8 +38,7 @@
     using boost::spirit::qi::on_error;
     using boost::spirit::qi::debug;
 
- using boost::phoenix::ref;
- using boost::phoenix::val;
+ namespace phx = boost::phoenix;
 
 
     { // basic tests
@@ -188,7 +187,7 @@
         rule<char const*, char()> a;
         a = alpha[_val = _1];
 
- BOOST_TEST(test("x", a[ref(ch) = _1]));
+ BOOST_TEST(test("x", a[phx::ref(ch) = _1]));
         BOOST_TEST(ch == 'x');
 
         BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
@@ -201,7 +200,7 @@
         rule<char const*, char()> a;
         a %= alpha;
 
- BOOST_TEST(test("x", a[ref(ch) = _1]));
+ BOOST_TEST(test("x", a[phx::ref(ch) = _1]));
         BOOST_TEST(ch == 'x');
 
         BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
@@ -218,11 +217,11 @@
         rule<char const*, std::string()> r;
         r %= char_ >> *(',' >> char_);
 
- BOOST_TEST(test("a,b,c,d,e,f", r[ref(s) = _1]));
+ BOOST_TEST(test("a,b,c,d,e,f", r[phx::ref(s) = _1]));
         BOOST_TEST(s == "abcdef");
 
         r %= char_ >> char_ >> char_ >> char_ >> char_ >> char_;
- BOOST_TEST(test("abcdef", r[ref(s) = _1]));
+ BOOST_TEST(test("abcdef", r[phx::ref(s) = _1]));
         BOOST_TEST(s == "abcdef");
     }
 
@@ -242,7 +241,7 @@
         a %= b;
         b %= alpha;
 
- BOOST_TEST(test("x", a[ref(ch) = _1]));
+ BOOST_TEST(test("x", a[phx::ref(ch) = _1]));
         BOOST_TEST(ch == 'x');
 
         BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
@@ -255,7 +254,7 @@
         rule<char const*, char(int)> a; // 1 arg
         a = alpha[_val = _1 + _r1];
 
- BOOST_TEST(test("x", a(val(1))[ref(ch) = _1]));
+ BOOST_TEST(test("x", a(phx::val(1))[phx::ref(ch) = _1]));
         BOOST_TEST(ch == 'x' + 1);
 
         BOOST_TEST(test_attr("a", a(1), ch)); // allow scalars as rule args too.
@@ -273,7 +272,7 @@
         rule<char const*, void(char&)> a; // 1 arg (reference)
         a = alpha[_r1 = _1];
 
- BOOST_TEST(test("x", a(ref(ch))));
+ BOOST_TEST(test("x", a(phx::ref(ch))));
         BOOST_TEST(ch == 'x');
     }
 
@@ -289,9 +288,9 @@
 
         rule<char const*, void(int), locals<char> > a; // 1 arg + 1 local
         a = alpha[_a = _1 + _r1] >> char_(_a);
- BOOST_TEST(test("ab", a(val(1))));
- BOOST_TEST(test("xy", a(val(1))));
- BOOST_TEST(!test("ax", a(val(1))));
+ BOOST_TEST(test("ab", a(phx::val(1))));
+ BOOST_TEST(test("xy", a(phx::val(1))));
+ BOOST_TEST(!test("ax", a(phx::val(1))));
     }
 
     { // void() has unused type (void == unused_type)
@@ -341,7 +340,6 @@
     { // error handling
 
         using namespace boost::spirit::ascii;
- using boost::phoenix::val;
         using boost::phoenix::construct;
         using boost::phoenix::bind;
 
@@ -351,11 +349,11 @@
         on_error<fail>
         (
             r, std::cout
- << val("Error! Expecting: ")
+ << phx::val("Error! Expecting: ")
                 << _4
- << val(", got: \"")
+ << phx::val(", got: \"")
                 << construct<std::string>(_3, _2)
- << val("\"")
+ << phx::val("\"")
                 << std::endl
         );
 


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