Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67126 - in trunk: boost/spirit/home/support/utree libs/spirit/example/scheme/input libs/spirit/example/scheme/output libs/spirit/example/scheme/qi libs/spirit/example/scheme/scheme libs/spirit/example/scheme/test libs/spirit/example/scheme/test/qi libs/spirit/example/scheme/test/scheme libs/spirit/example/scheme/test/utree
From: admin_at_[hidden]
Date: 2010-12-09 00:14:54


Author: wash
Date: 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
New Revision: 67126
URL: http://svn.boost.org/trac/boost/changeset/67126

Log:
Modified the scheme example to use utree from boost::spirit.

Removed:
   trunk/libs/spirit/example/scheme/output/utree_traits.hpp
   trunk/libs/spirit/example/scheme/test/utree/
Text files modified:
   trunk/boost/spirit/home/support/utree/utree_traits.hpp | 18 +++++++++++++++++-
   trunk/libs/spirit/example/scheme/input/parse_sexpr.hpp | 1 -
   trunk/libs/spirit/example/scheme/input/sexpr.hpp | 17 +++++++++++++++--
   trunk/libs/spirit/example/scheme/input/string.hpp | 13 +------------
   trunk/libs/spirit/example/scheme/output/generate_sexpr.hpp | 3 +--
   trunk/libs/spirit/example/scheme/output/generate_sexpr_impl.hpp | 2 +-
   trunk/libs/spirit/example/scheme/output/sexpr.hpp | 30 +++++++++++++++++++++---------
   trunk/libs/spirit/example/scheme/qi/generate_qiexpr.hpp | 2 +-
   trunk/libs/spirit/example/scheme/qi/parse_qiexpr.hpp | 2 +-
   trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp | 40 ++++++++++++++++++++++++++--------------
   trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp | 19 ++++++++++++++++---
   trunk/libs/spirit/example/scheme/scheme/compiler.hpp | 5 ++---
   trunk/libs/spirit/example/scheme/scheme/interpreter.hpp | 20 +++++++++++++++++---
   trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp | 21 ++++++++++++++++++---
   trunk/libs/spirit/example/scheme/test/Jamfile | 1 -
   trunk/libs/spirit/example/scheme/test/qi/qi_interpreter.cpp | 1 -
   trunk/libs/spirit/example/scheme/test/scheme/scheme_test1.cpp | 1 -
   trunk/libs/spirit/example/scheme/test/scheme/scheme_test2.cpp | 1 -
   trunk/libs/spirit/example/scheme/test/scheme/scheme_test3.cpp | 1 -
   19 files changed, 137 insertions(+), 61 deletions(-)

Modified: trunk/boost/spirit/home/support/utree/utree_traits.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/utree_traits.hpp (original)
+++ trunk/boost/spirit/home/support/utree/utree_traits.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -83,7 +83,7 @@
         {
             attr = make_iterator_range(traits::begin(val), traits::end(val));
         }
-
+
         static void call(Attribute const& val, utree& attr)
         {
             call(val, attr, is_container<Attribute>());
@@ -91,6 +91,22 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
+ // this specialization keeps symbols from being transformed into strings
+ template<>
+ struct assign_to_attribute_from_value<utree, utf8_symbol> {
+ static void call (utf8_symbol const& val, utree& attr) {
+ attr = val;
+ }
+ };
+
+ template<>
+ struct assign_to_attribute_from_value<utree, utf8_symbol_range> {
+ static void call (utf8_symbol_range const& val, utree& attr) {
+ attr = val;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
     // this specialization is required to disambiguate the specializations
     // related to utree
     template <>

Modified: trunk/libs/spirit/example/scheme/input/parse_sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/input/parse_sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/input/parse_sexpr.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -7,7 +7,6 @@
 #if !defined(BOOST_SPIRIT_PARSE_SEXPR)
 #define BOOST_SPIRIT_PARSE_SEXPR
 
-#include <utree/utree.hpp>
 #include <input/sexpr.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_base_of.hpp>

Modified: trunk/libs/spirit/example/scheme/input/sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/input/sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/input/sexpr.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -11,14 +11,13 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_container.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/regex/pending/unicode_iterator.hpp>
 
-#include <utree/utree.hpp>
-#include <utree/operators.hpp>
 #include <input/string.hpp>
 #include <input/error_handler.hpp>
 
@@ -50,6 +49,20 @@
     using boost::spirit::qi::eps;
     using boost::spirit::qi::omit;
     using boost::spirit::info;
+
+ using boost::spirit::utree;
+ using boost::spirit::utree_type;
+ using boost::spirit::scope;
+ using boost::spirit::shallow;
+ using boost::spirit::stored_function;
+ using boost::spirit::function_base;
+ using boost::spirit::binary_string;
+ using boost::spirit::utf8_symbol;
+ using boost::spirit::utf8_string;
+ using boost::spirit::binary_range;
+ using boost::spirit::utf8_symbol_range;
+ using boost::spirit::utf8_string_range;
+ using boost::spirit::nil;
 
     typedef boost::uint32_t uchar; // a unicode code point
 

Modified: trunk/libs/spirit/example/scheme/input/string.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/input/string.hpp (original)
+++ trunk/libs/spirit/example/scheme/input/string.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -17,9 +17,6 @@
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/regex/pending/unicode_iterator.hpp>
 
-#include <utree/utree.hpp>
-#include <utree/operators.hpp>
-
 namespace scheme { namespace input
 {
     using boost::spirit::standard::char_;
@@ -88,25 +85,17 @@
                   )
                 ;
 
- char_lit
- = '\''
- > (char_esc(_val) | (~char_('\'')) [_val += _1])
- > '\''
- ;
-
             start
- = '"'
+ = '"'
> *(char_esc(_val) | (~char_('"')) [_val += _1])
> '"'
                 ;
 
             char_esc.name("char_esc");
- char_lit.name("char_lit");
             start.name("string");
         }
 
         rule<Iterator, void(std::string&)> char_esc;
- rule<Iterator, std::string()> char_lit;
         rule<Iterator, std::string()> start;
     };
 }}

Modified: trunk/libs/spirit/example/scheme/output/generate_sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/output/generate_sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/output/generate_sexpr.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
+// Copyright (c) 2001-2010 Hartmut Kaiser, Bryce Lelbach
 //
 // 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)
@@ -6,7 +6,6 @@
 #if !defined(SCHEME_OUTPUT_GENERATE_SEXPR_MAR_29_2010_1210PM)
 #define SCHEME_OUTPUT_GENERATE_SEXPR_MAR_29_2010_1210PM
 
-#include <utree/utree.hpp>
 #include <output/sexpr.hpp>
 
 namespace scheme { namespace output

Modified: trunk/libs/spirit/example/scheme/output/generate_sexpr_impl.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/output/generate_sexpr_impl.hpp (original)
+++ trunk/libs/spirit/example/scheme/output/generate_sexpr_impl.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
+// Copyright (c) 2001-2010 Hartmut Kaiser, Bryce Lelbach
 //
 // 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)

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-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
+// Copyright (c) 2001-2010 Hartmut Kaiser, Bryce Lelbach
 //
 // 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)
@@ -6,14 +6,12 @@
 #if !defined(SCHEME_OUTPUT_SEXPR_MAR_8_2010_829AM)
 #define SCHEME_OUTPUT_SEXPR_MAR_8_2010_829AM
 
-#include <utree/utree.hpp>
-#include <output/utree_traits.hpp>
-
 #include <string>
 
 #include <boost/cstdint.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/spirit/include/karma.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace scheme { namespace output
@@ -30,6 +28,20 @@
     using boost::spirit::karma::hex;
     using boost::spirit::karma::right_align;
 
+ using boost::spirit::utree;
+ using boost::spirit::utree_type;
+ using boost::spirit::scope;
+ using boost::spirit::shallow;
+ using boost::spirit::stored_function;
+ using boost::spirit::function_base;
+ using boost::spirit::binary_string;
+ using boost::spirit::utf8_symbol;
+ using boost::spirit::utf8_string;
+ using boost::spirit::binary_range;
+ using boost::spirit::utf8_symbol_range;
+ using boost::spirit::utf8_string_range;
+ using boost::spirit::nil;
+
     template <typename OutputIterator>
     struct sexpr : grammar<OutputIterator, space_type, utree()>
     {
@@ -37,14 +49,14 @@
         {
             uint_generator<unsigned char, 16> hex2;
 
- start %= double_
+ start = double_
                       | int_
                       | bool_
                       | string_
                       | symbol
                       | byte_str
                       | list
- | nil
+ | nil_
                       | ref_
                       ;
 
@@ -53,7 +65,7 @@
             string_ = '"' << string << '"';
             symbol = string;
             byte_str = '#' << *right_align(2, '0')[hex2] << '#';
- nil = eps << "<nil>";
+ nil_ = eps << "<nil>";
             ref_ = start;
 
             start.name("start");
@@ -61,7 +73,7 @@
             string_.name("string_");
             symbol.name("symbol");
             byte_str.name("byte_str");
- nil.name("nil");
+ nil_.name("nil");
             ref_.name("ref_");
         }
 
@@ -72,7 +84,7 @@
         rule<OutputIterator, utf8_symbol_range()> symbol;
         rule<OutputIterator, utf8_string_range()> string_;
         rule<OutputIterator, binary_range()> byte_str;
- rule<OutputIterator, scheme::nil()> nil;
+ rule<OutputIterator, nil()> nil_;
         rule<OutputIterator, space_type, utree()> ref_;
     };
 }}

Deleted: trunk/libs/spirit/example/scheme/output/utree_traits.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/output/utree_traits.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
+++ (empty file)
@@ -1,318 +0,0 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-//
-// 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)
-
-#if !defined(SCHEME_OUTPUT_UTREE_TRAITS_APR_16_2010_0655AM)
-#define SCHEME_OUTPUT_UTREE_TRAITS_APR_16_2010_0655AM
-
-#include <utree/utree.hpp>
-
-#include <string>
-
-#include <boost/cstdint.hpp>
-#include <boost/spirit/include/karma.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost
-{
- template <typename T>
- inline T get(scheme::utree const& x)
- {
- return x.get<T>();
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- ///////////////////////////////////////////////////////////////////////////
- // the specialization below tells Spirit to handle scheme::utree as if it
- // where a 'real' variant (in the context of karma)
- template <>
- 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 <>
- struct compute_compatible_component_variant<
- scheme::utree, iterator_range<scheme::utree::iterator> >
- : mpl::true_
- {
- typedef iterator_range<scheme::utree::iterator> compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::list_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, iterator_range<scheme::utree::const_iterator> >
- : mpl::true_
- {
- typedef iterator_range<scheme::utree::const_iterator> compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::list_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<scheme::utree, scheme::nil>
- : mpl::true_
- {
- typedef scheme::nil compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::nil_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<scheme::utree, bool>
- : mpl::true_
- {
- typedef bool compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::bool_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<scheme::utree, int>
- : mpl::true_
- {
- typedef int compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::int_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<scheme::utree, double>
- : mpl::true_
- {
- typedef double compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::double_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, scheme::utf8_string_range>
- : mpl::true_
- {
- typedef scheme::utf8_string_range compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::string_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, scheme::utf8_string>
- : mpl::true_
- {
- typedef scheme::utf8_string compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::string_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, scheme::utf8_symbol_range>
- : mpl::true_
- {
- typedef scheme::utf8_symbol_range compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::symbol_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, scheme::utf8_symbol>
- : mpl::true_
- {
- typedef scheme::utf8_symbol compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::symbol_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, scheme::binary_range>
- : mpl::true_
- {
- typedef scheme::binary_range compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::binary_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, scheme::binary_string>
- : mpl::true_
- {
- typedef scheme::binary_string compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::binary_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<scheme::utree, scheme::utree>
- : mpl::true_
- {
- typedef scheme::utree compatible_type;
-
- static bool is_compatible(int d)
- {
- return d >= scheme::utree_type::nil_type &&
- d <= scheme::utree_type::reference_type;
- }
- };
-
- template <>
- struct compute_compatible_component_variant<
- scheme::utree, std::vector<scheme::utree> >
- : mpl::true_
- {
- typedef scheme::utree compatible_type;
-
- static bool is_compatible(int d)
- {
- return d >= scheme::utree_type::nil_type &&
- d <= scheme::utree_type::reference_type;
- }
- };
-
- template <typename Sequence>
- struct compute_compatible_component_variant<scheme::utree, Sequence
- , mpl::false_
- , typename enable_if<fusion::traits::is_sequence<Sequence> >::type>
- : mpl::true_
- {
- typedef iterator_range<scheme::utree::const_iterator> compatible_type;
-
- static bool is_compatible(int d)
- {
- return d == scheme::utree_type::list_type;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
- template <>
- struct symbols_lookup<scheme::utree, scheme::utf8_symbol>
- {
- typedef std::string type;
-
- static type call(scheme::utree const& t)
- {
- scheme::utf8_symbol_range r = boost::get<scheme::utf8_symbol_range>(t);
- return std::string(r.begin(), r.end());
- }
- };
-
- template <>
- struct symbols_lookup<scheme::utf8_symbol, scheme::utf8_symbol>
- {
- typedef std::string type;
-
- static type call(scheme::utf8_symbol const& t)
- {
- return t;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
- template <>
- struct extract_from_attribute<scheme::utree, scheme::utf8_symbol>
- {
- typedef std::string type;
-
- template <typename Context>
- static type call(scheme::utree const& t, Context&)
- {
- scheme::utf8_symbol_range r = boost::get<scheme::utf8_symbol_range>(t);
- return std::string(r.begin(), r.end());
- }
- };
-
- template <>
- struct extract_from_attribute<scheme::utree, scheme::utf8_string>
- {
- typedef std::string type;
-
- template <typename Context>
- static type call(scheme::utree const& t, Context&)
- {
- scheme::utf8_string_range r = boost::get<scheme::utf8_string_range>(t);
- return std::string(r.begin(), r.end());
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
- template <>
- struct transform_attribute<scheme::utree const, scheme::utf8_string, karma::domain>
- {
- typedef std::string type;
-
- static type pre(scheme::utree const& t)
- {
- scheme::utf8_string_range r = boost::get<scheme::utf8_string_range>(t);
- return std::string(r.begin(), r.end());
- }
- };
-
- template <>
- struct transform_attribute<scheme::utree const, scheme::utf8_symbol, karma::domain>
- {
- typedef std::string type;
-
- static type pre(scheme::utree const& t)
- {
- scheme::utf8_symbol_range r = boost::get<scheme::utf8_symbol_range>(t);
- return std::string(r.begin(), r.end());
- }
- };
-}}}
-
-#endif

Modified: trunk/libs/spirit/example/scheme/qi/generate_qiexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/generate_qiexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/generate_qiexpr.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -6,7 +6,7 @@
 #if !defined(BOOST_SPIRIT_GENERATE_QIEXPR)
 #define BOOST_SPIRIT_GENERATE_QIEXPR
 
-#include <utree/utree.hpp>
+#include <output/sexpr.hpp>
 
 namespace scheme { namespace output
 {

Modified: trunk/libs/spirit/example/scheme/qi/parse_qiexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/parse_qiexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/parse_qiexpr.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -6,7 +6,7 @@
 #if !defined(BOOST_SPIRIT_PARSE_QIEXPR)
 #define BOOST_SPIRIT_PARSE_QIEXPR
 
-#include <utree/utree.hpp>
+#include <input/sexpr.hpp>
 
 namespace scheme { namespace input
 {

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-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -10,18 +10,16 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/spirit/include/karma.hpp>
+#include <boost/spirit/include/support_sexpr.hpp>
 #include <boost/spirit/include/phoenix.hpp>
 
-#include <utree/utree.hpp>
-#include <utree/operators.hpp>
-#include <output/utree_traits.hpp>
 #include <qi/component_names.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace traits
 {
     template <typename Out>
- void print_attribute(Out& out, scheme::utree const& val);
+ void print_attribute(Out& out, utree const& val);
 }}}
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -31,6 +29,20 @@
     using boost::spirit::karma::rule;
     using boost::spirit::karma::space_type;
     using boost::spirit::karma::symbols;
+
+ using boost::spirit::utree;
+ using boost::spirit::utree_type;
+ using boost::spirit::scope;
+ using boost::spirit::shallow;
+ using boost::spirit::stored_function;
+ using boost::spirit::function_base;
+ using boost::spirit::binary_string;
+ using boost::spirit::utf8_symbol;
+ using boost::spirit::utf8_string;
+ using boost::spirit::binary_range;
+ using boost::spirit::utf8_symbol_range;
+ using boost::spirit::utf8_string_range;
+ using boost::spirit::nil;
 
     ///////////////////////////////////////////////////////////////////////////
     namespace traits
@@ -69,12 +81,12 @@
             using boost::phoenix::ref;
 
             start =
- nil
+ nil_
                 | rule_
                 ;
 
             grammar_ =
- nil
+ nil_
                 | rule_ % eol
                 ;
 
@@ -119,7 +131,7 @@
             any_symbol = string;
             symbol = string(_r1);
             literal = '"' << string << '"';
- nil = eps;
+ nil_ = eps;
 
             // fill the symbol tables with all known primitive parser names
             std::string name("qi:");
@@ -146,7 +158,7 @@
             BOOST_SPIRIT_DEBUG_NODE(permutation);
             BOOST_SPIRIT_DEBUG_NODE(sequence);
             BOOST_SPIRIT_DEBUG_NODE(term);
- BOOST_SPIRIT_DEBUG_NODE(nil);
+ BOOST_SPIRIT_DEBUG_NODE(nil_);
             BOOST_SPIRIT_DEBUG_NODE(literal);
             BOOST_SPIRIT_DEBUG_NODE(symbol);
             BOOST_SPIRIT_DEBUG_NODE(any_symbol);
@@ -159,13 +171,13 @@
         delimiting_rule_type start, alternative, permutation, sequence, term;
         delimiting_rule_type grammar_, rule_;
         delimiting_rule_type rule_name, primitive0_rule, alternative_rule;
- rule<OutputIterator, scheme::nil()> nil;
- rule<OutputIterator, scheme::utf8_string()> literal;
- rule<OutputIterator, scheme::utf8_symbol(std::string)> symbol;
- rule<OutputIterator, scheme::utf8_symbol()> any_symbol;
+ rule<OutputIterator, nil()> nil_;
+ rule<OutputIterator, utf8_string()> literal;
+ rule<OutputIterator, utf8_symbol(std::string)> symbol;
+ rule<OutputIterator, utf8_symbol()> any_symbol;
 
- symbols<scheme::utf8_symbol> unary, directive0;
- symbols<scheme::utf8_symbol> primitive0, primitive1, primitive2;
+ symbols<utf8_symbol> unary, directive0;
+ symbols<utf8_symbol> primitive0, primitive1, primitive2;
     };
 }}
 

Modified: trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -11,13 +11,12 @@
 #include <boost/cstdint.hpp>
 #include <boost/detail/iterator.hpp>
 #include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/support_sexpr.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_stl.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
-#include <utree/utree.hpp>
-#include <utree/operators.hpp>
 #include <input/string.hpp>
 #include <qi/component_names.hpp>
 
@@ -25,7 +24,7 @@
 namespace boost { namespace spirit { namespace traits
 {
     template <typename Out>
- void print_attribute(Out& out, scheme::utree const& val);
+ void print_attribute(Out& out, utree const& val);
 }}}
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -42,6 +41,20 @@
     using boost::spirit::qi::_2;
     using boost::spirit::qi::lexeme;
     using boost::phoenix::push_back;
+
+ using boost::spirit::utree;
+ using boost::spirit::utree_type;
+ using boost::spirit::scope;
+ using boost::spirit::shallow;
+ using boost::spirit::stored_function;
+ using boost::spirit::function_base;
+ using boost::spirit::binary_string;
+ using boost::spirit::utf8_symbol;
+ using boost::spirit::utf8_string;
+ using boost::spirit::binary_range;
+ using boost::spirit::utf8_symbol_range;
+ using boost::spirit::utf8_string_range;
+ using boost::spirit::nil;
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator>

Modified: trunk/libs/spirit/example/scheme/scheme/compiler.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/scheme/compiler.hpp (original)
+++ trunk/libs/spirit/example/scheme/scheme/compiler.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -559,8 +559,7 @@
                     int progline = (program.which() == utree_type::list_type)
                         ? program.tag() : line;
 
- if (progline != -1)
- std::cerr << '(' << progline << ')';
+ std::cerr << '(' << progline << ')';
 
                     std::cerr << " : Error! scheme: Function definition expected." << std::endl;
                     continue; // try the next expression
@@ -604,7 +603,7 @@
         template <typename Source>
         interpreter(
             Source& in,
- std::string const& source_file = "",
+ std::string const& source_file = "<string>",
             environment* envp = 0)
         {
             if (envp == 0)

Modified: trunk/libs/spirit/example/scheme/scheme/interpreter.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/scheme/interpreter.hpp (original)
+++ trunk/libs/spirit/example/scheme/scheme/interpreter.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -13,7 +13,7 @@
 #include <boost/array.hpp>
 #include <boost/scoped_array.hpp>
 #include <boost/preprocessor/repetition/enum_params.hpp>
-#include <utree/utree.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 
 #define SCHEME_COMPOSITE_LIMIT 10
 
@@ -27,6 +27,20 @@
 ///////////////////////////////////////////////////////////////////////////////
 // The runtime interpreter
 ///////////////////////////////////////////////////////////////////////////////
+
+ using boost::spirit::utree;
+ using boost::spirit::utree_type;
+ using boost::spirit::scope;
+ using boost::spirit::shallow;
+ using boost::spirit::stored_function;
+ using boost::spirit::function_base;
+ using boost::spirit::binary_string;
+ using boost::spirit::utf8_symbol;
+ using boost::spirit::utf8_string;
+ using boost::spirit::binary_range;
+ using boost::spirit::utf8_symbol_range;
+ using boost::spirit::utf8_string_range;
+ using boost::spirit::nil;
 
     ///////////////////////////////////////////////////////////////////////////
     // typedefs
@@ -226,8 +240,8 @@
     template <bool scoped = true>
     struct vararg_function : actor<vararg_function<scoped> >
     {
- std::size_t level;
         std::size_t n;
+ std::size_t level;
         vararg_function(std::size_t n, std::size_t level = 0)
           : n(n),
             level(level)
@@ -489,7 +503,7 @@
         boost::reference_wrapper<function const> f;
 
         lambda_function(function const& f, actor_list const& elements, int level = 0)
- : elements(elements), f(f), level(level) {}
+ : level(level), elements(elements), f(f) {}
 
         typedef utree result_type;
         utree eval(scope const& env) const

Modified: trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp (original)
+++ trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2001-2010 Joel de Guzman, Bryce Lelbach
 
     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)
@@ -8,11 +8,26 @@
 #define BOOST_SPIRIT_SCHEME_INTRINSICS
 
 #include <scheme/interpreter.hpp>
-#include <utree/operators.hpp>
 #include <iostream>
 
 namespace scheme
 {
+ namespace detail {
+
+ inline utree rest(utree& x)
+ {
+ utree::iterator i = x.begin(); ++i;
+ return utree(utree::range(i, x.end()), shallow);
+ }
+
+ inline utree rest(utree const& x)
+ {
+ utree::const_iterator i = x.begin(); ++i;
+ return utree(utree::const_range(i, x.end()), shallow);
+ }
+
+ }
+
     ///////////////////////////////////////////////////////////////////////////
     // if
     ///////////////////////////////////////////////////////////////////////////
@@ -194,7 +209,7 @@
     SCHEME_UNARY_INTRINSIC(display, (std::cout << element, utree()));
     SCHEME_UNARY_INTRINSIC(front, element.front());
     SCHEME_UNARY_INTRINSIC(back, element.back());
- SCHEME_UNARY_INTRINSIC(rest, utree_functions::rest(element));
+ SCHEME_UNARY_INTRINSIC(rest, detail::rest(element));
 
     ///////////////////////////////////////////////////////////////////////////
     // binary intrinsics

Modified: trunk/libs/spirit/example/scheme/test/Jamfile
==============================================================================
--- trunk/libs/spirit/example/scheme/test/Jamfile (original)
+++ trunk/libs/spirit/example/scheme/test/Jamfile 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -21,7 +21,6 @@
     test-suite utree :
 
     # run utree tests
- [ run utree/utree_test.cpp : : : : ]
     [ run scheme/scheme_test1.cpp : : : : ]
     [ run scheme/scheme_test2.cpp : scheme/scheme_test.scm test1 test2 test3 test4 : : : ]
     [ run scheme/scheme_test3.cpp : : : : ]

Modified: trunk/libs/spirit/example/scheme/test/qi/qi_interpreter.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/test/qi/qi_interpreter.cpp (original)
+++ trunk/libs/spirit/example/scheme/test/qi/qi_interpreter.cpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -10,7 +10,6 @@
 #include <input/sexpr.hpp>
 #include <input/parse_sexpr_impl.hpp>
 #include <scheme/compiler.hpp>
-#include <utree/io.hpp>
 #include <boost/spirit/include/qi.hpp>
 
 #include <iostream>

Modified: trunk/libs/spirit/example/scheme/test/scheme/scheme_test1.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/test/scheme/scheme_test1.cpp (original)
+++ trunk/libs/spirit/example/scheme/test/scheme/scheme_test1.cpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -9,7 +9,6 @@
 
 #include <input/parse_sexpr_impl.hpp>
 #include <scheme/compiler.hpp>
-#include <utree/io.hpp>
 #include <iostream>
 #include <fstream>
 

Modified: trunk/libs/spirit/example/scheme/test/scheme/scheme_test2.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/test/scheme/scheme_test2.cpp (original)
+++ trunk/libs/spirit/example/scheme/test/scheme/scheme_test2.cpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -9,7 +9,6 @@
 
 #include <input/parse_sexpr_impl.hpp>
 #include <scheme/compiler.hpp>
-#include <utree/io.hpp>
 #include <iostream>
 #include <fstream>
 

Modified: trunk/libs/spirit/example/scheme/test/scheme/scheme_test3.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/test/scheme/scheme_test3.cpp (original)
+++ trunk/libs/spirit/example/scheme/test/scheme/scheme_test3.cpp 2010-12-09 00:14:51 EST (Thu, 09 Dec 2010)
@@ -10,7 +10,6 @@
 #include <input/sexpr.hpp>
 #include <input/parse_sexpr_impl.hpp>
 #include <scheme/compiler.hpp>
-#include <utree/io.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program


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