File indexing completed on 2025-01-19 09:47:46
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM)
0009 #define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM
0010
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014
0015 #include <boost/spirit/home/qi/parse.hpp>
0016 #include <boost/spirit/home/qi/parser.hpp>
0017 #include <boost/spirit/home/support/unused.hpp>
0018 #include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
0019 #include <boost/mpl/bool.hpp>
0020 #include <iosfwd>
0021
0022
0023 namespace boost { namespace spirit { namespace qi
0024 {
0025
0026 template <typename Expr>
0027 inline typename detail::match<Expr>::type
0028 match(
0029 Expr const& expr)
0030 {
0031 return detail::match<Expr>::call(expr);
0032 }
0033
0034 template <typename Expr, typename Attribute>
0035 inline detail::match_manip<
0036 Expr, mpl::false_, mpl::false_, unused_type, Attribute
0037 >
0038 match(
0039 Expr const& xpr
0040 , Attribute& p)
0041 {
0042 using qi::detail::match_manip;
0043
0044
0045
0046
0047 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
0048 return match_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>(
0049 xpr, unused, p);
0050 }
0051
0052
0053 template <typename Expr, typename Skipper>
0054 inline typename detail::phrase_match<Expr, Skipper>::type
0055 phrase_match(
0056 Expr const& expr
0057 , Skipper const& s
0058 , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
0059 {
0060 return detail::phrase_match<Expr, Skipper>::call(expr, s, post_skip);
0061 }
0062
0063 template <typename Expr, typename Skipper, typename Attribute>
0064 inline detail::match_manip<
0065 Expr, mpl::false_, mpl::false_, Skipper, Attribute
0066 >
0067 phrase_match(
0068 Expr const& xpr
0069 , Skipper const& s
0070 , BOOST_SCOPED_ENUM(skip_flag) post_skip
0071 , Attribute& p)
0072 {
0073 using qi::detail::match_manip;
0074
0075
0076
0077
0078
0079 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
0080 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
0081 return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
0082 xpr, s, post_skip, p);
0083 }
0084
0085 template <typename Expr, typename Skipper, typename Attribute>
0086 inline detail::match_manip<
0087 Expr, mpl::false_, mpl::false_, Skipper, Attribute
0088 >
0089 phrase_match(
0090 Expr const& xpr
0091 , Skipper const& s
0092 , Attribute& p)
0093 {
0094 using qi::detail::match_manip;
0095
0096
0097
0098
0099
0100 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
0101 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
0102 return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
0103 xpr, s, p);
0104 }
0105
0106
0107 template<typename Char, typename Traits, typename Derived>
0108 inline std::basic_istream<Char, Traits>&
0109 operator>>(std::basic_istream<Char, Traits>& is, parser<Derived> const& p)
0110 {
0111 typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
0112
0113 input_iterator f(is);
0114 input_iterator l;
0115 if (!p.derived().parse(f, l, unused, unused, unused))
0116 {
0117 is.setstate(std::basic_istream<Char, Traits>::failbit);
0118 }
0119 return is;
0120 }
0121
0122 }}}
0123
0124 #endif
0125