/*============================================================================== Copyright (c) 2001-2010 Joel de Guzman Copyright (c) 2010 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) ==============================================================================*/ #ifndef BOOST_PHOENIX_STATEMENT_WHILE_HPP #define BOOST_PHOENIX_STATEMENT_WHILE_HPP #include #include #include #include BOOST_PHOENIX_DEFINE_EXPRESSION( (boost)(phoenix)(while_) , (meta_grammar) // Cond (meta_grammar) // Do ) namespace boost { namespace phoenix { struct while_eval { typedef void result_type; template result_type operator()(Cond const& cond, Do const& do_, Context const & ctx) const { while(boost::phoenix::eval(cond, ctx)) { boost::phoenix::eval(do_, ctx); } } }; template struct default_actions::when : call {}; template struct while_gen { while_gen(Cond const& cond) : cond(cond) {} template typename expression::while_::type const operator[](Do const& do_) const { return expression::while_::make(cond, do_); } Cond const& cond; }; template inline while_gen const while_(Cond const& cond) { return while_gen(cond); } }} #endif