annotate DEPENDENCIES/generic/include/boost/spirit/home/x3/extensions/seek.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 /*=============================================================================
Chris@102 2 Copyright (c) 2011 Jamboree
Chris@102 3 Copyright (c) 2014 Lee Clagett
Chris@102 4
Chris@102 5 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@102 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@102 7 ==============================================================================*/
Chris@102 8 #if !defined(BOOST_SPIRIT_X3_SEEK_APRIL_13_2014_1920PM)
Chris@102 9 #define BOOST_SPIRIT_X3_SEEK_APRIL_13_2014_1920PM
Chris@102 10
Chris@102 11 #if defined(_MSC_VER)
Chris@102 12 #pragma once
Chris@102 13 #endif
Chris@102 14
Chris@102 15 #include <boost/spirit/home/x3/core/parser.hpp>
Chris@102 16
Chris@102 17 namespace boost { namespace spirit { namespace x3
Chris@102 18 {
Chris@102 19 template<typename Subject>
Chris@102 20 struct seek_directive : unary_parser<Subject, seek_directive<Subject>>
Chris@102 21 {
Chris@102 22 typedef unary_parser<Subject, seek_directive<Subject>> base_type;
Chris@102 23 static bool const is_pass_through_unary = true;
Chris@102 24 static bool const handles_container = Subject::handles_container;
Chris@102 25
Chris@102 26 seek_directive(Subject const& subject) :
Chris@102 27 base_type(subject) {}
Chris@102 28
Chris@102 29 template<typename Iterator, typename Context
Chris@102 30 , typename RContext, typename Attribute>
Chris@102 31 bool parse(
Chris@102 32 Iterator& first, Iterator const& last
Chris@102 33 , Context const& context, RContext& rcontext, Attribute& attr) const
Chris@102 34 {
Chris@102 35 Iterator current(first);
Chris@102 36 for (/**/; current != last; ++current)
Chris@102 37 {
Chris@102 38 if (this->subject.parse(current, last, context, rcontext, attr))
Chris@102 39 {
Chris@102 40 first = current;
Chris@102 41 return true;
Chris@102 42 }
Chris@102 43 }
Chris@102 44
Chris@102 45 // Test for when subjects match on input empty. Example:
Chris@102 46 // comment = "//" >> seek[eol | eoi]
Chris@102 47 if (this->subject.parse(current, last, context, rcontext, attr))
Chris@102 48 {
Chris@102 49 first = current;
Chris@102 50 return true;
Chris@102 51 }
Chris@102 52
Chris@102 53 return false;
Chris@102 54 }
Chris@102 55 };
Chris@102 56
Chris@102 57 struct seek_gen
Chris@102 58 {
Chris@102 59 template<typename Subject>
Chris@102 60 seek_directive<typename extension::as_parser<Subject>::value_type>
Chris@102 61 operator[](Subject const& subject) const
Chris@102 62 {
Chris@102 63 return {as_parser(subject)};
Chris@102 64 }
Chris@102 65 };
Chris@102 66
Chris@102 67 seek_gen const seek = seek_gen();
Chris@102 68 }}}
Chris@102 69
Chris@102 70 #endif