Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55011 - in trunk/libs/spirit: doc example/qi test/qi
From: joel_at_[hidden]
Date: 2009-07-18 00:25:56


Author: djowel
Date: 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
New Revision: 55011
URL: http://svn.boost.org/trac/boost/changeset/55011

Log:
loop parsers fixes
Text files modified:
   trunk/libs/spirit/doc/qi.qbk | 2 +-
   trunk/libs/spirit/example/qi/reference.cpp | 2 +-
   trunk/libs/spirit/test/qi/kleene.cpp | 7 +++++++
   trunk/libs/spirit/test/qi/list.cpp | 5 +++--
   trunk/libs/spirit/test/qi/plus.cpp | 7 +++++++
   trunk/libs/spirit/test/qi/repeat.cpp | 7 +++++++
   6 files changed, 26 insertions(+), 4 deletions(-)

Modified: trunk/libs/spirit/doc/qi.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi.qbk (original)
+++ trunk/libs/spirit/doc/qi.qbk 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
@@ -34,7 +34,7 @@
 [include qi/action.qbk]
 [include qi/auxiliary.qbk]
 [include qi/binary.qbk]
-[include qi/char.qbk]
+[/ include qi/char.qbk]
 [include qi/directive.qbk]
 [include qi/nonterminal.qbk]
 [include qi/numeric.qbk]

Modified: trunk/libs/spirit/example/qi/reference.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/reference.cpp (original)
+++ trunk/libs/spirit/example/qi/reference.cpp 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
@@ -94,7 +94,7 @@
         sym.add
             ("Apple", 1)
             ("Banana", 2)
- ("orange", 3)
+ ("Orange", 3)
         ;
 
         int i;

Modified: trunk/libs/spirit/test/qi/kleene.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/kleene.cpp (original)
+++ trunk/libs/spirit/test/qi/kleene.cpp 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
@@ -33,6 +33,7 @@
     using boost::spirit::qi::omit;
     using boost::spirit::qi::uint_;
     using boost::spirit::qi::int_;
+ using boost::spirit::qi::lexeme;
 
     {
         BOOST_TEST(test("aaaaaaaa", *char_));
@@ -83,6 +84,12 @@
         BOOST_TEST(test_attr("123 456 789 10", *int_, v, space) && 4 == v.size() &&
             v[0] == 123 && v[1] == 456 && v[2] == 789 && v[3] == 10);
     }
+
+ {
+ std::vector<std::string> v;
+ BOOST_TEST(test_attr("a b c d", *lexeme[+alpha], v, space) && 4 == v.size() &&
+ v[0] == "a" && v[1] == "b" && v[2] == "c" && v[3] == "d");
+ }
 
     {
         std::vector<int> v;

Modified: trunk/libs/spirit/test/qi/list.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/list.cpp (original)
+++ trunk/libs/spirit/test/qi/list.cpp 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
@@ -67,8 +67,9 @@
     
     {
         std::vector<std::string> v;
- BOOST_TEST(test_attr("a,b", +alpha % ',', v));
- BOOST_TEST(2 == v.size() && "a" == v[0] && "b" == v[1]);
+ BOOST_TEST(test_attr("a,b,c,d", +alpha % ',', v));
+ BOOST_TEST(4 == v.size() && "a" == v[0] && "b" == v[1]
+ && "c" == v[2] && "d" == v[3]);
     }
 
     { // actions

Modified: trunk/libs/spirit/test/qi/plus.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/plus.cpp (original)
+++ trunk/libs/spirit/test/qi/plus.cpp 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
@@ -34,6 +34,7 @@
     using boost::spirit::qi::omit;
     using boost::spirit::qi::lit;
     using boost::spirit::qi::_1;
+ using boost::spirit::qi::lexeme;
 
     {
         BOOST_TEST(test("aaaaaaaa", +char_));
@@ -60,6 +61,12 @@
     }
 
     {
+ std::vector<std::string> v;
+ BOOST_TEST(test_attr("a b c d", +lexeme[+alpha], v, space) && 4 == v.size() &&
+ v[0] == "a" && v[1] == "b" && v[2] == "c" && v[3] == "d");
+ }
+
+ {
         BOOST_TEST(test("Kim Kim Kim", +lit("Kim"), space));
     }
 

Modified: trunk/libs/spirit/test/qi/repeat.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/repeat.cpp (original)
+++ trunk/libs/spirit/test/qi/repeat.cpp 2009-07-18 00:25:54 EDT (Sat, 18 Jul 2009)
@@ -37,6 +37,7 @@
     using boost::spirit::qi::omit;
     using boost::spirit::qi::int_;
     using boost::spirit::qi::_1;
+ using boost::spirit::qi::lexeme;
 
     {
         BOOST_TEST(test("aaaaaaaa", repeat[char_])); // kleene synonym
@@ -107,6 +108,12 @@
     }
 
     {
+ std::vector<std::string> v;
+ BOOST_TEST(test_attr("a b c d", repeat(4)[lexeme[+alpha]], v, space) && 4 == v.size() &&
+ v[0] == "a" && v[1] == "b" && v[2] == "c" && v[3] == "d");
+ }
+
+ {
         std::string s;
         BOOST_TEST(test_attr("bbbb", repeat(4)[char_], s) && s == "bbbb");
 


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