Chris@16: /*============================================================================== Chris@16: Copyright (c) 2001-2010 Joel de Guzman Chris@16: Copyright (c) 2010 Thomas Heller Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: ==============================================================================*/ Chris@16: #ifndef BOOST_PHOENIX_STATEMENT_WHILE_HPP Chris@16: #define BOOST_PHOENIX_STATEMENT_WHILE_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: BOOST_PHOENIX_DEFINE_EXPRESSION( Chris@16: (boost)(phoenix)(while_) Chris@16: , (meta_grammar) // Cond Chris@16: (meta_grammar) // Do Chris@16: ) Chris@16: Chris@16: namespace boost { namespace phoenix Chris@16: { Chris@16: struct while_eval Chris@16: { Chris@16: typedef void result_type; Chris@16: Chris@16: template Chris@16: result_type Chris@101: operator()(Cond const& cond, Do const& do_it, Context const & ctx) const Chris@16: { Chris@16: while(boost::phoenix::eval(cond, ctx)) Chris@16: { Chris@101: boost::phoenix::eval(do_it, ctx); Chris@16: } Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct default_actions::when Chris@16: : call Chris@16: {}; Chris@16: Chris@16: template Chris@16: struct while_gen Chris@16: { Chris@101: while_gen(Cond const& cond_) : cond(cond_) {} Chris@16: Chris@16: template Chris@16: typename expression::while_::type const Chris@101: operator[](Do const& do_it) const Chris@16: { Chris@101: return expression::while_::make(cond, do_it); Chris@16: } Chris@16: Chris@16: Cond const& cond; Chris@16: }; Chris@16: Chris@16: template Chris@16: inline Chris@16: while_gen const Chris@16: while_(Cond const& cond) Chris@16: { Chris@16: return while_gen(cond); Chris@16: } Chris@16: Chris@16: Chris@16: }} Chris@16: Chris@16: #endif