]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/spirit/home/x3/directive/matches.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / spirit / home / x3 / directive / matches.hpp
1 /*=============================================================================
2 Copyright (c) 2015 Mario Lang
3 Copyright (c) 2001-2011 Hartmut Kaiser
4
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_HOME_X3_EXTENSIONS_MATCHES_HPP)
9 #define BOOST_SPIRIT_HOME_X3_EXTENSIONS_MATCHES_HPP
10
11 #include <boost/spirit/home/x3/core/parser.hpp>
12 #include <boost/spirit/home/x3/support/traits/move_to.hpp>
13 #include <boost/spirit/home/x3/support/unused.hpp>
14
15 namespace boost { namespace spirit { namespace x3
16 {
17 template <typename Subject>
18 struct matches_directive : unary_parser<Subject, matches_directive<Subject>>
19 {
20 using base_type = unary_parser<Subject, matches_directive<Subject>>;
21 static bool const has_attribute = true;
22 using attribute_type = bool;
23
24 matches_directive(Subject const& subject) : base_type(subject) {}
25
26 template <typename Iterator, typename Context
27 , typename RContext, typename Attribute>
28 bool parse(Iterator& first, Iterator const& last
29 , Context const& context, RContext& rcontext, Attribute& attr) const
30 {
31 bool const result = this->subject.parse(
32 first, last, context, rcontext, unused);
33 traits::move_to(result, attr);
34 return true;
35 }
36 };
37
38 struct matches_gen
39 {
40 template <typename Subject>
41 matches_directive<typename extension::as_parser<Subject>::value_type>
42 operator[](Subject const& subject) const
43 {
44 return { as_parser(subject) };
45 }
46 };
47
48 auto const matches = matches_gen{};
49 }}}
50
51 #endif