os/ossrv/ossrv_pub/boost_apis/boost/spirit/dynamic/lazy.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/spirit/dynamic/lazy.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,62 @@
     1.4 +/*=============================================================================
     1.5 +    Copyright (c) 2003 Joel de Guzman
     1.6 +    Copyright (c) 2003 Vaclav Vesely
     1.7 +    http://spirit.sourceforge.net/
     1.8 +
     1.9 +    Use, modification and distribution is subject to the Boost Software
    1.10 +    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.11 +    http://www.boost.org/LICENSE_1_0.txt)
    1.12 +=============================================================================*/
    1.13 +#ifndef BOOST_SPIRIT_LAZY_HPP
    1.14 +#define BOOST_SPIRIT_LAZY_HPP
    1.15 +
    1.16 +////////////////////////////////////////////////////////////////////////////////
    1.17 +#include <boost/spirit/core/parser.hpp>
    1.18 +#include <boost/spirit/phoenix/actor.hpp>
    1.19 +
    1.20 +////////////////////////////////////////////////////////////////////////////////
    1.21 +
    1.22 +namespace boost { namespace spirit
    1.23 +{
    1.24 +    ////////////////////////////////////////////////////////////////////////////
    1.25 +    //
    1.26 +    // lazy_parser, holds phoenix actor which returns a spirit parser.
    1.27 +    //
    1.28 +    ////////////////////////////////////////////////////////////////////////////
    1.29 +
    1.30 +    template<class ActorT>
    1.31 +    struct lazy_parser : parser<lazy_parser<ActorT> >
    1.32 +    {
    1.33 +        typedef lazy_parser<ActorT> self_t;
    1.34 +        typedef typename phoenix::actor_result<
    1.35 +            ActorT, phoenix::tuple<> >::plain_type actor_result_t;
    1.36 +
    1.37 +        template<typename ScannerT>
    1.38 +        struct result
    1.39 +        {
    1.40 +            typedef typename
    1.41 +                parser_result<actor_result_t, ScannerT>::type
    1.42 +            type;
    1.43 +        };
    1.44 +
    1.45 +        lazy_parser(ActorT const& actor_)
    1.46 +        : actor(actor_) {}
    1.47 +
    1.48 +        template<typename ScannerT>
    1.49 +        typename parser_result<self_t, ScannerT>::type
    1.50 +        parse(ScannerT const& scan) const
    1.51 +        { return actor().parse(scan); }
    1.52 +
    1.53 +        ActorT actor;
    1.54 +    };
    1.55 +
    1.56 +    //////////////////////////////
    1.57 +    // lazy_p, returns lazy_parser
    1.58 +    // Usage: lazy_p(actor)
    1.59 +    template<class ActorT>
    1.60 +    lazy_parser<ActorT> lazy_p(ActorT const& actor)
    1.61 +    { return lazy_parser<ActorT>(actor); }
    1.62 +
    1.63 +}} // namespace boost::spirit
    1.64 +
    1.65 +#endif // BOOST_SPIRIT_LAZY_HPP