Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70696 - in trunk: boost/spirit/home/lex/lexer boost/spirit/home/support boost/spirit/home/support/detail libs/spirit/test
From: hartmut.kaiser_at_[hidden]
Date: 2011-03-29 10:25:47


Author: hkaiser
Date: 2011-03-29 10:25:46 EDT (Tue, 29 Mar 2011)
New Revision: 70696
URL: http://svn.boost.org/trac/boost/changeset/70696

Log:
Spirit: more fixes for Phoenix V3
Text files modified:
   trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp | 20 +++++---
   trunk/boost/spirit/home/support/argument_expression.hpp | 14 +++++
   trunk/boost/spirit/home/support/common_terminals.hpp | 4
   trunk/boost/spirit/home/support/detail/is_spirit_tag.hpp | 2
   trunk/boost/spirit/home/support/make_component.hpp | 96 ++++++++++++++++++++++++++++-----------
   trunk/boost/spirit/home/support/terminal.hpp | 7 ++
   trunk/libs/spirit/test/Jamfile | 5 +
   7 files changed, 105 insertions(+), 43 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/support_functions_expression.hpp 2011-03-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -85,7 +85,9 @@
     struct default_actions::when<spirit::lex::rule::less, Dummy>
       : proto::call<
             v2_eval(
- spirit::lex::less_type<proto::_child0>(proto::_child0)
+ proto::make<
+ spirit::lex::less_type<proto::_child0>(proto::_child0)
+ >
               , _env
             )
>
@@ -100,13 +102,15 @@
     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
- )
+ proto::make<
+ spirit::lex::lookahead_type<
+ proto::_child0
+ , proto::_child1
+ >(
+ proto::_child0
+ , proto::_child1
+ )
+ >
               , _env
             )
>

Modified: trunk/boost/spirit/home/support/argument_expression.hpp
==============================================================================
--- trunk/boost/spirit/home/support/argument_expression.hpp (original)
+++ trunk/boost/spirit/home/support/argument_expression.hpp 2011-03-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -106,14 +106,24 @@
     template <typename Dummy>
     struct custom_terminal<spirit::attribute_context<Dummy> >
       : proto::call<
- v2_eval(spirit::attribute_context<Dummy>(), _env)
+ v2_eval(
+ proto::make<spirit::attribute_context<Dummy>()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
>
     {};
 
     template <int N>
     struct custom_terminal<spirit::argument<N> >
       : proto::call<
- v2_eval(spirit::argument<N>(), _env(proto::_, proto::_state, int()))
+ v2_eval(
+ proto::make<spirit::argument<N>()>
+ , proto::call<
+ functional::env(proto::_state)
+ >
+ )
>
     {};
 }}

Modified: trunk/boost/spirit/home/support/common_terminals.hpp
==============================================================================
--- trunk/boost/spirit/home/support/common_terminals.hpp (original)
+++ trunk/boost/spirit/home/support/common_terminals.hpp 2011-03-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -136,8 +136,8 @@
     // special tags (used mainly for stateful tag types)
     namespace tag
     {
- struct attr_cast {};
- struct as {};
+ struct attr_cast { BOOST_SPIRIT_IS_TAG() };
+ struct as { BOOST_SPIRIT_IS_TAG() };
     }
 }}
 

Modified: trunk/boost/spirit/home/support/detail/is_spirit_tag.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/is_spirit_tag.hpp (original)
+++ trunk/boost/spirit/home/support/detail/is_spirit_tag.hpp 2011-03-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -11,7 +11,7 @@
 #pragma once
 #endif
 
-#ifndef BOOST_SPIRIT_USE_SPIRIT_V3
+#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
 #define BOOST_SPIRIT_IS_TAG()
 #else
 #define BOOST_SPIRIT_IS_TAG() typedef void is_spirit_tag;

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-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -54,39 +54,79 @@
 
 namespace boost { namespace spirit { namespace detail
 {
- template <typename Domain>
- struct make_terminal : proto::transform<make_terminal<Domain> >
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl
+ : proto::transform_impl<Expr, State, Data>
     {
- template<typename Expr, typename State, typename Data>
- struct impl : proto::transform_impl<Expr, State, Data>
+ typedef typename
+ proto::result_of::value<Expr>::type
+ value;
+
+ typedef typename result_of::make_cons<value>::type elements;
+
+ typedef
+ make_component<Domain, proto::tag::terminal>
+ make_component_;
+
+ typedef typename
+ make_component_::template
+ result<make_component_(elements, Data)>::type
+ result_type;
+
+ result_type operator()(
+ typename make_terminal_impl::expr_param expr
+ , typename make_terminal_impl::state_param /*state*/
+ , typename make_terminal_impl::data_param data
+ ) const
         {
- typedef typename
- proto::result_of::value<Expr>::type
- value;
-
- typedef typename result_of::make_cons<value>::type elements;
+ return typename make_terminal_impl::make_component_()(
+ detail::make_cons(proto::value(expr))
+ , data
+ );
+ }
+ };
 
- typedef
- make_component<Domain, proto::tag::terminal>
- make_component_;
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl<phoenix::actor<Expr>, State, Data, Domain>
+ : proto::transform_impl<phoenix::actor<Expr>, State, Data>
+ {
+ typedef phoenix::actor<Expr> value;
+ typedef typename result_of::make_cons<value>::type elements;
+ typedef make_component<Domain, proto::tag::terminal> make_component_;
+
+ typedef typename
+ make_component_::template
+ result<make_component_(elements, Data)>::type
+ result_type;
+
+ result_type operator()(
+ typename make_terminal_impl::expr_param expr
+ , typename make_terminal_impl::state_param /*state*/
+ , typename make_terminal_impl::data_param data
+ ) const
+ {
+ return typename make_terminal_impl::make_component_()(
+ detail::make_cons(expr)
+ , data
+ );
+ }
+ };
 
- typedef typename
- make_component_::template
- result<make_component_(elements, Data)>::type
- result_type;
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl<phoenix::actor<Expr> &, State, Data, Domain>
+ : make_terminal_impl<phoenix::actor<Expr>, State, Data, Domain>
+ {};
+
+ template <typename Expr, typename State, typename Data, typename Domain>
+ struct make_terminal_impl<phoenix::actor<Expr> const &, State, Data, Domain>
+ : make_terminal_impl<phoenix::actor<Expr>, State, Data, Domain>
+ {};
 
- result_type operator()(
- typename impl::expr_param expr
- , typename impl::state_param /*state*/
- , typename impl::data_param data
- ) const
- {
- return typename impl::make_component_()(
- detail::make_cons(proto::value(expr))
- , data
- );
- }
- };
+ template <typename Domain>
+ struct make_terminal : proto::transform<make_terminal<Domain> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl : make_terminal_impl<Expr, State, Data, Domain> {};
     };
 
     template <typename Domain, typename Tag, typename Grammar>

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-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -65,6 +65,13 @@
     template <typename Domain, typename Terminal, int Arity, typename Enable = void>
     struct use_lazy_directive : mpl::false_ {};
 
+ template <typename Terminal>
+ struct terminal;
+
+ template <typename Domain, typename Terminal>
+ struct use_terminal<Domain, terminal<Terminal> >
+ : use_terminal<Domain, Terminal> {};
+
     template <typename Domain, typename Terminal, int Arity, typename Actor>
     struct use_terminal<Domain, lazy_terminal<Terminal, Actor, Arity> >
         : use_lazy_terminal<Domain, Terminal, Arity> {};

Modified: trunk/libs/spirit/test/Jamfile
==============================================================================
--- trunk/libs/spirit/test/Jamfile (original)
+++ trunk/libs/spirit/test/Jamfile 2011-03-29 10:25:46 EDT (Tue, 29 Mar 2011)
@@ -311,9 +311,10 @@
     ;
 }
 
-# use this alias to buil Spirit against Phoenix V2
+# use this alias to build Spirit against Phoenix V2
 alias test_using_phoenix_v2 : $(v2_tests) ;
 
-# use this alias to buil Spirit against Phoenix V3
+# use this alias to build Spirit against Phoenix V3
 alias test_using_phoenix_v3 : $(v3_tests) ;
+
 explicit test_using_phoenix_v2 test_using_phoenix_v3 ;


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