Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54511 - trunk/boost/spirit/home/lex
From: frabar666_at_[hidden]
Date: 2009-06-29 18:59:12


Author: fbarel
Date: 2009-06-29 18:59:12 EDT (Mon, 29 Jun 2009)
New Revision: 54511
URL: http://svn.boost.org/trac/boost/changeset/54511

Log:
Spirit.Lex: fix lexer_state_switcher test failing on gcc-4.3.3
Text files modified:
   trunk/boost/spirit/home/lex/argument.hpp | 36 ++++++++++++++++++------------------
   1 files changed, 18 insertions(+), 18 deletions(-)

Modified: trunk/boost/spirit/home/lex/argument.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/argument.hpp (original)
+++ trunk/boost/spirit/home/lex/argument.hpp 2009-06-29 18:59:12 EDT (Mon, 29 Jun 2009)
@@ -99,6 +99,10 @@
         state_setter(Actor const& actor)
           : actor_(actor) {}
 
+ // see explanation for this constructor at the end of this file
+ state_setter(phoenix::actor<state_getter>, Actor const& actor)
+ : actor_(actor) {}
+
         Actor actor_;
     };
 
@@ -108,8 +112,8 @@
     // 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 and functions from the Phoenix
- // expression composition engine (see the end of this file).
+ // 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;
@@ -210,28 +214,24 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // The specialization of as_composite<> below is needed to integrate the
- // overload of the compose() function into Phoenix expression composition
- // engine.
+ // The specialization of as_composite<> below is needed to convert all
+ // assignments to _state (places where it's used as a lvalue) into the
+ // proper Phoenix actor (spirit::state_setter) allowing to change the
+ // lexer state.
     template <typename RHS>
     struct as_composite<assign_eval, actor<spirit::state_context>, RHS>
     {
+ // For an assignment to _state (a spirit::state_context actor), this
+ // specialization makes Phoenix's compose() function construct a
+ // spirit::state_setter actor from 1. the LHS, a spirit::state_getter
+ // actor (due to the specialization of as_actor_base<> above),
+ // and 2. the RHS actor.
+ // This is why spirit::state_setter needs a constructor which takes
+ // a dummy spirit::state_getter as its first argument in addition
+ // to its real, second argument (the RHS actor).
         typedef spirit::state_setter<typename as_actor<RHS>::type> type;
     };
 
- ///////////////////////////////////////////////////////////////////////////
- // The compose function overload allows to convert all occurences of
- // _state in places where it's used as a lvalue into the proper Phoenix
- // actor (spirit::state_setter) allowing to change the lexer state.
- template <typename EvalPolicy, typename RHS>
- inline spirit::state_setter<typename as_actor<RHS>::type>
- compose(actor<spirit::state_context>, RHS const& rhs
- , typename enable_if<is_same<EvalPolicy, assign_eval> >::type* = NULL)
- {
- typedef typename as_actor<RHS>::type actor_type;
- return spirit::state_setter<actor_type>(as_actor<RHS>::convert(rhs));
- }
-
 }}
 
 #undef SPIRIT_DECLARE_ARG


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