|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53594 - trunk/libs/spirit/test/qi
From: joel_at_[hidden]
Date: 2009-06-03 06:35:33
Author: djowel
Date: 2009-06-03 06:35:32 EDT (Wed, 03 Jun 2009)
New Revision: 53594
URL: http://svn.boost.org/trac/boost/changeset/53594
Log:
fix to allow directives over lazy parsers
Text files modified:
trunk/libs/spirit/test/qi/no_case.cpp | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/test/qi/no_case.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/no_case.cpp (original)
+++ trunk/libs/spirit/test/qi/no_case.cpp 2009-06-03 06:35:32 EDT (Wed, 03 Jun 2009)
@@ -9,6 +9,9 @@
#include <boost/spirit/include/qi_char.hpp>
#include <boost/spirit/include/qi_string.hpp>
#include <boost/spirit/include/qi_directive.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
#include <iostream>
#include "test.hpp"
@@ -141,5 +144,32 @@
BOOST_TEST(test("Bochi Bochi", no_case[s]));
}
+ { // lazy no_case chars
+
+ using namespace boost::spirit::ascii;
+
+ using boost::phoenix::val;
+ using boost::phoenix::ref;
+ using boost::spirit::_1;
+
+ BOOST_TEST((test("X", no_case[val('x')])));
+ BOOST_TEST((test("h", no_case[char_(val('a'), val('n'))])));
+ BOOST_TEST(test("0", no_case[char_(val("a-z0-9"))]));
+
+ char ch; // make sure lazy chars have an attribute
+ BOOST_TEST(test("x", no_case[char_(val('x'))][ref(ch) = _1]));
+ BOOST_TEST(ch == 'x');
+ }
+
+ { // lazy no_case lits
+
+ using namespace boost::spirit::ascii;
+ using boost::phoenix::val;
+
+ BOOST_TEST(test("Bochi Bochi", no_case[val("bochi bochi")]));
+ BOOST_TEST(test("BOCHI BOCHI", no_case[val("bochi bochi")]));
+ BOOST_TEST(!test("Vavoo", no_case[val("bochi bochi")]));
+ }
+
return boost::report_errors();
}
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