File indexing completed on 2025-12-16 10:09:00
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_SPIRIT_LAZY_HPP
0010 #define BOOST_SPIRIT_LAZY_HPP
0011
0012
0013 #include <boost/spirit/home/classic/namespace.hpp>
0014 #include <boost/spirit/home/classic/core/parser.hpp>
0015 #include <boost/spirit/home/classic/phoenix/actor.hpp>
0016
0017
0018
0019 namespace boost { namespace spirit {
0020
0021 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0022
0023
0024
0025
0026
0027
0028
0029 template<class ActorT>
0030 struct lazy_parser : parser<lazy_parser<ActorT> >
0031 {
0032 typedef lazy_parser<ActorT> self_t;
0033 typedef typename ::phoenix::actor_result<
0034 ActorT, ::phoenix::tuple<> >::plain_type actor_result_t;
0035
0036 template<typename ScannerT>
0037 struct result
0038 {
0039 typedef typename
0040 parser_result<actor_result_t, ScannerT>::type
0041 type;
0042 };
0043
0044 lazy_parser(ActorT const& actor_)
0045 : actor(actor_) {}
0046
0047 template<typename ScannerT>
0048 typename parser_result<self_t, ScannerT>::type
0049 parse(ScannerT const& scan) const
0050 { return actor().parse(scan); }
0051
0052 ActorT actor;
0053 };
0054
0055
0056
0057
0058 template<class ActorT>
0059 lazy_parser<ActorT> lazy_p(ActorT const& actor)
0060 { return lazy_parser<ActorT>(actor); }
0061
0062 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0063
0064 }}
0065
0066 #endif