1 /*=============================================================================
2 Copyright (c) 2011 Jamboree
3 Copyright (c) 2014 Lee Clagett
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(BOOST_SPIRIT_X3_SEEK_APRIL_13_2014_1920PM)
9 #define BOOST_SPIRIT_X3_SEEK_APRIL_13_2014_1920PM
11 #include <boost/spirit/home/x3/core/parser.hpp>
13 namespace boost { namespace spirit { namespace x3
15 template<typename Subject>
16 struct seek_directive : unary_parser<Subject, seek_directive<Subject>>
18 typedef unary_parser<Subject, seek_directive<Subject>> base_type;
19 static bool const is_pass_through_unary = true;
20 static bool const handles_container = Subject::handles_container;
22 seek_directive(Subject const& subject) :
25 template<typename Iterator, typename Context
26 , typename RContext, typename Attribute>
28 Iterator& first, Iterator const& last
29 , Context const& context, RContext& rcontext, Attribute& attr) const
31 Iterator current(first);
32 for (/**/; current != last; ++current)
34 if (this->subject.parse(current, last, context, rcontext, attr))
41 // Test for when subjects match on input empty. Example:
42 // comment = "//" >> seek[eol | eoi]
43 if (this->subject.parse(current, last, context, rcontext, attr))
55 template<typename Subject>
56 seek_directive<typename extension::as_parser<Subject>::value_type>
57 operator[](Subject const& subject) const
59 return { as_parser(subject) };
63 auto const seek = seek_gen{};