Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71100 - trunk/libs/spirit/test/qi
From: joel_at_[hidden]
Date: 2011-04-07 20:21:27


Author: djowel
Date: 2011-04-07 20:21:27 EDT (Thu, 07 Apr 2011)
New Revision: 71100
URL: http://svn.boost.org/trac/boost/changeset/71100

Log:
Fixes http://boost.2283326.n4.nabble.com/Grammar-stopped-compiling-on-more-recent-spirit-version-td3432652.html
Text files modified:
   trunk/libs/spirit/test/qi/alternative.cpp | 31 +++++++++++++++++++++++++++++++
   1 files changed, 31 insertions(+), 0 deletions(-)

Modified: trunk/libs/spirit/test/qi/alternative.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/alternative.cpp (original)
+++ trunk/libs/spirit/test/qi/alternative.cpp 2011-04-07 20:21:27 EDT (Thu, 07 Apr 2011)
@@ -15,9 +15,11 @@
 #include <boost/spirit/include/qi_action.hpp>
 #include <boost/spirit/include/qi_nonterminal.hpp>
 #include <boost/spirit/include/qi_auxiliary.hpp>
+#include <boost/spirit/include/qi_rule.hpp>
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
 #include <boost/variant.hpp>
 #include <boost/assert.hpp>
 
@@ -55,6 +57,26 @@
     }
 };
 
+struct DIgnore
+{
+ std::string text;
+};
+
+struct DInclude
+{
+ std::string FileName;
+};
+
+BOOST_FUSION_ADAPT_STRUCT(
+ DIgnore,
+ (std::string, text)
+)
+
+BOOST_FUSION_ADAPT_STRUCT(
+ DInclude,
+ (std::string, FileName)
+)
+
 int
 main()
 {
@@ -228,6 +250,15 @@
         rule<std::string::const_iterator, value_type()> r1 = r1 | eps;
     }
 
+ {
+ using boost::spirit::qi::rule;
+ typedef boost::variant<DIgnore, DInclude> DLine;
+
+ rule<char*, DIgnore()> ignore;
+ rule<char*, DInclude()> include;
+ rule<char*, DLine()> line = include | ignore;
+ }
+
     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