annotate DEPENDENCIES/generic/include/boost/spirit/home/x3/operator/kleene.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) 2001-2014 Joel de Guzman
Chris@102 3 Copyright (c) 2001-2011 Hartmut Kaiser
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(SPIRIT_KLEENE_JANUARY_07_2007_0818AM)
Chris@102 9 #define SPIRIT_KLEENE_JANUARY_07_2007_0818AM
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 #include <boost/spirit/home/x3/support/traits/container_traits.hpp>
Chris@102 17 #include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
Chris@102 18 #include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
Chris@102 19
Chris@102 20 namespace boost { namespace spirit { namespace x3
Chris@102 21 {
Chris@102 22 template <typename Subject>
Chris@102 23 struct kleene : unary_parser<Subject, kleene<Subject>>
Chris@102 24 {
Chris@102 25 typedef unary_parser<Subject, kleene<Subject>> base_type;
Chris@102 26 static bool const handles_container = true;
Chris@102 27
Chris@102 28 kleene(Subject const& subject)
Chris@102 29 : base_type(subject) {}
Chris@102 30
Chris@102 31 template <typename Iterator, typename Context
Chris@102 32 , typename RContext, typename Attribute>
Chris@102 33 bool parse(Iterator& first, Iterator const& last
Chris@102 34 , Context const& context, RContext& rcontext, Attribute& attr) const
Chris@102 35 {
Chris@102 36 while (detail::parse_into_container(
Chris@102 37 this->subject, first, last, context, rcontext, attr))
Chris@102 38 ;
Chris@102 39 return true;
Chris@102 40 }
Chris@102 41 };
Chris@102 42
Chris@102 43 template <typename Subject>
Chris@102 44 inline kleene<typename extension::as_parser<Subject>::value_type>
Chris@102 45 operator*(Subject const& subject)
Chris@102 46 {
Chris@102 47 return {as_parser(subject)};
Chris@102 48 }
Chris@102 49 }}}
Chris@102 50
Chris@102 51 namespace boost { namespace spirit { namespace x3 { namespace traits
Chris@102 52 {
Chris@102 53 template <typename Subject, typename Context>
Chris@102 54 struct attribute_of<x3::kleene<Subject>, Context>
Chris@102 55 : build_container<
Chris@102 56 typename attribute_of<Subject, Context>::type> {};
Chris@102 57 }}}}
Chris@102 58
Chris@102 59 #endif