]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/spirit/home/x3/directive/no_skip.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / spirit / home / x3 / directive / no_skip.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
3 Copyright (c) 2001-2011 Hartmut Kaiser
4 Copyright (c) 2013 Agustin Berge
5
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 #if !defined(SPIRIT_NO_SKIP_JAN_16_2010_0802PM)
10 #define SPIRIT_NO_SKIP_JAN_16_2010_0802PM
11
12 #include <boost/spirit/home/x3/support/context.hpp>
13 #include <boost/spirit/home/x3/support/unused.hpp>
14 #include <boost/spirit/home/x3/core/skip_over.hpp>
15 #include <boost/spirit/home/x3/core/parser.hpp>
16 #include <boost/type_traits/remove_reference.hpp>
17 #include <boost/utility/enable_if.hpp>
18
19 namespace boost { namespace spirit { namespace x3
20 {
21 // same as lexeme[], but does not pre-skip
22 template <typename Subject>
23 struct no_skip_directive : unary_parser<Subject, no_skip_directive<Subject>>
24 {
25 typedef unary_parser<Subject, no_skip_directive<Subject> > base_type;
26 static bool const is_pass_through_unary = true;
27 static bool const handles_container = Subject::handles_container;
28
29 no_skip_directive(Subject const& subject)
30 : base_type(subject) {}
31
32 template <typename Iterator, typename Context
33 , typename RContext, typename Attribute>
34 typename enable_if<has_skipper<Context>, bool>::type
35 parse(Iterator& first, Iterator const& last
36 , Context const& context, RContext& rcontext, Attribute& attr) const
37 {
38 auto const& skipper = x3::get<skipper_tag>(context);
39
40 typedef unused_skipper<
41 typename remove_reference<decltype(skipper)>::type>
42 unused_skipper_type;
43 unused_skipper_type unused_skipper(skipper);
44
45 return this->subject.parse(
46 first, last
47 , make_context<skipper_tag>(unused_skipper, context)
48 , rcontext
49 , attr);
50 }
51 template <typename Iterator, typename Context
52 , typename RContext, typename Attribute>
53 typename disable_if<has_skipper<Context>, bool>::type
54 parse(Iterator& first, Iterator const& last
55 , Context const& context, RContext& rcontext, Attribute& attr) const
56 {
57 return this->subject.parse(
58 first, last
59 , context
60 , rcontext
61 , attr);
62 }
63 };
64
65 struct no_skip_gen
66 {
67 template <typename Subject>
68 no_skip_directive<typename extension::as_parser<Subject>::value_type>
69 operator[](Subject const& subject) const
70 {
71 return { as_parser(subject) };
72 }
73 };
74
75 auto const no_skip = no_skip_gen{};
76 }}}
77
78 #endif