File indexing completed on 2025-01-31 10:02:35
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_X3_SEEK_APRIL_13_2014_1920PM)
0009 #define BOOST_SPIRIT_X3_SEEK_APRIL_13_2014_1920PM
0010
0011 #include <boost/spirit/home/x3/core/parser.hpp>
0012
0013 namespace boost { namespace spirit { namespace x3
0014 {
0015 template<typename Subject>
0016 struct seek_directive : unary_parser<Subject, seek_directive<Subject>>
0017 {
0018 typedef unary_parser<Subject, seek_directive<Subject>> base_type;
0019 static bool const is_pass_through_unary = true;
0020 static bool const handles_container = Subject::handles_container;
0021
0022 constexpr seek_directive(Subject const& subject) :
0023 base_type(subject) {}
0024
0025 template<typename Iterator, typename Context
0026 , typename RContext, typename Attribute>
0027 bool parse(
0028 Iterator& first, Iterator const& last
0029 , Context const& context, RContext& rcontext, Attribute& attr) const
0030 {
0031 for (Iterator current(first);; ++current)
0032 {
0033 if (this->subject.parse(current, last, context, rcontext, attr))
0034 {
0035 first = current;
0036 return true;
0037 }
0038
0039
0040 if (current == last)
0041 return false;
0042 }
0043 }
0044 };
0045
0046 struct seek_gen
0047 {
0048 template<typename Subject>
0049 constexpr seek_directive<typename extension::as_parser<Subject>::value_type>
0050 operator[](Subject const& subject) const
0051 {
0052 return { as_parser(subject) };
0053 }
0054 };
0055
0056 constexpr auto seek = seek_gen{};
0057 }}}
0058
0059 #endif