|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21585/root/usr/include/boost/spirit/dynamic/ |
Upload File : |
/*=============================================================================
Copyright (c) 2003 Joel de Guzman
Copyright (c) 2003 Vaclav Vesely
http://spirit.sourceforge.net/
Use, modification and distribution is subject to 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_SPIRIT_LAZY_HPP
#define BOOST_SPIRIT_LAZY_HPP
////////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/core/parser.hpp>
#include <boost/spirit/phoenix/actor.hpp>
////////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit
{
////////////////////////////////////////////////////////////////////////////
//
// lazy_parser, holds phoenix actor which returns a spirit parser.
//
////////////////////////////////////////////////////////////////////////////
template<class ActorT>
struct lazy_parser : parser<lazy_parser<ActorT> >
{
typedef lazy_parser<ActorT> self_t;
typedef typename phoenix::actor_result<
ActorT, phoenix::tuple<> >::plain_type actor_result_t;
template<typename ScannerT>
struct result
{
typedef typename
parser_result<actor_result_t, ScannerT>::type
type;
};
lazy_parser(ActorT const& actor_)
: actor(actor_) {}
template<typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{ return actor().parse(scan); }
ActorT actor;
};
//////////////////////////////
// lazy_p, returns lazy_parser
// Usage: lazy_p(actor)
template<class ActorT>
lazy_parser<ActorT> lazy_p(ActorT const& actor)
{ return lazy_parser<ActorT>(actor); }
}} // namespace boost::spirit
#endif // BOOST_SPIRIT_LAZY_HPP