]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2014 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_OMIT_MARCH_24_2007_0802AM) | |
8 | #define SPIRIT_OMIT_MARCH_24_2007_0802AM | |
9 | ||
10 | #include <boost/spirit/home/x3/support/unused.hpp> | |
11 | #include <boost/spirit/home/x3/core/parser.hpp> | |
12 | ||
13 | namespace boost { namespace spirit { namespace x3 | |
14 | { | |
15 | /////////////////////////////////////////////////////////////////////////// | |
16 | // omit_directive forces the attribute of subject parser | |
17 | // to be unused_type | |
18 | /////////////////////////////////////////////////////////////////////////// | |
19 | template <typename Subject> | |
20 | struct omit_directive : unary_parser<Subject, omit_directive<Subject>> | |
21 | { | |
22 | typedef unary_parser<Subject, omit_directive<Subject> > base_type; | |
23 | typedef unused_type attribute_type; | |
24 | static bool const has_attribute = false; | |
25 | ||
26 | typedef Subject subject_type; | |
27 | omit_directive(Subject const& subject) | |
28 | : base_type(subject) {} | |
29 | ||
30 | template <typename Iterator, typename Context, typename RContext> | |
31 | bool parse(Iterator& first, Iterator const& last | |
32 | , Context const& context, RContext& rcontext, unused_type) const | |
33 | { | |
34 | return this->subject.parse(first, last, context, rcontext, unused); | |
35 | } | |
36 | }; | |
37 | ||
38 | struct omit_gen | |
39 | { | |
40 | template <typename Subject> | |
41 | omit_directive<typename extension::as_parser<Subject>::value_type> | |
42 | operator[](Subject const& subject) const | |
43 | { | |
44 | return { as_parser(subject) }; | |
45 | } | |
46 | }; | |
47 | ||
48 | auto const omit = omit_gen{}; | |
49 | }}} | |
50 | ||
51 | #endif |