Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60494 - in trunk/libs/spirit: example/scheme test/qi
From: joel_at_[hidden]
Date: 2010-03-11 19:20:02


Author: djowel
Date: 2010-03-11 19:20:01 EST (Thu, 11 Mar 2010)
New Revision: 60494
URL: http://svn.boost.org/trac/boost/changeset/60494

Log:
added tests for handling debug output for stl containers
Text files modified:
   trunk/libs/spirit/example/scheme/sexpr.hpp | 4 ++--
   trunk/libs/spirit/example/scheme/simple_print.hpp | 2 +-
   trunk/libs/spirit/test/qi/debug.cpp | 13 ++++++++++++-
   3 files changed, 15 insertions(+), 4 deletions(-)

Modified: trunk/libs/spirit/example/scheme/sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/sexpr.hpp 2010-03-11 19:20:01 EST (Thu, 11 Mar 2010)
@@ -101,8 +101,8 @@
             void operator()(std::string& utf8, char byte) const
             {
                 if (utf8.size() == 0)
- utf8 += '\1'; // mark a symbol with prefix 1
- // (a 1 byte at the beginning signifies a binary stream)
+ utf8 += '\1'; // mark a byte string with prefix 1
+ // (a 1 byte at the beginning signifies a byte string)
                 utf8 += byte;
             }
         };

Modified: trunk/libs/spirit/example/scheme/simple_print.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/simple_print.hpp (original)
+++ trunk/libs/spirit/example/scheme/simple_print.hpp 2010-03-11 19:20:01 EST (Thu, 11 Mar 2010)
@@ -56,7 +56,7 @@
         {
             typedef typename Range::const_iterator iterator;
             iterator i = range.begin();
- if (*i == '\1') // a 1 byte at the beginning signifies a byte stream
+ if (*i == '\1') // a 1 byte at the beginning signifies a byte string
             {
                 out << "b"; ++i;
                 for (; i != range.end(); ++i)

Modified: trunk/libs/spirit/test/qi/debug.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/debug.cpp (original)
+++ trunk/libs/spirit/test/qi/debug.cpp 2010-03-11 19:20:01 EST (Thu, 11 Mar 2010)
@@ -39,10 +39,11 @@
     using boost::spirit::qi::fail;
     using boost::spirit::qi::on_error;
     using boost::spirit::qi::debug;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::alpha;
 
     namespace phx = boost::phoenix;
 
-
     { // basic tests
 
         rule<char const*> a, b, c, start;
@@ -88,6 +89,16 @@
         BOOST_TEST(test(" a a a a b a b a b a a a b b a ", start, space, false));
     }
 
+ { // std::contaner attributes
+
+ typedef boost::fusion::vector<int, char> fs;
+ rule<char const*, std::vector<fs>(), space_type> start;
+ start = *(int_ >> alpha);
+
+ BOOST_SPIRIT_DEBUG_NODE(start);
+ BOOST_TEST(test("1 a 2 b 3 c", start, space));
+ }
+
     { // error handling
 
         using namespace boost::spirit::ascii;


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