]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/spirit/home/qi/operator/not_predicate.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / spirit / home / qi / operator / not_predicate.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 =============================================================================*/
7 #ifndef BOOST_SPIRIT_QI_OPERATOR_NOT_PREDICATE_HPP
8 #define BOOST_SPIRIT_QI_OPERATOR_NOT_PREDICATE_HPP
9
10 #if defined(_MSC_VER)
11 #pragma once
12 #endif
13
14 #include <boost/spirit/home/qi/domain.hpp>
15 #include <boost/spirit/home/qi/meta_compiler.hpp>
16 #include <boost/spirit/home/qi/parser.hpp>
17 #include <boost/spirit/home/qi/detail/attributes.hpp>
18 #include <boost/spirit/home/support/has_semantic_action.hpp>
19 #include <boost/spirit/home/support/handles_container.hpp>
20 #include <boost/spirit/home/support/info.hpp>
21 #include <boost/proto/operators.hpp>
22 #include <boost/proto/tags.hpp>
23
24 namespace boost { namespace spirit
25 {
26 ///////////////////////////////////////////////////////////////////////////
27 // Enablers
28 ///////////////////////////////////////////////////////////////////////////
29 template <>
30 struct use_operator<qi::domain, proto::tag::logical_not> // enables !p
31 : mpl::true_ {};
32 }}
33
34 namespace boost { namespace spirit { namespace qi
35 {
36 template <typename Subject>
37 struct not_predicate : unary_parser<not_predicate<Subject> >
38 {
39 typedef Subject subject_type;
40
41 template <typename Context, typename Iterator>
42 struct attribute
43 {
44 typedef unused_type type;
45 };
46
47 not_predicate(Subject const& subject_)
48 : subject(subject_) {}
49
50 template <typename Iterator, typename Context
51 , typename Skipper, typename Attribute>
52 bool parse(Iterator& first, Iterator const& last
53 , Context& context, Skipper const& skipper
54 , Attribute& /*attr*/) const
55 {
56 Iterator i = first;
57 return !subject.parse(i, last, context, skipper, unused);
58 }
59
60 template <typename Context>
61 info what(Context& context) const
62 {
63 return info("not-predicate", subject.what(context));
64 }
65
66 Subject subject;
67 };
68
69 ///////////////////////////////////////////////////////////////////////////
70 // Parser generators: make_xxx function (objects)
71 ///////////////////////////////////////////////////////////////////////////
72 template <typename Elements, typename Modifiers>
73 struct make_composite<proto::tag::logical_not, Elements, Modifiers>
74 : make_unary_composite<Elements, not_predicate>
75 {};
76 }}}
77
78 namespace boost { namespace spirit { namespace traits
79 {
80 ///////////////////////////////////////////////////////////////////////////
81 template <typename Subject>
82 struct has_semantic_action<qi::not_predicate<Subject> >
83 : unary_has_semantic_action<Subject> {};
84
85 ///////////////////////////////////////////////////////////////////////////
86 template <typename Subject, typename Attribute, typename Context
87 , typename Iterator>
88 struct handles_container<qi::not_predicate<Subject>, Attribute
89 , Context, Iterator>
90 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
91 }}}
92
93 #endif