File indexing completed on 2025-01-19 09:47:44
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_DETAIL_PARSE_AUTO_DEC_02_2009_0426PM)
0008 #define BOOST_SPIRIT_DETAIL_PARSE_AUTO_DEC_02_2009_0426PM
0009
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013
0014 #include <boost/spirit/home/qi/parse.hpp>
0015 #include <boost/spirit/home/qi/auto/create_parser.hpp>
0016 #include <boost/utility/enable_if.hpp>
0017 #include <boost/mpl/not.hpp>
0018 #include <boost/mpl/and.hpp>
0019
0020 namespace boost { namespace spirit { namespace qi { namespace detail
0021 {
0022
0023 template <typename Expr>
0024 struct parse_impl<Expr
0025 , typename enable_if<
0026 mpl::and_<
0027 traits::meta_create_exists<qi::domain, Expr>
0028 , mpl::not_<traits::matches<qi::domain, Expr> > >
0029 >::type>
0030 {
0031 template <typename Iterator>
0032 static bool call(Iterator& first, Iterator last, Expr& expr)
0033 {
0034 return qi::parse(first, last, create_parser<Expr>(), expr);
0035 }
0036
0037 template <typename Iterator>
0038 static bool call(Iterator& first, Iterator last, Expr const& expr)
0039 {
0040 return qi::parse(first, last, create_parser<Expr>()
0041 , const_cast<Expr&>(expr));
0042 }
0043 };
0044
0045
0046 template <typename Expr>
0047 struct phrase_parse_impl<Expr
0048 , typename enable_if<
0049 mpl::and_<
0050 traits::meta_create_exists<qi::domain, Expr>
0051 , mpl::not_<traits::matches<qi::domain, Expr> > >
0052 >::type>
0053 {
0054 template <typename Iterator, typename Skipper>
0055 static bool call(Iterator& first, Iterator last, Expr& expr
0056 , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip)
0057 {
0058 return qi::phrase_parse(first, last, create_parser<Expr>()
0059 , skipper, post_skip, expr);
0060 }
0061
0062 template <typename Iterator, typename Skipper>
0063 static bool call(Iterator& first, Iterator last, Expr const& expr
0064 , Skipper const& skipper, BOOST_SCOPED_ENUM(skip_flag) post_skip)
0065 {
0066 return qi::phrase_parse(first, last, create_parser<Expr>()
0067 , skipper, post_skip, const_cast<Expr&>(expr));
0068 }
0069 };
0070 }}}}
0071
0072 namespace boost { namespace spirit { namespace qi
0073 {
0074
0075 template <typename Iterator, typename Expr>
0076 inline bool
0077 parse(
0078 Iterator& first
0079 , Iterator last
0080 , Expr& expr)
0081 {
0082
0083
0084
0085
0086 BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
0087
0088 return detail::parse_impl<Expr>::call(first, last, expr);
0089 }
0090
0091
0092 template <typename Iterator, typename Expr, typename Skipper>
0093 inline bool
0094 phrase_parse(
0095 Iterator& first
0096 , Iterator last
0097 , Expr& expr
0098 , Skipper const& skipper
0099 , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
0100 {
0101
0102
0103
0104
0105 BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
0106
0107 return detail::phrase_parse_impl<Expr>::call(
0108 first, last, expr, skipper, post_skip);
0109 }
0110 }}}
0111
0112 #endif
0113