]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/include/boost/spirit/home/qi/operator/not_predicate.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / 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 #if !defined(SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM)
8 #define SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM
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
22 namespace boost { namespace spirit
23 {
24 ///////////////////////////////////////////////////////////////////////////
25 // Enablers
26 ///////////////////////////////////////////////////////////////////////////
27 template <>
28 struct use_operator<qi::domain, proto::tag::logical_not> // enables !p
29 : mpl::true_ {};
30 }}
31
32 namespace boost { namespace spirit { namespace qi
33 {
34 template <typename Subject>
35 struct not_predicate : unary_parser<not_predicate<Subject> >
36 {
37 typedef Subject subject_type;
38
39 template <typename Context, typename Iterator>
40 struct attribute
41 {
42 typedef unused_type type;
43 };
44
45 not_predicate(Subject const& subject_)
46 : subject(subject_) {}
47
48 template <typename Iterator, typename Context
49 , typename Skipper, typename Attribute>
50 bool parse(Iterator& first, Iterator const& last
51 , Context& context, Skipper const& skipper
52 , Attribute& /*attr*/) const
53 {
54 Iterator i = first;
55 return !subject.parse(i, last, context, skipper, unused);
56 }
57
58 template <typename Context>
59 info what(Context& context) const
60 {
61 return info("not-predicate", subject.what(context));
62 }
63
64 Subject subject;
65 };
66
67 ///////////////////////////////////////////////////////////////////////////
68 // Parser generators: make_xxx function (objects)
69 ///////////////////////////////////////////////////////////////////////////
70 template <typename Elements, typename Modifiers>
71 struct make_composite<proto::tag::logical_not, Elements, Modifiers>
72 : make_unary_composite<Elements, not_predicate>
73 {};
74 }}}
75
76 namespace boost { namespace spirit { namespace traits
77 {
78 ///////////////////////////////////////////////////////////////////////////
79 template <typename Subject>
80 struct has_semantic_action<qi::not_predicate<Subject> >
81 : unary_has_semantic_action<Subject> {};
82
83 ///////////////////////////////////////////////////////////////////////////
84 template <typename Subject, typename Attribute, typename Context
85 , typename Iterator>
86 struct handles_container<qi::not_predicate<Subject>, Attribute
87 , Context, Iterator>
88 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
89 }}}
90
91 #endif