annotate DEPENDENCIES/generic/include/boost/spirit/home/x3/operator/sequence.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
Chris@102 4 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@102 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@102 6 =============================================================================*/
Chris@102 7 #if !defined(SPIRIT_SEQUENCE_JAN_06_2013_1015AM)
Chris@102 8 #define SPIRIT_SEQUENCE_JAN_06_2013_1015AM
Chris@102 9
Chris@102 10 #if defined(_MSC_VER)
Chris@102 11 #pragma once
Chris@102 12 #endif
Chris@102 13
Chris@102 14 #include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
Chris@102 15 #include <boost/spirit/home/x3/core/parser.hpp>
Chris@102 16 #include <boost/spirit/home/x3/operator/detail/sequence.hpp>
Chris@102 17 #include <boost/spirit/home/x3/directive/expect.hpp>
Chris@102 18
Chris@102 19 namespace boost { namespace spirit { namespace x3
Chris@102 20 {
Chris@102 21 template <typename Left, typename Right>
Chris@102 22 struct sequence : binary_parser<Left, Right, sequence<Left, Right>>
Chris@102 23 {
Chris@102 24 typedef binary_parser<Left, Right, sequence<Left, Right>> base_type;
Chris@102 25
Chris@102 26 sequence(Left left, Right right)
Chris@102 27 : base_type(left, right) {}
Chris@102 28
Chris@102 29 template <typename Iterator, typename Context, typename RContext>
Chris@102 30 bool parse(
Chris@102 31 Iterator& first, Iterator const& last
Chris@102 32 , Context const& context, RContext& rcontext, unused_type) const
Chris@102 33 {
Chris@102 34 Iterator save = first;
Chris@102 35 if (this->left.parse(first, last, context, rcontext, unused)
Chris@102 36 && this->right.parse(first, last, context, rcontext, unused))
Chris@102 37 return true;
Chris@102 38 first = save;
Chris@102 39 return false;
Chris@102 40 }
Chris@102 41
Chris@102 42 template <typename Iterator, typename Context
Chris@102 43 , typename RContext, typename Attribute>
Chris@102 44 bool parse(
Chris@102 45 Iterator& first, Iterator const& last
Chris@102 46 , Context const& context, RContext& rcontext, Attribute& attr) const
Chris@102 47 {
Chris@102 48 return detail::parse_sequence(*this, first, last, context, rcontext, attr
Chris@102 49 , typename traits::attribute_category<Attribute>::type());
Chris@102 50 }
Chris@102 51 };
Chris@102 52
Chris@102 53 template <typename Left, typename Right>
Chris@102 54 inline sequence<
Chris@102 55 typename extension::as_parser<Left>::value_type
Chris@102 56 , typename extension::as_parser<Right>::value_type>
Chris@102 57 operator>>(Left const& left, Right const& right)
Chris@102 58 {
Chris@102 59 return {as_parser(left), as_parser(right)};
Chris@102 60 }
Chris@102 61
Chris@102 62 template <typename Left, typename Right>
Chris@102 63 inline sequence<
Chris@102 64 typename extension::as_parser<Left>::value_type
Chris@102 65 , expect_directive<typename extension::as_parser<Right>::value_type>>
Chris@102 66 operator>(Left const& left, Right const& right)
Chris@102 67 {
Chris@102 68 return {as_parser(left), as_parser(right)};
Chris@102 69 }
Chris@102 70 }}}
Chris@102 71
Chris@102 72 namespace boost { namespace spirit { namespace x3 { namespace traits
Chris@102 73 {
Chris@102 74 template <typename Left, typename Right, typename Context>
Chris@102 75 struct attribute_of<x3::sequence<Left, Right>, Context>
Chris@102 76 : x3::detail::attribute_of_sequence<Left, Right, Context> {};
Chris@102 77 }}}}
Chris@102 78
Chris@102 79 #endif