|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61728 - in trunk/libs/spirit/example/scheme: example/generate_qiexpr output qi
From: hartmut.kaiser_at_[hidden]
Date: 2010-05-01 23:21:11
Author: hkaiser
Date: 2010-05-01 23:21:10 EDT (Sat, 01 May 2010)
New Revision: 61728
URL: http://svn.boost.org/trac/boost/changeset/61728
Log:
Spirit: more changes to scheme stuff
Text files modified:
trunk/libs/spirit/example/scheme/example/generate_qiexpr/generate_qiexpr.cpp | 2 +-
trunk/libs/spirit/example/scheme/output/sexpr.hpp | 4 ----
trunk/libs/spirit/example/scheme/output/utree_traits.hpp | 10 ++++++++++
trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp | 11 ++++++-----
4 files changed, 17 insertions(+), 10 deletions(-)
Modified: trunk/libs/spirit/example/scheme/example/generate_qiexpr/generate_qiexpr.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/example/generate_qiexpr/generate_qiexpr.cpp (original)
+++ trunk/libs/spirit/example/scheme/example/generate_qiexpr/generate_qiexpr.cpp 2010-05-01 23:21:10 EDT (Sat, 01 May 2010)
@@ -3,7 +3,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-// #define BOOST_SPIRIT_KARMA_DEBUG
+#define BOOST_SPIRIT_KARMA_DEBUG
#include <utree/operators.hpp>
Modified: trunk/libs/spirit/example/scheme/output/sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/output/sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/output/sexpr.hpp 2010-05-01 23:21:10 EDT (Sat, 01 May 2010)
@@ -23,14 +23,10 @@
using boost::spirit::karma::rule;
using boost::spirit::karma::double_;
using boost::spirit::karma::int_;
- using boost::spirit::karma::char_;
using boost::spirit::karma::string;
using boost::spirit::karma::bool_;
using boost::spirit::karma::eps;
- using boost::spirit::karma::space_type;
using boost::spirit::karma::uint_generator;
- using boost::spirit::karma::verbatim;
- using boost::spirit::karma::delimit;
using boost::spirit::karma::hex;
using boost::spirit::karma::right_align;
Modified: trunk/libs/spirit/example/scheme/output/utree_traits.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/output/utree_traits.hpp (original)
+++ trunk/libs/spirit/example/scheme/output/utree_traits.hpp 2010-05-01 23:21:10 EDT (Sat, 01 May 2010)
@@ -33,6 +33,16 @@
struct not_is_variant<scheme::utree, karma::domain>
: mpl::false_ {};
+ ///////////////////////////////////////////////////////////////////////////
+ // this specialization tells Spirit how to extract the type of the value
+ // stored in the given utree node
+ template <>
+ struct variant_which<scheme::utree>
+ {
+ static int call(scheme::utree const& u) { return u.which(); }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
// The specializations below tell Spirit to verify whether an attribute
// type is compatible with a given variant type
template <>
Modified: trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp 2010-05-01 23:21:10 EDT (Sat, 01 May 2010)
@@ -39,7 +39,7 @@
struct deref_spec
: boost::spirit::result_of::terminal<boost::spirit::tag::repeat(Count)>
{};
- };
+ }
template <typename Count>
inline typename traits::deref_spec<Count>::type
@@ -66,6 +66,7 @@
using boost::spirit::karma::_r1;
using boost::spirit::karma::strict;
using boost::spirit::karma::eol;
+ using boost::phoenix::ref;
start =
nil
@@ -78,25 +79,25 @@
;
rule_ =
- &symbol(std::string("define"))
+ &symbol(ref("define"))
<< deref[rule_name] << '=' << deref[alternative]
| alternative
;
alternative =
- &symbol(std::string("qi:|"))
+ &symbol(ref("qi:|"))
<< '(' << strict[permutation % '|'] << ')'
| permutation
;
permutation =
- &symbol(std::string("qi:^"))
+ &symbol(ref("qi:^"))
<< '(' << strict[sequence % '^'] << ')'
| sequence
;
sequence =
- &symbol(std::string("qi:>>"))
+ &symbol(ref("qi:>>"))
<< '(' << strict[term % ">>"] << ')'
| term
;
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