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