Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70656 - in trunk: boost/spirit/home/lex boost/spirit/home/lex/lexer boost/spirit/home/lex/lexer/lexertl boost/spirit/home/phoenix/core boost/spirit/home/support boost/spirit/include libs/spirit/test libs/spirit/test/karma libs/spirit/test/lex libs/spirit/test/support
From: hartmut.kaiser_at_[hidden]
Date: 2011-03-27 22:37:40


Author: hkaiser
Date: 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
New Revision: 70656
URL: http://svn.boost.org/trac/boost/changeset/70656

Log:
Spirit: patch allowing to use Spirit with Phoenix V3
Added:
   trunk/boost/spirit/home/lex/argument_phoenix.hpp (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp (contents, props changed)
   trunk/boost/spirit/home/support/argument_expression.hpp (contents, props changed)
   trunk/boost/spirit/home/support/limits.hpp (contents, props changed)
   trunk/boost/spirit/home/support/terminal_expression.hpp (contents, props changed)
Text files modified:
   trunk/boost/spirit/home/lex/argument.hpp | 132 ++++++++++++++----------------------
   trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp | 12 +-
   trunk/boost/spirit/home/lex/lexer/support_functions.hpp | 47 ++++++------
   trunk/boost/spirit/home/phoenix/core/argument.hpp | 18 +++-
   trunk/boost/spirit/home/support/action_dispatch.hpp | 136 ++++++++++++++++++++++++++++++++++++++
   trunk/boost/spirit/home/support/argument.hpp | 89 +++++++++++++++++-------
   trunk/boost/spirit/home/support/char_class.hpp | 1
   trunk/boost/spirit/home/support/context.hpp | 124 +++++++++++++++++++++++-----------
   trunk/boost/spirit/home/support/make_component.hpp | 70 +++++++++++++++++++
   trunk/boost/spirit/home/support/terminal.hpp | 142 +++++++++++++++++++++++++++++----------
   trunk/boost/spirit/include/phoenix.hpp | 6 +
   trunk/boost/spirit/include/phoenix_algorithm.hpp | 6 +
   trunk/boost/spirit/include/phoenix_bind.hpp | 6 +
   trunk/boost/spirit/include/phoenix_container.hpp | 6 +
   trunk/boost/spirit/include/phoenix_core.hpp | 7 +
   trunk/boost/spirit/include/phoenix_function.hpp | 6 +
   trunk/boost/spirit/include/phoenix_fusion.hpp | 6 +
   trunk/boost/spirit/include/phoenix_object.hpp | 6 +
   trunk/boost/spirit/include/phoenix_operator.hpp | 6 +
   trunk/boost/spirit/include/phoenix_scope.hpp | 6 +
   trunk/boost/spirit/include/phoenix_statement.hpp | 6 +
   trunk/boost/spirit/include/phoenix_stl.hpp | 6 +
   trunk/libs/spirit/test/Jamfile | 51 +++++++++++++
   trunk/libs/spirit/test/karma/sequence2.cpp | 7 +
   trunk/libs/spirit/test/karma/utree1.cpp | 2
   trunk/libs/spirit/test/karma/utree2.cpp | 2
   trunk/libs/spirit/test/karma/utree3.cpp | 2
   trunk/libs/spirit/test/lex/auto_switch_lexerstate.cpp | 8 -
   trunk/libs/spirit/test/lex/id_type_enum.cpp | 5 -
   trunk/libs/spirit/test/lex/lexer_state_switcher.cpp | 2
   trunk/libs/spirit/test/lex/regression_file_iterator1.cpp | 10 -
   trunk/libs/spirit/test/lex/regression_file_iterator2.cpp | 10 -
   trunk/libs/spirit/test/lex/regression_file_iterator3.cpp | 11 +-
   trunk/libs/spirit/test/lex/regression_file_iterator4.cpp | 5 -
   trunk/libs/spirit/test/lex/regression_wide.cpp | 1
   trunk/libs/spirit/test/lex/regression_word_count.cpp | 3
   trunk/libs/spirit/test/support/utree.cpp | 1
   37 files changed, 705 insertions(+), 259 deletions(-)

Modified: trunk/boost/spirit/home/lex/argument.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/argument.hpp (original)
+++ trunk/boost/spirit/home/lex/argument.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -1,6 +1,7 @@
 // Copyright (c) 2001-2011 Hartmut Kaiser
 // Copyright (c) 2001-2011 Joel de Guzman
 // Copyright (c) 2010 Bryce Lelbach
+// Copyright (c) 2011 Thomas Heller
 //
 // 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)
@@ -12,18 +13,16 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
-#include <boost/spirit/home/phoenix/core/compose.hpp>
-#include <boost/spirit/home/phoenix/core/value.hpp>
-#include <boost/spirit/home/phoenix/core/as_actor.hpp>
-#include <boost/spirit/home/phoenix/operator/self.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/lex/argument_phoenix.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/mpl/at.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace lex
@@ -48,9 +47,11 @@
         template <typename Env>
         struct result
         {
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
             context_type;
 
@@ -92,9 +93,11 @@
         template <typename Env>
         void eval(Env const& env) const
         {
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
             context_type;
 
@@ -108,39 +111,15 @@
           : actor_(actor) {}
 
         // see explanation for this constructor at the end of this file
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
         state_setter(phoenix::actor<state_getter>, Actor const& actor)
           : actor_(actor) {}
+#endif
 
         Actor actor_;
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // The state_context is used as a noop Phoenix actor to create the
- // placeholder '_state' (see below). It is a noop actor because it is used
- // as a placeholder only, while it is being converted either to a
- // state_getter (if used as a rvalue) or to a state_setter (if used as a
- // lvalue). The conversion is achieved by specializing and overloading a
- // couple of the Phoenix templates from the Phoenix expression composition
- // engine (see the end of this file).
- struct state_context
- {
- typedef mpl::true_ no_nullary;
-
- template <typename Env>
- struct result
- {
- typedef unused_type type;
- };
-
- template <typename Env>
- unused_type
- eval(Env const& env) const
- {
- return unused;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
     // The value_getter is used to create the _val placeholder, which is a
     // Phoenix actor used to access the value of the current token.
     //
@@ -159,9 +138,11 @@
         template <typename Env>
         struct result
         {
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
             context_type;
 
@@ -209,40 +190,16 @@
         value_setter(Actor const& actor)
           : actor_(actor) {}
 
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
         // see explanation for this constructor at the end of this file
         value_setter(phoenix::actor<value_getter>, Actor const& actor)
           : actor_(actor) {}
+#endif
 
         Actor actor_;
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // The value_context is used as a noop Phoenix actor to create the
- // placeholder '_val' (see below). It is a noop actor because it is used
- // as a placeholder only, while it is being converted either to a
- // value_getter (if used as a rvalue) or to a value_setter (if used as a
- // lvalue). The conversion is achieved by specializing and overloading a
- // couple of the Phoenix templates from the Phoenix expression composition
- // engine (see the end of this file).
- struct value_context
- {
- typedef mpl::true_ no_nullary;
-
- template <typename Env>
- struct result
- {
- typedef unused_type type;
- };
-
- template <typename Env>
- unused_type
- eval(Env const& env) const
- {
- return unused;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
     // The eoi_getter is used to create the _eoi placeholder, which is a
     // Phoenix actor used to access the end of input iterator pointing to the
     // end of the underlying input sequence.
@@ -263,9 +220,11 @@
         template <typename Env>
         struct result
         {
- typedef typename
- remove_const<
- typename mpl::at_c<typename Env::args_type, 4>::type
+ typedef
+ typename remove_reference<
+ typename remove_const<
+ typename mpl::at_c<typename Env::args_type, 4>::type
+ >::type
>::type
             context_type;
 
@@ -283,33 +242,47 @@
     ///////////////////////////////////////////////////////////////////////////
     // '_start' and '_end' may be used to access the start and the end of
     // the matched sequence of the current token
- phoenix::actor<phoenix::argument<0> > const _start = phoenix::argument<0>();
- phoenix::actor<phoenix::argument<1> > const _end = phoenix::argument<1>();
+ typedef phoenix::arg_names::_1_type _start_type;
+ typedef phoenix::arg_names::_2_type _end_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
+ _start_type const _start = _start_type();
+ _end_type const _end = _end_type();
+#endif
 
     // We are reusing the placeholder '_pass' to access and change the pass
     // status of the current match (see support/argument.hpp for its
     // definition).
+ // typedef phoenix::arg_names::_3_type _pass_type;
+ using boost::spirit::_pass_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
     using boost::spirit::_pass;
+#endif
 
     // '_tokenid' may be used to access and change the tokenid of the current
     // token
- phoenix::actor<phoenix::argument<3> > const _tokenid = phoenix::argument<3>();
+ typedef phoenix::arg_names::_4_type _tokenid_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
+ _tokenid_type const _tokenid = _tokenid_type();
+#endif
 
+ typedef phoenix::actor<value_context> _val_type;
+ typedef phoenix::actor<state_context> _state_type;
+ typedef phoenix::actor<eoi_getter> _eoi_type;
+#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
     // '_val' may be used to access and change the token value of the current
     // token
- phoenix::actor<value_context> const _val = value_context();
-
+ _val_type const _val = _val_type();
     // _state may be used to access and change the name of the current lexer
     // state
- phoenix::actor<state_context> const _state = state_context();
-
+ _state_type const _state = _state_type();
     // '_eoi' may be used to access the end of input iterator of the input
     // stream used by the lexer to match tokens from
- phoenix::actor<eoi_getter> const _eoi = eoi_getter();
-
+ _eoi_type const _eoi = _eoi_type();
+#endif
 }}}
 
 ///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 namespace boost { namespace phoenix
 {
     ///////////////////////////////////////////////////////////////////////////
@@ -382,6 +355,7 @@
         typedef spirit::lex::value_setter<typename as_actor<RHS>::type> type;
     };
 }}
+#endif
 
 #undef SPIRIT_DECLARE_ARG
 #endif

Added: trunk/boost/spirit/home/lex/argument_phoenix.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/argument_phoenix.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -0,0 +1,220 @@
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2011 Thomas Heller
+//
+// 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(BOOST_SPIRIT_LEX_ARGUMENT_PHEONIX_MARCH_25_2011_1841PM)
+#define BOOST_SPIRIT_LEX_ARGUMENT_PHEONIX_MARCH_25_2011_1841PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/include/phoenix_core.hpp>
+
+namespace boost { namespace spirit { namespace lex
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // The value_context is used as a noop Phoenix actor to create the
+ // placeholder '_val' (see below). It is a noop actor because it is used
+ // as a placeholder only, while it is being converted either to a
+ // value_getter (if used as a rvalue) or to a value_setter (if used as a
+ // lvalue). The conversion is achieved by specializing and overloading a
+ // couple of the Phoenix templates from the Phoenix expression composition
+ // engine (see the end of this file).
+ struct value_context
+ {
+ typedef mpl::true_ no_nullary;
+
+ template <typename Env>
+ struct result
+ {
+ typedef unused_type type;
+ };
+
+ template <typename Env>
+ unused_type
+ eval(Env const& env) const
+ {
+ return unused;
+ }
+ };
+
+ // forward declarations
+ struct value_getter;
+ template <typename> struct value_setter;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // The state_context is used as a noop Phoenix actor to create the
+ // placeholder '_state' (see below). It is a noop actor because it is used
+ // as a placeholder only, while it is being converted either to a
+ // state_getter (if used as a rvalue) or to a state_setter (if used as a
+ // lvalue). The conversion is achieved by specializing and overloading a
+ // couple of the Phoenix templates from the Phoenix expression composition
+ // engine (see the end of this file).
+ struct state_context
+ {
+ typedef mpl::true_ no_nullary;
+
+ template <typename Env>
+ struct result
+ {
+ typedef unused_type type;
+ };
+
+ template <typename Env>
+ unused_type
+ eval(Env const& env) const
+ {
+ return unused;
+ }
+ };
+
+ // forward declarations
+ struct state_getter;
+ template <typename> struct state_setter;
+ struct eoi_getter;
+}}}
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template<>
+ , boost::spirit::lex::value_context
+ , mpl::false_
+ , v2_eval(
+ proto::make<boost::spirit::lex::value_getter()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template<>
+ , boost::spirit::lex::state_context
+ , mpl::false_
+ , v2_eval(
+ proto::make<boost::spirit::lex::state_getter()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template<>
+ , boost::spirit::lex::eoi_getter
+ , mpl::false_
+ , v2_eval(
+ proto::make<boost::spirit::lex::eoi_getter()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+///////////////////////////////////////////////////////////////////////////////
+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
+
+BOOST_PHOENIX_DEFINE_EXPRESSION(
+ (boost)(spirit)(lex)(value_setter)
+ , (boost::phoenix::meta_grammar)
+)
+
+BOOST_PHOENIX_DEFINE_EXPRESSION(
+ (boost)(spirit)(lex)(state_setter)
+ , (boost::phoenix::meta_grammar)
+)
+
+namespace boost { namespace phoenix
+{
+ template <typename Dummy>
+ struct is_nullary::when<spirit::lex::rule::value_setter, Dummy>
+ : proto::make<mpl::false_()>
+ {};
+
+ template <typename Dummy>
+ struct default_actions::when<spirit::lex::rule::value_setter, Dummy>
+ : proto::call<
+ v2_eval(
+ proto::make<
+ spirit::lex::value_setter<proto::_child0>(
+ proto::_child0
+ )
+ >
+ , _env
+ )
+ >
+ {};
+
+ template <>
+ struct actor<spirit::lex::value_context>
+ : boost::phoenix::actor<proto::terminal<spirit::lex::value_context>::type>
+ {
+ typedef boost::phoenix::actor<
+ typename proto::terminal<spirit::lex::value_context>::type
+ > base_type;
+
+ actor(base_type const & base = base_type())
+ : base_type(base)
+ {}
+
+ template <typename Expr>
+ typename spirit::lex::expression::value_setter<
+ typename phoenix::as_actor<Expr>::type>::type const
+ operator=(Expr const & expr) const
+ {
+ return
+ spirit::lex::expression::value_setter<
+ typename phoenix::as_actor<Expr>::type
+ >::make(phoenix::as_actor<Expr>::convert(expr));
+ }
+ };
+
+ template <typename Dummy>
+ struct is_nullary::when<spirit::lex::rule::state_setter, Dummy>
+ : proto::make<mpl::false_()>
+ {};
+
+ template <typename Dummy>
+ struct default_actions::when<spirit::lex::rule::state_setter, Dummy>
+ : proto::call<
+ v2_eval(
+ proto::make<
+ spirit::lex::state_setter<proto::_child0>(
+ proto::_child0
+ )
+ >
+ , _env
+ )
+ >
+ {};
+
+ template <>
+ struct actor<spirit::lex::state_context>
+ : boost::phoenix::actor<proto::terminal<spirit::lex::state_context>::type>
+ {
+ typedef boost::phoenix::actor<
+ typename proto::terminal<spirit::lex::state_context>::type
+ > base_type;
+
+ actor(base_type const & base = base_type())
+ : base_type(base)
+ {}
+
+ template <typename Expr>
+ typename spirit::lex::expression::state_setter<
+ typename phoenix::as_actor<Expr>::type>::type const
+ operator=(Expr const & expr) const
+ {
+ return
+ spirit::lex::expression::state_setter<
+ typename phoenix::as_actor<Expr>::type
+ >::make(phoenix::as_actor<Expr>::convert(expr));
+ }
+ };
+}}
+
+#endif // BOOST_SPIRIT_USE_PHOENIX_V3
+
+#endif

Modified: trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -13,10 +13,10 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
-#include <boost/spirit/home/phoenix/bind.hpp>
-#include <boost/spirit/home/phoenix/scope.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_bind.hpp>
+#include <boost/spirit/include/phoenix_scope.hpp>
+
 #include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/lex/lexer/pass_flags.hpp>
 
@@ -40,9 +40,11 @@
             // wrap phoenix actor
             struct phoenix_action
             {
+ typedef void result_type;
+
                 template <typename F, typename T1, typename T2, typename T3
                   , typename T4, typename T5>
- struct result { typedef void type; };
+ struct result { typedef result_type type; };
 
                 template <typename Eval>
                 void operator()(phoenix::actor<Eval> const& f, Iterator& start

Modified: trunk/boost/spirit/home/lex/lexer/support_functions.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/support_functions.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/support_functions.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -10,14 +10,12 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
-#include <boost/spirit/home/phoenix/core/compose.hpp>
-#include <boost/spirit/home/phoenix/core/value.hpp>
-#include <boost/spirit/home/phoenix/core/as_actor.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
 #include <boost/spirit/home/lex/lexer/pass_flags.hpp>
 
+#include <boost/spirit/home/lex/lexer/support_functions_expression.hpp>
+
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace lex
 {
@@ -72,13 +70,14 @@
     };
 
     // The function lex::less() is used to create a Phoenix actor allowing to
- // implement functionality similar to flex' function yyless().
+ // implement functionality similar to flex' function yyless().
     template <typename T>
- inline phoenix::actor<less_type<typename phoenix::as_actor<T>::type> >
+ inline typename expression::less<
+ typename phoenix::as_actor<T>::type
+ >::type const
     less(T const& v)
     {
- typedef typename phoenix::as_actor<T>::type actor_type;
- return less_type<actor_type>(phoenix::as_actor<T>::convert(v));
+ return expression::less<T>::make(phoenix::as_actor<T>::convert(v));
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -115,10 +114,10 @@
 
     // The function lex::more() is used to create a Phoenix actor allowing to
     // implement functionality similar to flex' function yymore().
- inline phoenix::actor<more_type>
- more()
+ //inline expression::more<mpl::void_>::type const
+ inline phoenix::actor<more_type> more()
     {
- return more_type();
+ return phoenix::actor<more_type>();
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -156,27 +155,27 @@
 
     // The function lex::lookahead() is used to create a Phoenix actor
     // allowing to implement functionality similar to flex' lookahead operator
- // a/b.
+ // a/b.
     template <typename T>
- inline phoenix::actor<
- lookahead_type<
- typename phoenix::as_actor<T>::type
- , typename phoenix::as_actor<std::size_t>::type> >
+ inline typename expression::lookahead<
+ typename phoenix::as_actor<T>::type
+ , typename phoenix::as_actor<std::size_t>::type
+ >::type const
     lookahead(T const& id)
     {
         typedef typename phoenix::as_actor<T>::type id_actor_type;
         typedef typename phoenix::as_actor<std::size_t>::type state_actor_type;
 
- return lookahead_type<id_actor_type, state_actor_type>(
+ return expression::lookahead<id_actor_type, state_actor_type>::make(
             phoenix::as_actor<T>::convert(id),
             phoenix::as_actor<std::size_t>::convert(std::size_t(~0)));
     }
 
     template <typename Attribute, typename Char, typename Idtype>
- inline phoenix::actor<
- lookahead_type<
- typename phoenix::as_actor<Idtype>::type
- , typename phoenix::as_actor<std::size_t>::type> >
+ inline typename expression::lookahead<
+ typename phoenix::as_actor<Idtype>::type
+ , typename phoenix::as_actor<std::size_t>::type
+ >::type const
     lookahead(token_def<Attribute, Char, Idtype> const& tok)
     {
         typedef typename phoenix::as_actor<Idtype>::type id_actor_type;
@@ -189,8 +188,8 @@
         // lexer.
         BOOST_ASSERT(std::size_t(~0) != state &&
             "token_def instance not associated with lexer yet");
-
- return lookahead_type<id_actor_type, state_actor_type>(
+
+ return expression::lookahead<id_actor_type, state_actor_type>::make(
             phoenix::as_actor<Idtype>::convert(tok.id()),
             phoenix::as_actor<std::size_t>::convert(state));
     }

Added: trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -0,0 +1,118 @@
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2011 Thomas Heller
+//
+// 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(SPIRIT_LEX_SUPPORT_FUNCTIONS_EXPRESSION_MAR_22_2011_0711PM)
+#define SPIRIT_LEX_SUPPORT_FUNCTIONS_EXPRESSION_MAR_22_2011_0711PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/include/phoenix_core.hpp>
+
+namespace boost { namespace spirit { namespace lex
+{
+ template <typename> struct less_type;
+ struct more_type;
+ template <typename, typename> struct lookahead_type;
+}}}
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <>
+ , boost::spirit::lex::more_type
+ , mpl::false_
+ , v2_eval(
+ proto::make<boost::spirit::lex::more_type()>
+ , proto::call<functional::env(proto::_state)>
+ )
+)
+
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+
+namespace boost { namespace spirit { namespace lex
+{
+ namespace expression
+ {
+ template <typename Eval>
+ struct less
+ {
+ typedef phoenix::actor<lex::less_type<Eval> > type;
+
+ static type make(Eval const & eval)
+ {
+ return lex::less_type<Eval>(eval);
+ }
+ };
+
+ template <typename IdType, typename State>
+ struct lookahead
+ {
+ typedef phoenix::actor<lex::lookahead_type<IdType, State> > type;
+
+ static type make(IdType const & id_type, State const & state)
+ {
+ return lex::lookahead_type<IdType, State>(id_type, state);
+ }
+ };
+ }
+}}}
+
+#else // BOOST_SPIRIT_USE_PHOENIX_V3
+
+BOOST_PHOENIX_DEFINE_EXPRESSION(
+ (boost)(spirit)(lex)(less)
+ , (boost::phoenix::meta_grammar)
+)
+
+BOOST_PHOENIX_DEFINE_EXPRESSION(
+ (boost)(spirit)(lex)(lookahead)
+ , (boost::phoenix::meta_grammar)
+ (boost::phoenix::meta_grammar)
+)
+
+namespace boost { namespace phoenix
+{
+ template <typename Dummy>
+ struct is_nullary::when<spirit::lex::rule::less, Dummy>
+ : proto::make<mpl::false_()>
+ {};
+
+ template <typename Dummy>
+ struct default_actions::when<spirit::lex::rule::less, Dummy>
+ : proto::call<
+ v2_eval(
+ spirit::lex::less_type<proto::_child0>(proto::_child0)
+ , _env
+ )
+ >
+ {};
+
+ template <typename Dummy>
+ struct is_nullary::when<spirit::lex::rule::lookahead, Dummy>
+ : proto::make<mpl::false_()>
+ {};
+
+ template <typename Dummy>
+ struct default_actions::when<spirit::lex::rule::lookahead, Dummy>
+ : proto::call<
+ v2_eval(
+ spirit::lex::lookahead_type<
+ proto::_child0
+ , proto::_child1
+ >(
+ proto::_child0
+ , proto::_child1
+ )
+ , _env
+ )
+ >
+ {};
+}}
+
+#endif // BOOST_SPIRIT_USE_PHOENIX_V3
+
+#endif

Modified: trunk/boost/spirit/home/phoenix/core/argument.hpp
==============================================================================
--- trunk/boost/spirit/home/phoenix/core/argument.hpp (original)
+++ trunk/boost/spirit/home/phoenix/core/argument.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -21,10 +21,14 @@
 #include <boost/mpl/size.hpp>
 #include <boost/type_traits/add_reference.hpp>
 
-#define PHOENIX_DECLARE_ARG(z, n, data) \
- actor<argument<n> > const \
- BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument<n>(); \
- actor<argument<n> > const \
+#define PHOENIX_DECLARE_ARG(z, n, data) \
+ typedef actor<argument<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); \
+ actor<argument<n> > const \
+ BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument<n>(); \
+ typedef actor<argument<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
+ actor<argument<n> > const \
         BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();
 
 namespace boost { namespace phoenix
@@ -69,13 +73,19 @@
     namespace arg_names
     {
     // Phoenix style names
+ typedef actor<argument<0> > arg1_type;
         actor<argument<0> > const arg1 = argument<0>();
+ typedef actor<argument<1> > arg2_type;
         actor<argument<1> > const arg2 = argument<1>();
+ typedef actor<argument<2> > arg3_type;
         actor<argument<2> > const arg3 = argument<2>();
 
     // BLL style names
+ typedef actor<argument<0> > _1_type;
         actor<argument<0> > const _1 = argument<0>();
+ typedef actor<argument<1> > _2_type;
         actor<argument<1> > const _2 = argument<1>();
+ typedef actor<argument<2> > _3_type;
         actor<argument<2> > const _3 = argument<2>();
 
     // Bring in the rest or the Phoenix style arguments (arg4 .. argN+1)

Modified: trunk/boost/spirit/home/support/action_dispatch.hpp
==============================================================================
--- trunk/boost/spirit/home/support/action_dispatch.hpp (original)
+++ trunk/boost/spirit/home/support/action_dispatch.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -13,7 +13,16 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/phoenix/core/actor.hpp>
+#include<boost/config.hpp>
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_LAMBDAS) && \
+ !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_NO_DECLTYPE)
+#include <utility>
+#include <type_traits>
+#endif
+
+
+#include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/home/support/attributes.hpp>
 
 namespace boost { namespace spirit { namespace traits
@@ -21,6 +30,130 @@
     template <typename Component>
     struct action_dispatch
     {
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_LAMBDAS) && \
+ !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_NO_DECLTYPE)
+ // omit function parameters without specializing for each possible
+ // type of callable entity
+ // many thanks to Eelis/##iso-c++ for this contribution
+
+ private:
+ // this will be used to pass around POD types which are safe
+ // to go through the ellipsis operator (if ever used)
+ template <typename>
+ struct fwd_tag {};
+
+ // the first parameter is a placeholder to obtain SFINAE when
+ // doing overload resolution, the second one is the actual
+ // forwarder, where we can apply our implementation
+ template <typename, typename T>
+ struct fwd_storage { typedef T type; };
+
+ // gcc should accept fake<T>() but it prints a sorry, needs
+ // a check once the bug is sorted out, use a FAKE_CALL macro for now
+ template <typename T>
+ T fake_call();
+
+#define BOOST_SPIRIT_FAKE_CALL(T) (*(T*)0)
+
+ // the forwarders, here we could tweak the implementation of
+ // how parameters are passed to the functions, if needed
+ struct fwd_none
+ {
+ template<typename F, typename... Rest>
+ auto operator()(F && f, Rest&&...) -> decltype(f())
+ {
+ return f();
+ }
+ };
+
+ struct fwd_attrib
+ {
+ template<typename F, typename A, typename... Rest>
+ auto operator()(F && f, A && a, Rest&&...) -> decltype(f(a))
+ {
+ return f(a);
+ }
+ };
+
+ struct fwd_attrib_context
+ {
+ template<typename F, typename A, typename B, typename... Rest>
+ auto operator()(F && f, A && a, B && b, Rest&&...)
+ -> decltype(f(a, b))
+ {
+ return f(a, b);
+ }
+ };
+
+ struct fwd_attrib_context_pass
+ {
+ template<typename F, typename A, typename B, typename C
+ , typename... Rest>
+ auto operator()(F && f, A && a, B && b, C && c, Rest&&...)
+ -> decltype(f(a, b, c))
+ {
+ return f(a, b, c);
+ }
+ };
+
+ // SFINAE for our calling syntax, the forwarders are stored based
+ // on what function call gives a proper result
+ // this code can probably be more generic once implementations are
+ // steady
+ template <typename F>
+ static auto do_call(F && f, ...)
+ -> typename fwd_storage<decltype(f()), fwd_none>::type
+ {
+ return {};
+ }
+
+ template <typename F, typename A>
+ static auto do_call(F && f, fwd_tag<A>, ...)
+ -> typename fwd_storage<decltype(f(BOOST_SPIRIT_FAKE_CALL(A)))
+ , fwd_attrib>::type
+ {
+ return {};
+ }
+
+ template <typename F, typename A, typename B>
+ static auto do_call(F && f, fwd_tag<A>, fwd_tag<B>, ...)
+ -> typename fwd_storage<
+ decltype(f(BOOST_SPIRIT_FAKE_CALL(A), BOOST_SPIRIT_FAKE_CALL(B)))
+ , fwd_attrib_context>::type
+ {
+ return {};
+ }
+
+ template <typename F, typename A, typename B, typename C>
+ static auto do_call(F && f, fwd_tag<A>, fwd_tag<B>, fwd_tag<C>, ...)
+ -> typename fwd_storage<
+ decltype(f(BOOST_SPIRIT_FAKE_CALL(A), BOOST_SPIRIT_FAKE_CALL(B)
+ , BOOST_SPIRIT_FAKE_CALL(C)))
+ , fwd_attrib_context_pass>::type
+ {
+ return {};
+ }
+
+ // this function calls the forwarder and is responsible for
+ // stripping the tail of the parameters
+ template <typename F, typename... A>
+ static void caller(F && f, A && ... a)
+ {
+ do_call(f, fwd_tag<typename std::remove_reference<A>::type>()...)
+ (std::forward<F>(f), std::forward<A>(a)...);
+ }
+
+#undef BOOST_SPIRIT_FAKE_CALL
+
+ public:
+ template <typename F, typename Attribute, typename Context>
+ bool operator()(F const& f, Attribute& attr, Context& context)
+ {
+ bool pass = true;
+ caller(f, attr, context, pass);
+ return pass;
+ }
+#else
         // general handler for everything not explicitly specialized below
         template <typename F, typename Attribute, typename Context>
         bool operator()(F const& f, Attribute& attr, Context& context)
@@ -29,6 +162,7 @@
             f(attr, context, pass);
             return pass;
         }
+#endif
 
         // handler for phoenix actors
 

Modified: trunk/boost/spirit/home/support/argument.hpp
==============================================================================
--- trunk/boost/spirit/home/support/argument.hpp (original)
+++ trunk/boost/spirit/home/support/argument.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -1,5 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
 
     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)
@@ -13,47 +15,81 @@
 
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/preprocessor/arithmetic/inc.hpp>
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/home/support/assert_msg.hpp>
+#include <boost/spirit/home/support/limits.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/size.hpp>
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/at.hpp>
 
-#if !defined(SPIRIT_ARGUMENTS_LIMIT)
-# define SPIRIT_ARGUMENTS_LIMIT PHOENIX_LIMIT
-#endif
-
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
-#define SPIRIT_DECLARE_ARG(z, n, data) \
- typedef phoenix::actor<argument<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
- phoenix::actor<argument<n> > const \
- BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();
+#define SPIRIT_DECLARE_ARG(z, n, data) \
+ typedef phoenix::actor<argument<n> > const \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
+ phoenix::actor<argument<n> > const \
+ BOOST_PP_CAT(_, BOOST_PP_INC(n)) = \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type)(); \
         /***/
 
-#define SPIRIT_USING_ARGUMENT(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
- using spirit::BOOST_PP_CAT(_, n);
+#define SPIRIT_USING_ARGUMENT(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
+ using spirit::BOOST_PP_CAT(_, n); \
         /***/
 
 #else
 
-#define SPIRIT_DECLARE_ARG(z, n, data) \
- typedef phoenix::actor<argument<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type);
+#define SPIRIT_DECLARE_ARG(z, n, data) \
+ typedef phoenix::actor<argument<n> > const \
+ BOOST_PP_CAT(BOOST_PP_CAT(_, BOOST_PP_INC(n)), _type); \
         /***/
 
-#define SPIRIT_USING_ARGUMENT(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
+#define SPIRIT_USING_ARGUMENT(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_, n), _type); \
         /***/
 
 #endif
 
 namespace boost { namespace spirit
 {
+ template <int N>
+ struct argument;
+
+ template <typename Dummy>
+ struct attribute_context;
+}}
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <int N>
+ , boost::spirit::argument<N>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::argument<N>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <typename Dummy>
+ , boost::spirit::attribute_context<Dummy>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::attribute_context<Dummy>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+namespace boost { namespace spirit
+{
     namespace result_of
     {
         template <typename Sequence, int N>
@@ -91,6 +127,7 @@
         return result_of::get_arg<T, N>::call(val);
     }
 
+ template <typename>
     struct attribute_context
     {
         typedef mpl::true_ no_nullary;
@@ -138,9 +175,9 @@
     };
 
     // _0 refers to the whole attribute as generated by the lhs parser
- typedef phoenix::actor<attribute_context> const _0_type;
+ typedef phoenix::actor<attribute_context<void> > const _0_type;
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _0_type _0 = attribute_context();
+ _0_type _0 = _0_type();
 #endif
 
     // _1, _2, ... refer to the attributes of the single components the lhs
@@ -150,15 +187,15 @@
     typedef phoenix::actor<argument<2> > const _3_type;
 
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _1_type _1 = argument<0>();
- _2_type _2 = argument<1>();
- _3_type _3 = argument<2>();
+ _1_type _1 = _1_type();
+ _2_type _2 = _2_type();
+ _3_type _3 = _3_type();
 #endif
 
     // '_pass' may be used to make a match fail in retrospective
- typedef phoenix::actor<phoenix::argument<2> > const _pass_type;
+ typedef phoenix::arg_names::_3_type const _pass_type;
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
- _pass_type _pass = phoenix::argument<2>();
+ _pass_type _pass = _pass_type();
 #endif
 
     // Bring in the rest of the arguments and attributes (_4 .. _N+1), using PP

Added: trunk/boost/spirit/home/support/argument_expression.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/argument_expression.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -0,0 +1,122 @@
+/*=============================================================================
+ Copyright (c) 2011 Thomas Heller
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
+
+ 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(BOOST_SPIRIT_ARGUMENT_MARCH_22_2011_0939PM)
+#define BOOST_SPIRIT_ARGUMENT_MARCH_22_2011_0939PM
+
+#include <boost/spirit/include/phoenix_core.hpp>
+
+namespace boost { namespace spirit
+{
+ template <int N>
+ struct argument;
+
+ template <typename Dummy>
+ struct attribute_context;
+
+ namespace expression
+ {
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+ template <int N>
+ struct argument
+ {
+ typedef phoenix::actor<spirit::argument<N> > type;
+
+ static type make()
+ {
+ return spirit::argument<N>();
+ }
+ };
+
+ template <typename Dummy>
+ struct attribute_context
+ {
+ typedef phoenix::actor<spirit::attribute_context<Dummy> > type;
+
+ static type make()
+ {
+ return spirit::attribute_context<Dummy>();
+ }
+ };
+#else
+ template <int N>
+ struct argument
+ : phoenix::expression::terminal<spirit::argument<N> >
+ {
+ typedef typename phoenix::expression::terminal<
+ spirit::argument<N>
+ >::type type;
+
+ static type make()
+ {
+ type const e = {{{}}};
+ return e;
+ }
+ };
+
+ template <typename Dummy>
+ struct attribute_context
+ : phoenix::expression::terminal<spirit::attribute_context<Dummy> >
+ {
+ typedef typename phoenix::expression::terminal<
+ spirit::attribute_context<Dummy>
+ >::type type;
+
+ static type make()
+ {
+ type const e = {{{}}};
+ return e;
+ }
+ };
+#endif
+ }
+}}
+
+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
+namespace boost { namespace phoenix
+{
+ namespace result_of
+ {
+ template <typename Dummy>
+ struct is_nullary<custom_terminal<spirit::attribute_context<Dummy> > >
+ : mpl::false_
+ {};
+
+ template <int N>
+ struct is_nullary<custom_terminal<spirit::argument<N> > >
+ : mpl::false_
+ {};
+ }
+
+ template <typename Dummy>
+ struct is_custom_terminal<spirit::attribute_context<Dummy> >
+ : mpl::true_
+ {};
+
+ template <int N>
+ struct is_custom_terminal<spirit::argument<N> >
+ : mpl::true_
+ {};
+
+ template <typename Dummy>
+ struct custom_terminal<spirit::attribute_context<Dummy> >
+ : proto::call<
+ v2_eval(spirit::attribute_context<Dummy>(), _env)
+ >
+ {};
+
+ template <int N>
+ struct custom_terminal<spirit::argument<N> >
+ : proto::call<
+ v2_eval(spirit::argument<N>(), _env(proto::_, proto::_state, int()))
+ >
+ {};
+}}
+#endif // BOOST_SPIRIT_USE_PHOENIX_V3
+
+#endif

Modified: trunk/boost/spirit/home/support/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_class.hpp (original)
+++ trunk/boost/spirit/home/support/char_class.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -269,6 +269,7 @@
     struct char_code
         : char_code_base<CharClass>, char_encoding_base<CharEncoding>
     {
+ typedef void is_spirit_tag;
         typedef CharEncoding char_encoding; // e.g. ascii
         typedef CharClass char_class; // e.g. tag::alnum
     };

Modified: trunk/boost/spirit/home/support/context.hpp
==============================================================================
--- trunk/boost/spirit/home/support/context.hpp (original)
+++ trunk/boost/spirit/home/support/context.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -1,5 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
 
     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)
@@ -12,11 +14,11 @@
 #endif
 
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/home/support/nonterminal/expand_arg.hpp>
 #include <boost/spirit/home/support/assert_msg.hpp>
 #include <boost/spirit/home/support/argument.hpp>
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-#include <boost/spirit/home/phoenix/core/argument.hpp>
+#include <boost/spirit/home/support/limits.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/size.hpp>
 #include <boost/fusion/include/as_list.hpp>
@@ -24,37 +26,71 @@
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/at.hpp>
 
-#if !defined(SPIRIT_ATTRIBUTES_LIMIT)
-# define SPIRIT_ATTRIBUTES_LIMIT PHOENIX_LIMIT
-#endif
-
+///////////////////////////////////////////////////////////////////////////////
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
-#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
- typedef phoenix::actor<attribute<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
- phoenix::actor<attribute<n> > const \
- BOOST_PP_CAT(_r, n) = attribute<n>();
-
-#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
- using spirit::BOOST_PP_CAT(_r, n); \
+#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
+ typedef phoenix::actor<attribute<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+ phoenix::actor<attribute<n> > const \
+ BOOST_PP_CAT(_r, n) = BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type)();
+ /***/
+#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+ using spirit::BOOST_PP_CAT(_r, n); \
     /***/
 
 #else
 
-#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
- typedef phoenix::actor<attribute<n> > const \
- BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
-
-#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
- using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data) \
+ typedef phoenix::actor<attribute<n> > \
+ BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
+ /***/
+#define SPIRIT_USING_ATTRIBUTE(z, n, data) \
+ using spirit::BOOST_PP_CAT(BOOST_PP_CAT(_r, n), _type); \
     /***/
 
 #endif
 
 namespace boost { namespace spirit
 {
+ template <int>
+ struct attribute;
+
+ template <int>
+ struct local_variable;
+}}
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <int N>
+ , boost::spirit::attribute<N>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::attribute<N>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(
+ template <int N>
+ , boost::spirit::local_variable<N>
+ , mpl::false_ // is not nullary
+ , v2_eval(
+ proto::make<
+ boost::spirit::local_variable<N>()
+ >
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
+)
+
+namespace boost { namespace spirit
+{
     template <typename Attributes, typename Locals>
     struct context
     {
@@ -100,6 +136,11 @@
     };
 
     template <typename Context>
+ struct attributes_of<Context &>
+ : attributes_of<Context>
+ {};
+
+ template <typename Context>
     struct locals_of
     {
         typedef typename Context::locals_type type;
@@ -111,6 +152,12 @@
         typedef typename Context::locals_type const type;
     };
 
+ template <typename Context>
+ struct locals_of<Context &>
+ {
+ typedef typename Context::locals_type type;
+ };
+
     template <int N>
     struct attribute
     {
@@ -182,21 +229,19 @@
             return get_arg<N>((fusion::at_c<1>(env.args())).locals);
         }
     };
-
+
     typedef phoenix::actor<attribute<0> > const _val_type;
     typedef phoenix::actor<attribute<0> > const _r0_type;
     typedef phoenix::actor<attribute<1> > const _r1_type;
     typedef phoenix::actor<attribute<2> > const _r2_type;
 
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
-
     // _val refers to the 'return' value of a rule (same as _r0)
     // _r1, _r2, ... refer to the rule arguments
- _val_type _val = attribute<0>();
- _r0_type _r0 = attribute<0>();
- _r1_type _r1 = attribute<1>();
- _r2_type _r2 = attribute<2>();
-
+ _val_type _val = _val_type();
+ _r0_type _r0 = _r0_type();
+ _r1_type _r1 = _r1_type();
+ _r2_type _r2 = _r2_type();
 #endif
 
     // Bring in the rest of the attributes (_r4 .. _rN+1), using PP
@@ -215,20 +260,19 @@
     typedef phoenix::actor<local_variable<9> > const _j_type;
 
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
-
     // _a, _b, ... refer to the local variables of a rule
- _a_type _a = local_variable<0>();
- _b_type _b = local_variable<1>();
- _c_type _c = local_variable<2>();
- _d_type _d = local_variable<3>();
- _e_type _e = local_variable<4>();
- _f_type _f = local_variable<5>();
- _g_type _g = local_variable<6>();
- _h_type _h = local_variable<7>();
- _i_type _i = local_variable<8>();
- _j_type _j = local_variable<9>();
-
+ _a_type _a = _a_type();
+ _b_type _b = _b_type();
+ _c_type _c = _c_type();
+ _d_type _d = _d_type();
+ _e_type _e = _e_type();
+ _f_type _f = _f_type();
+ _g_type _g = _g_type();
+ _h_type _h = _h_type();
+ _i_type _i = _i_type();
+ _j_type _j = _j_type();
 #endif
+
     // You can bring these in with the using directive
     // without worrying about bringing in too much.
     namespace labels

Added: trunk/boost/spirit/home/support/limits.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/limits.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -0,0 +1,35 @@
+// Copyright (c) 2001-2011 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(BOOST_SPIRIT_SUPPORT_LIMITS_MAR_26_2011_0833PM)
+#define BOOST_SPIRIT_SUPPORT_LIMITS_MAR_26_2011_0833PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/include/phoenix_core.hpp>
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+
+#if !defined(SPIRIT_ARGUMENTS_LIMIT)
+# define SPIRIT_ARGUMENTS_LIMIT PHOENIX_LIMIT
+#endif
+#if !defined(SPIRIT_ATTRIBUTES_LIMIT)
+# define SPIRIT_ATTRIBUTES_LIMIT PHOENIX_LIMIT
+#endif
+
+#else
+
+#if !defined(SPIRIT_ARGUMENTS_LIMIT)
+# define SPIRIT_ARGUMENTS_LIMIT BOOST_PHOENIX_LIMIT
+#endif
+#if !defined(SPIRIT_ATTRIBUTES_LIMIT)
+# define SPIRIT_ATTRIBUTES_LIMIT BOOST_PHOENIX_LIMIT
+#endif
+
+#endif
+
+#endif

Modified: trunk/boost/spirit/home/support/make_component.hpp
==============================================================================
--- trunk/boost/spirit/home/support/make_component.hpp (original)
+++ trunk/boost/spirit/home/support/make_component.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -12,6 +12,7 @@
 #pragma once
 #endif
 
+#include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/proto/proto.hpp>
 #include <boost/spirit/home/support/detail/make_cons.hpp>
 #include <boost/spirit/home/support/modify.hpp>
@@ -321,11 +322,25 @@
                 )>::type
             lhs_component;
 
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
             typedef typename
                 proto::result_of::value<
                     typename proto::result_of::child_c<Expr, 1>::type
>::type
             rhs_component;
+#else
+ typedef
+ typename mpl::eval_if_c<
+ phoenix::is_actor<
+ typename proto::result_of::child_c<Expr, 1>::type
+ >::type::value
+ , proto::result_of::child_c<Expr, 1>
+ , proto::result_of::value<
+ typename proto::result_of::child_c<Expr, 1>::type
+ >
+ >::type
+ rhs_component;
+#endif
 
             typedef typename
                 result_of::make_cons<
@@ -341,10 +356,46 @@
                     result<make_component_(elements_type, Data)>::type
             result_type;
 
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+ result_type operator()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ elements_type elements =
+ detail::make_cons(
+ Grammar()(
+ proto::child_c<0>(expr), state, data) // LHS
+ , detail::make_cons(
+ proto::value(proto::child_c<1>(expr))) // RHS
+ );
+
+ return make_component_()(elements, data);
+ }
+#else
+ result_type operator()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return
+ (*this)(
+ expr
+ , state
+ , data
+ , typename phoenix::is_actor<
+ typename proto::result_of::child_c<Expr, 1>::type
+ >::type()
+ );
+ }
+
             result_type operator()(
                 typename impl::expr_param expr
               , typename impl::state_param state
               , typename impl::data_param data
+ , mpl::false_
             ) const
             {
                 elements_type elements =
@@ -357,6 +408,25 @@
 
                 return make_component_()(elements, data);
             }
+
+ result_type operator()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ , mpl::true_
+ ) const
+ {
+ elements_type elements =
+ detail::make_cons(
+ Grammar()(
+ proto::child_c<0>(expr), state, data) // LHS
+ , detail::make_cons(
+ proto::child_c<1>(expr)) // RHS
+ );
+
+ return make_component_()(elements, data);
+ }
+#endif
         };
     };
 }}}

Modified: trunk/boost/spirit/home/support/terminal.hpp
==============================================================================
--- trunk/boost/spirit/home/support/terminal.hpp (original)
+++ trunk/boost/spirit/home/support/terminal.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -1,5 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
 
     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)
@@ -11,15 +13,17 @@
 #pragma once
 #endif
 
-#include <boost/proto/proto.hpp>
-#include <boost/fusion/include/void.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_function.hpp>
+#include <boost/proto/proto.hpp>
+#include <boost/fusion/include/void.hpp>
 #include <boost/spirit/home/support/meta_compiler.hpp>
 #include <boost/spirit/home/support/detail/make_vector.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/preprocessor/tuple/elem.hpp>
 
+#include <boost/spirit/home/support/terminal_expression.hpp>
+
 namespace boost { namespace spirit
 {
     template <typename Terminal, typename Args>
@@ -84,11 +88,7 @@
             proto::terminal<
                 lazy_terminal<
                     typename F::terminal_type
- , phoenix::actor<
- typename phoenix::as_composite<
- phoenix::detail::function_eval<1>, F, A0
- >::type
- >
+ , typename phoenix::expression::function<F, A0>::type
                   , 1 // arity
>
>::type
@@ -100,7 +100,7 @@
         {
             typedef typename result_type::proto_child0 child_type;
             return result_type::make(child_type(
- phoenix::compose<phoenix::detail::function_eval<1> >(f, _0)
+ phoenix::expression::function<F, A0>::make(f, _0)
               , f.proto_base().child0
             ));
         }
@@ -113,11 +113,7 @@
             proto::terminal<
                lazy_terminal<
                     typename F::terminal_type
- , phoenix::actor<
- typename phoenix::as_composite<
- phoenix::detail::function_eval<2>, F, A0, A1
- >::type
- >
+ , typename phoenix::expression::function<F, A0, A1>::type
                   , 2 // arity
>
>::type
@@ -129,7 +125,7 @@
         {
             typedef typename result_type::proto_child0 child_type;
             return result_type::make(child_type(
- phoenix::compose<phoenix::detail::function_eval<2> >(f, _0, _1)
+ phoenix::expression::function<F, A0, A1>::make(f, _0, _1)
               , f.proto_base().child0
             ));
         }
@@ -142,11 +138,7 @@
             proto::terminal<
                lazy_terminal<
                     typename F::terminal_type
- , phoenix::actor<
- typename phoenix::as_composite<
- phoenix::detail::function_eval<3>, F, A0, A1, A2
- >::type
- >
+ , typename phoenix::expression::function<F, A0, A1, A2>::type
                   , 3 // arity
>
>::type
@@ -158,7 +150,7 @@
         {
             typedef typename result_type::proto_child0 child_type;
             return result_type::make(child_type(
- phoenix::compose<phoenix::detail::function_eval<3> >(f, _0, _1, _2)
+ phoenix::expression::function<F, A0, A1, A2>::make(f, _0, _1, _2)
               , f.proto_base().child0
             ));
         }
@@ -167,14 +159,19 @@
     namespace detail
     {
         // Helper struct for SFINAE purposes
- template <bool C>
- struct bool_;
+ template <bool C> struct bool_;
+
         template <>
         struct bool_<true> : mpl::bool_<true>
- { typedef bool_<true>* is_true; };
+ {
+ typedef bool_<true>* is_true;
+ };
+
         template <>
         struct bool_<false> : mpl::bool_<false>
- { typedef bool_<false>* is_false; };
+ {
+ typedef bool_<false>* is_false;
+ };
 
         // Metafunction to detect if at least one arg is a Phoenix actor
         template <
@@ -184,10 +181,10 @@
>
         struct contains_actor
             : bool_<
- phoenix::is_actor<A0>::value
- || phoenix::is_actor<A1>::value
- || phoenix::is_actor<A2>::value
- >
+ phoenix::is_actor<A0>::value
+ || phoenix::is_actor<A1>::value
+ || phoenix::is_actor<A2>::value
+ >
         {};
 
         // to_lazy_arg: convert a terminal arg type to the type make_lazy needs
@@ -200,6 +197,11 @@
         struct to_lazy_arg<const A>
           : to_lazy_arg<A>
         {};
+
+ template <typename A>
+ struct to_lazy_arg<A &>
+ : to_lazy_arg<A>
+ {};
 
         template <>
         struct to_lazy_arg<unused_type>
@@ -221,6 +223,11 @@
           : to_nonlazy_arg<A>
         {};
 
+ template <typename A>
+ struct to_nonlazy_arg<A &>
+ : to_nonlazy_arg<A>
+ {};
+
         template <>
         struct to_nonlazy_arg<unused_type>
         {
@@ -247,7 +254,8 @@
         terminal() {}
 
         terminal(Terminal const& t)
- : base_type(proto::terminal<Terminal>::type::make(t)) {}
+ : base_type(proto::terminal<Terminal>::type::make(t))
+ {}
 
         template <
             bool Lazy
@@ -307,6 +315,40 @@
             type;
         };
 
+ template <typename This, typename A0>
+ struct result<This(A0)>
+ {
+ typedef typename
+ result_helper<
+ detail::contains_actor<A0, unused_type, unused_type>::value
+ , A0, unused_type, unused_type
+ >::type
+ type;
+ };
+
+ template <typename This, typename A0, typename A1>
+ struct result<This(A0, A1)>
+ {
+ typedef typename
+ result_helper<
+ detail::contains_actor<A0, A1, unused_type>::value
+ , A0, A1, unused_type
+ >::type
+ type;
+ };
+
+
+ template <typename This, typename A0, typename A1, typename A2>
+ struct result<This(A0, A1, A2)>
+ {
+ typedef typename
+ result_helper<
+ detail::contains_actor<A0, A1, A2>::value
+ , A0, A1, A2
+ >::type
+ type;
+ };
+
         // Note: in the following overloads, SFINAE cannot
         // be done on return type because of gcc bug #24915:
         // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24915
@@ -360,7 +402,6 @@
 
         // Lazy overloads. Enabled when at
         // least one arg is a Phoenix actor.
-
         template <typename A0>
         typename result<A0>::type
         operator()(A0 const& _0
@@ -441,10 +482,13 @@
     // support for stateful tag types
     namespace tag
     {
- template <typename Data, typename Tag
+ template <
+ typename Data, typename Tag
           , typename DataTag1 = unused_type, typename DataTag2 = unused_type>
         struct stateful_tag
         {
+ typedef void is_spirit_tag;
+
             typedef Data data_type;
 
             stateful_tag() {}
@@ -458,7 +502,8 @@
         };
     }
 
- template <typename Data, typename Tag
+ template <
+ typename Data, typename Tag
       , typename DataTag1 = unused_type, typename DataTag2 = unused_type>
     struct stateful_tag_type
       : spirit::terminal<tag::stateful_tag<Data, Tag, DataTag1, DataTag2> >
@@ -467,7 +512,8 @@
 
         stateful_tag_type() {}
         stateful_tag_type(Data const& data)
- : spirit::terminal<tag_type>(data) {}
+ : spirit::terminal<tag_type>(data)
+ {}
 
     private:
         // silence MSVC warning C4512: assignment operator could not be generated
@@ -493,6 +539,28 @@
 
 }}
 
+#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
+namespace boost { namespace phoenix
+{
+ template <typename Tag>
+ struct is_custom_terminal<Tag, typename Tag::is_spirit_tag>
+ : mpl::true_
+ {};
+
+ template <typename Tag>
+ struct custom_terminal<Tag, typename Tag::is_spirit_tag>
+ {
+ typedef spirit::terminal<Tag> result_type;
+
+ template <typename Context>
+ result_type operator()(Tag const & t, Context const &)
+ {
+ return spirit::terminal<Tag>(t);
+ }
+ };
+}}
+#endif
+
 // Define a spirit terminal. This macro may be placed in any namespace.
 // Common placeholders are placed in the main boost::spirit namespace
 // (see common_terminals.hpp)
@@ -505,7 +573,7 @@
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
 #define BOOST_SPIRIT_TERMINAL_NAME(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { typedef void is_spirit_tag; }; } \
     typedef boost::proto::terminal<tag::name>::type type_name; \
     type_name const name = {{}}; \
     inline void BOOST_PP_CAT(silence_unused_warnings_, name)() { (void) name; } \
@@ -514,7 +582,7 @@
 #else
 
 #define BOOST_SPIRIT_TERMINAL_NAME(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { typedef void is_spirit_tag; }; } \
     typedef boost::proto::terminal<tag::name>::type type_name; \
     /***/
 
@@ -543,7 +611,7 @@
 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
 #define BOOST_SPIRIT_TERMINAL_NAME_EX(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { typedef void is_spirit_tag; }; } \
     typedef boost::spirit::terminal<tag::name> type_name; \
     type_name const name = type_name(); \
     inline void BOOST_PP_CAT(silence_unused_warnings_, name)() { (void) name; } \
@@ -552,7 +620,7 @@
 #else
 
 #define BOOST_SPIRIT_TERMINAL_NAME_EX(name, type_name) \
- namespace tag { struct name {}; } \
+ namespace tag { struct name { typedef void is_spirit_tag; }; } \
     typedef boost::spirit::terminal<tag::name> type_name; \
     /***/
 

Added: trunk/boost/spirit/home/support/terminal_expression.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/terminal_expression.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -0,0 +1,75 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2001-2011 Hartmut Kaiser
+ Copyright (c) 2011 Thomas Heller
+
+ 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(BOOST_SPIRIT_TERMINAL_EXPRESSION_MARCH_24_2011_1210AM)
+#define BOOST_SPIRIT_TERMINAL_EXPRESSION_MARCH_24_2011_1210AM
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+
+namespace boost { namespace phoenix
+{
+ namespace expression
+ {
+ template <
+ typename F, typename A0 = void, typename A1 = void
+ , typename A2 = void, typename Dummy = void>
+ struct function;
+
+ template <typename F, typename A0>
+ struct function<F, A0>
+ {
+ typedef phoenix::actor<
+ typename phoenix::as_composite<
+ phoenix::detail::function_eval<1>, F, A0
+ >::type
+ > type;
+
+ static type make(F f, A0 const & _0)
+ {
+ return phoenix::compose<
+ phoenix::detail::function_eval<1> >(f, _0);
+ }
+ };
+
+ template <typename F, typename A0, typename A1>
+ struct function<F, A0, A1>
+ {
+ typedef phoenix::actor<
+ typename phoenix::as_composite<
+ phoenix::detail::function_eval<2>, F, A0, A1
+ >::type
+ > type;
+
+ static type make(F f, A0 const & _0, A1 const & _1)
+ {
+ return phoenix::compose<
+ phoenix::detail::function_eval<2> >(f, _0, _1);
+ }
+ };
+
+ template <typename F, typename A0, typename A1, typename A2>
+ struct function<F, A0, A1, A2>
+ {
+ typedef phoenix::actor<
+ typename phoenix::as_composite<
+ phoenix::detail::function_eval<3>, F, A0, A1, A2
+ >::type
+ > type;
+
+ static type make(F f, A0 const & _0, A1 const & _1, A2 const & _2)
+ {
+ return phoenix::compose<
+ phoenix::detail::function_eval<3> >(f, _0, _1, _2);
+ }
+ };
+ }
+}}
+
+#endif // !BOOST_SPIRIT_USE_PHOENIX_V3
+
+#endif

Modified: trunk/boost/spirit/include/phoenix.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix.hpp (original)
+++ trunk/boost/spirit/include/phoenix.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX
 #define BOOST_SPIRIT_INCLUDE_PHOENIX
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix.hpp>
+#else
+#include <boost/phoenix.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_algorithm.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_algorithm.hpp (original)
+++ trunk/boost/spirit/include/phoenix_algorithm.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_ALGORITHM
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_ALGORITHM
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/algorithm.hpp>
+#else
+#include <boost/phoenix/algorithm.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_bind.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_bind.hpp (original)
+++ trunk/boost/spirit/include/phoenix_bind.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_BIND
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_BIND
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/bind.hpp>
+#else
+#include <boost/phoenix/bind.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_container.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_container.hpp (original)
+++ trunk/boost/spirit/include/phoenix_container.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_CONTAINER
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_CONTAINER
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/container.hpp>
+#else
+#include <boost/phoenix/container.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_core.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_core.hpp (original)
+++ trunk/boost/spirit/include/phoenix_core.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,12 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_CORE
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_CORE
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
+#define BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(A,B,C,D)
 #include <boost/spirit/home/phoenix/core.hpp>
+#else
+#include <boost/phoenix/core.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_function.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_function.hpp (original)
+++ trunk/boost/spirit/include/phoenix_function.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_FUNCTION
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_FUNCTION
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/function.hpp>
+#else
+#include <boost/phoenix/function.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_fusion.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_fusion.hpp (original)
+++ trunk/boost/spirit/include/phoenix_fusion.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_FUSION
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_FUSION
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/fusion.hpp>
+#else
+#include <boost/phoenix/fusion.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_object.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_object.hpp (original)
+++ trunk/boost/spirit/include/phoenix_object.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_OBJECT
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_OBJECT
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/object.hpp>
+#else
+#include <boost/phoenix/object.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_operator.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_operator.hpp (original)
+++ trunk/boost/spirit/include/phoenix_operator.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_OPERATOR
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_OPERATOR
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/operator.hpp>
+#else
+#include <boost/phoenix/operator.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_scope.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_scope.hpp (original)
+++ trunk/boost/spirit/include/phoenix_scope.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_SCOPE
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_SCOPE
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/scope.hpp>
+#else
+#include <boost/phoenix/scope.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_statement.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_statement.hpp (original)
+++ trunk/boost/spirit/include/phoenix_statement.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_STATEMENT
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_STATEMENT
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/statement.hpp>
+#else
+#include <boost/phoenix/statement.hpp>
+#endif
+
 #endif

Modified: trunk/boost/spirit/include/phoenix_stl.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_stl.hpp (original)
+++ trunk/boost/spirit/include/phoenix_stl.hpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -8,5 +8,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_STL
 #define BOOST_SPIRIT_INCLUDE_PHOENIX_STL
+
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #include <boost/spirit/home/phoenix/stl.hpp>
+#else
+#include <boost/phoenix/stl.hpp>
+#endif
+
 #endif

Modified: trunk/libs/spirit/test/Jamfile
==============================================================================
--- trunk/libs/spirit/test/Jamfile (original)
+++ trunk/libs/spirit/test/Jamfile 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -7,6 +7,26 @@
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 #==============================================================================
+
+# bring in rules for testing
+import testing ;
+import modules ;
+import feature ;
+
+###############################################################################
+# new feature definition allowing to switch between Phoenix V2 and V3 tests
+feature.feature phoenix_v3
+ : on
+ : optional composite propagated
+ ;
+
+feature.compose <phoenix_v3>on
+ : <define>BOOST_SPIRIT_USE_PHOENIX_V3=1
+ <define>BOOST_PROTO_MAX_ARITY=11
+ <define>BOOST_PROTO_MAX_LOGICAL_ARITY=11
+ ;
+
+###############################################################################
 project spirit_v2x/test
     : requirements
         <include>.
@@ -16,10 +36,35 @@
     :
     ;
 
-path-constant LEX_DIR : $(BOOST_ROOT)/libs/spirit/test/lex ;
+# use this alias to buil Spirit against Phoenix V2
+alias test_using_phoenix_v2
+ : spirit_v2/qi
+ spirit_v2/qi_regressions
+ spirit_v2/karma
+ spirit_v2/karma_regressions
+ spirit_v2/lex
+ spirit_v2/lex_regressions
+ spirit_v2/support
+ spirit_v2/support_regressions
+ ;
 
-# bring in rules for testing
-import testing ;
+# use this alias to buil Spirit against Phoenix V3
+alias test_using_phoenix_v3
+ : spirit_v2/qi
+ spirit_v2/qi_regressions
+ spirit_v2/karma
+ spirit_v2/karma_regressions
+ spirit_v2/lex
+ spirit_v2/lex_regressions
+ spirit_v2/support
+ spirit_v2/support_regressions
+ : <phoenix_v3>on
+ ;
+
+explicit test_using_phoenix_v2 test_using_phoenix_v3 ;
+
+###############################################################################
+path-constant LEX_DIR : $(BOOST_ROOT)/libs/spirit/test/lex ;
 
 {
     ###########################################################################

Modified: trunk/libs/spirit/test/karma/sequence2.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/sequence2.cpp (original)
+++ trunk/libs/spirit/test/karma/sequence2.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -34,10 +34,15 @@
 struct seqsize_impl
 {
     template <typename Sequence>
- struct result
+ struct result
       : boost::fusion::result_of::size<Sequence>
     {};
 
+ template <typename This, typename Sequence>
+ struct result<This(Sequence)>
+ : result<typename boost::proto::detail::uncvref<Sequence>::type>
+ {};
+
     template <typename Sequence>
     typename result<Sequence>::type
     operator()(Sequence const& seq) const

Modified: trunk/libs/spirit/test/karma/utree1.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/utree1.cpp (original)
+++ trunk/libs/spirit/test/karma/utree1.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -10,8 +10,8 @@
 
 #include <boost/mpl/print.hpp>
 
-#include <boost/spirit/include/support_utree.hpp>
 #include <boost/spirit/include/karma.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 
 #include <sstream>
 

Modified: trunk/libs/spirit/test/karma/utree2.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/utree2.cpp (original)
+++ trunk/libs/spirit/test/karma/utree2.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -10,8 +10,8 @@
 
 #include <boost/mpl/print.hpp>
 
-#include <boost/spirit/include/support_utree.hpp>
 #include <boost/spirit/include/karma.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 
 #include <sstream>
 

Modified: trunk/libs/spirit/test/karma/utree3.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/utree3.cpp (original)
+++ trunk/libs/spirit/test/karma/utree3.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -10,8 +10,8 @@
 
 #include <boost/mpl/print.hpp>
 
-#include <boost/spirit/include/support_utree.hpp>
 #include <boost/spirit/include/karma.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 
 #include <sstream>
 

Modified: trunk/libs/spirit/test/lex/auto_switch_lexerstate.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/auto_switch_lexerstate.cpp (original)
+++ trunk/libs/spirit/test/lex/auto_switch_lexerstate.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -15,16 +15,12 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
+#include <boost/spirit/include/phoenix.hpp>
+
 #include <boost/spirit/include/support_multi_pass.hpp>
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 
-#include <boost/spirit/home/phoenix/core.hpp>
-#include <boost/spirit/home/phoenix/operator.hpp>
-#include <boost/spirit/home/phoenix/statement.hpp>
-#include <boost/spirit/home/phoenix/object.hpp>
-#include <boost/spirit/home/phoenix/stl.hpp>
-
 namespace spirit = boost::spirit;
 namespace lex = spirit::lex;
 namespace phoenix = boost::phoenix;

Modified: trunk/libs/spirit/test/lex/id_type_enum.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/id_type_enum.cpp (original)
+++ trunk/libs/spirit/test/lex/id_type_enum.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -11,10 +11,7 @@
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 
-#include <boost/spirit/home/phoenix/core.hpp>
-#include <boost/spirit/home/phoenix/operator.hpp>
-#include <boost/spirit/home/phoenix/statement.hpp>
-#include <boost/spirit/home/phoenix/object.hpp>
+#include <boost/spirit/include/phoenix.hpp>
 
 namespace spirit = boost::spirit;
 namespace lex = spirit::lex;

Modified: trunk/libs/spirit/test/lex/lexer_state_switcher.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/lexer_state_switcher.cpp (original)
+++ trunk/libs/spirit/test/lex/lexer_state_switcher.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -26,7 +26,7 @@
         this->self = identifier [ phoenix::ref(state_) = _state ];
 
         integer = "[0-9]+";
- this->self("INT") = integer [ _state = phoenix::val("INITIAL") ];
+ this->self("INT") = integer [ _state = "INITIAL" ];
     }
 
     std::string state_;

Modified: trunk/libs/spirit/test/lex/regression_file_iterator1.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression_file_iterator1.cpp (original)
+++ trunk/libs/spirit/test/lex/regression_file_iterator1.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -13,11 +13,7 @@
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 
-#include <boost/spirit/home/phoenix/core.hpp>
-#include <boost/spirit/home/phoenix/operator.hpp>
-#include <boost/spirit/home/phoenix/statement.hpp>
-#include <boost/spirit/home/phoenix/object.hpp>
-#include <boost/spirit/home/phoenix/stl.hpp>
+#include <boost/spirit/include/phoenix.hpp>
 
 namespace spirit = boost::spirit;
 namespace lex = spirit::lex;
@@ -41,14 +37,14 @@
 
 struct identifier
 {
- identifier(file_iterator begin, file_iterator end)
+ identifier(file_iterator, file_iterator)
     {
     }
 };
 
 struct string_literal
 {
- string_literal(file_iterator begin, file_iterator end)
+ string_literal(file_iterator, file_iterator)
     {
     }
 };

Modified: trunk/libs/spirit/test/lex/regression_file_iterator2.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression_file_iterator2.cpp (original)
+++ trunk/libs/spirit/test/lex/regression_file_iterator2.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -13,11 +13,7 @@
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 
-#include <boost/spirit/home/phoenix/core.hpp>
-#include <boost/spirit/home/phoenix/operator.hpp>
-#include <boost/spirit/home/phoenix/statement.hpp>
-#include <boost/spirit/home/phoenix/object.hpp>
-#include <boost/spirit/home/phoenix/stl.hpp>
+#include <boost/spirit/include/phoenix.hpp>
 
 namespace spirit = boost::spirit;
 namespace lex = spirit::lex;
@@ -39,14 +35,14 @@
 
 struct identifier
 {
- identifier(file_iterator begin, file_iterator end)
+ identifier(file_iterator, file_iterator)
     {
     }
 };
 
 struct string_literal
 {
- string_literal(file_iterator begin, file_iterator end)
+ string_literal(file_iterator, file_iterator)
     {
     }
 };

Modified: trunk/libs/spirit/test/lex/regression_file_iterator3.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression_file_iterator3.cpp (original)
+++ trunk/libs/spirit/test/lex/regression_file_iterator3.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -14,10 +14,11 @@
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 
-#include <boost/spirit/home/phoenix/core.hpp>
-#include <boost/spirit/home/phoenix/operator.hpp>
-#include <boost/spirit/home/phoenix/statement.hpp>
-#include <boost/spirit/home/phoenix/object.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_statement.hpp>
+#include <boost/spirit/include/phoenix_object.hpp>
+#include <boost/spirit/include/phoenix_stl.hpp>
 
 #include <sstream>
 
@@ -43,7 +44,7 @@
 
 struct string_literal
 {
- string_literal(file_iterator begin, file_iterator end)
+ string_literal(file_iterator, file_iterator)
     {
     }
 };

Modified: trunk/libs/spirit/test/lex/regression_file_iterator4.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression_file_iterator4.cpp (original)
+++ trunk/libs/spirit/test/lex/regression_file_iterator4.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -17,10 +17,7 @@
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 
-#include <boost/spirit/home/phoenix/core.hpp>
-#include <boost/spirit/home/phoenix/operator.hpp>
-#include <boost/spirit/home/phoenix/statement.hpp>
-#include <boost/spirit/home/phoenix/object.hpp>
+#include <boost/spirit/include/phoenix.hpp>
 
 namespace spirit = boost::spirit;
 namespace lex = spirit::lex;

Modified: trunk/libs/spirit/test/lex/regression_wide.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression_wide.cpp (original)
+++ trunk/libs/spirit/test/lex/regression_wide.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -59,6 +59,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 struct test_impl
 {
+ typedef void result_type;
     template <typename TokenId, typename Value>
     struct result { typedef void type; };
 

Modified: trunk/libs/spirit/test/lex/regression_word_count.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression_word_count.cpp (original)
+++ trunk/libs/spirit/test/lex/regression_word_count.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -12,9 +12,8 @@
 
 #include <boost/spirit/include/qi.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
+
 #include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/include/phoenix_statement.hpp>
-#include <boost/spirit/include/phoenix_container.hpp>
 
 #include <iostream>
 #include <string>

Modified: trunk/libs/spirit/test/support/utree.cpp
==============================================================================
--- trunk/libs/spirit/test/support/utree.cpp (original)
+++ trunk/libs/spirit/test/support/utree.cpp 2011-03-27 22:37:31 EDT (Sun, 27 Mar 2011)
@@ -11,6 +11,7 @@
 #include <boost/detail/lightweight_test.hpp>
 
 #include <boost/functional/hash.hpp>
+#include <boost/spirit/include/phoenix.hpp>
 #include <boost/spirit/include/support_utree.hpp>
 
 #include <iostream>


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