]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/spirit/home/qi/parser.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / spirit / home / qi / parser.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(BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM)
8 #define BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM
9
10 #if defined(_MSC_VER)
11 #pragma once
12 #endif
13
14 #include <boost/mpl/has_xxx.hpp>
15 #include <boost/spirit/home/qi/domain.hpp>
16
17 namespace boost { namespace spirit { namespace qi
18 {
19
20 //[parser_base_parser
21 template <typename Derived>
22 struct parser
23 {
24 struct parser_id;
25 typedef Derived derived_type;
26 typedef qi::domain domain;
27
28 // Requirement: p.parse(f, l, context, skip, attr) -> bool
29 //
30 // p: a parser
31 // f, l: first/last iterator pair
32 // context: enclosing rule context (can be unused_type)
33 // skip: skipper (can be unused_type)
34 // attr: attribute (can be unused_type)
35
36 // Requirement: p.what(context) -> info
37 //
38 // p: a parser
39 // context: enclosing rule context (can be unused_type)
40
41 // Requirement: P::template attribute<Ctx, Iter>::type
42 //
43 // P: a parser type
44 // Ctx: A context type (can be unused_type)
45 // Iter: An iterator type (can be unused_type)
46
47 Derived const& derived() const
48 {
49 return *static_cast<Derived const*>(this);
50 }
51 };
52 //]
53
54 template <typename Derived>
55 struct primitive_parser : parser<Derived>
56 {
57 struct primitive_parser_id;
58 };
59
60 template <typename Derived>
61 struct nary_parser : parser<Derived>
62 {
63 struct nary_parser_id;
64
65 // Requirement: p.elements -> fusion sequence
66 //
67 // p: a composite parser
68
69 // Requirement: P::elements_type -> fusion sequence
70 //
71 // P: a composite parser type
72 };
73
74 template <typename Derived>
75 struct unary_parser : parser<Derived>
76 {
77 struct unary_parser_id;
78
79 // Requirement: p.subject -> subject parser
80 //
81 // p: a unary parser
82
83 // Requirement: P::subject_type -> subject parser type
84 //
85 // P: a unary parser type
86 };
87
88 template <typename Derived>
89 struct binary_parser : parser<Derived>
90 {
91 struct binary_parser_id;
92
93 // Requirement: p.left -> left parser
94 //
95 // p: a binary parser
96
97 // Requirement: P::left_type -> left parser type
98 //
99 // P: a binary parser type
100
101 // Requirement: p.right -> right parser
102 //
103 // p: a binary parser
104
105 // Requirement: P::right_type -> right parser type
106 //
107 // P: a binary parser type
108 };
109 }}}
110
111 namespace boost { namespace spirit { namespace traits // classification
112 {
113 namespace detail
114 {
115 BOOST_MPL_HAS_XXX_TRAIT_DEF(parser_id)
116 BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_parser_id)
117 BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_parser_id)
118 BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_parser_id)
119 BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_parser_id)
120 }
121
122 // parser type identification
123 template <typename T>
124 struct is_parser : detail::has_parser_id<T> {};
125
126 template <typename T>
127 struct is_primitive_parser : detail::has_primitive_parser_id<T> {};
128
129 template <typename T>
130 struct is_nary_parser : detail::has_nary_parser_id<T> {};
131
132 template <typename T>
133 struct is_unary_parser : detail::has_unary_parser_id<T> {};
134
135 template <typename T>
136 struct is_binary_parser : detail::has_binary_parser_id<T> {};
137
138 }}}
139
140 #endif