Chris@102
|
1 /*=============================================================================
|
Chris@102
|
2 Copyright (c) 2001-2014 Joel de Guzman
|
Chris@102
|
3
|
Chris@102
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@102
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
6 =============================================================================*/
|
Chris@102
|
7 #if !defined(SPIRIT_OMIT_MARCH_24_2007_0802AM)
|
Chris@102
|
8 #define SPIRIT_OMIT_MARCH_24_2007_0802AM
|
Chris@102
|
9
|
Chris@102
|
10 #if defined(_MSC_VER)
|
Chris@102
|
11 #pragma once
|
Chris@102
|
12 #endif
|
Chris@102
|
13
|
Chris@102
|
14 #include <boost/spirit/home/x3/support/unused.hpp>
|
Chris@102
|
15 #include <boost/spirit/home/x3/core/parser.hpp>
|
Chris@102
|
16
|
Chris@102
|
17 namespace boost { namespace spirit { namespace x3
|
Chris@102
|
18 {
|
Chris@102
|
19 ///////////////////////////////////////////////////////////////////////////
|
Chris@102
|
20 // omit_directive forces the attribute of subject parser
|
Chris@102
|
21 // to be unused_type
|
Chris@102
|
22 ///////////////////////////////////////////////////////////////////////////
|
Chris@102
|
23 template <typename Subject>
|
Chris@102
|
24 struct omit_directive : unary_parser<Subject, omit_directive<Subject>>
|
Chris@102
|
25 {
|
Chris@102
|
26 typedef unary_parser<Subject, omit_directive<Subject> > base_type;
|
Chris@102
|
27 typedef unused_type attribute_type;
|
Chris@102
|
28 static bool const has_attribute = false;
|
Chris@102
|
29
|
Chris@102
|
30 typedef Subject subject_type;
|
Chris@102
|
31 omit_directive(Subject const& subject)
|
Chris@102
|
32 : base_type(subject) {}
|
Chris@102
|
33
|
Chris@102
|
34 template <typename Iterator, typename Context, typename RContext>
|
Chris@102
|
35 bool parse(Iterator& first, Iterator const& last
|
Chris@102
|
36 , Context const& context, RContext& rcontext, unused_type) const
|
Chris@102
|
37 {
|
Chris@102
|
38 return this->subject.parse(first, last, context, rcontext, unused);
|
Chris@102
|
39 }
|
Chris@102
|
40 };
|
Chris@102
|
41
|
Chris@102
|
42 struct omit_gen
|
Chris@102
|
43 {
|
Chris@102
|
44 template <typename Subject>
|
Chris@102
|
45 omit_directive<typename extension::as_parser<Subject>::value_type>
|
Chris@102
|
46 operator[](Subject const& subject) const
|
Chris@102
|
47 {
|
Chris@102
|
48 return {as_parser(subject)};
|
Chris@102
|
49 }
|
Chris@102
|
50 };
|
Chris@102
|
51
|
Chris@102
|
52 omit_gen const omit = omit_gen();
|
Chris@102
|
53 }}}
|
Chris@102
|
54
|
Chris@102
|
55 #endif
|