Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/qi/directive/no_skip.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2001-2011 Joel de Guzman | |
3 Copyright (c) 2001-2011 Hartmut Kaiser | |
4 | |
5 Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 =============================================================================*/ | |
8 #if !defined(SPIRIT_NO_SKIP_JAN_16_2010_0802PM) | |
9 #define SPIRIT_NO_SKIP_JAN_16_2010_0802PM | |
10 | |
11 #if defined(_MSC_VER) | |
12 #pragma once | |
13 #endif | |
14 | |
15 #include <boost/spirit/home/qi/meta_compiler.hpp> | |
16 #include <boost/spirit/home/qi/skip_over.hpp> | |
17 #include <boost/spirit/home/qi/parser.hpp> | |
18 #include <boost/spirit/home/qi/detail/unused_skipper.hpp> | |
19 #include <boost/spirit/home/support/unused.hpp> | |
20 #include <boost/spirit/home/support/common_terminals.hpp> | |
21 #include <boost/spirit/home/support/attributes.hpp> | |
22 #include <boost/spirit/home/support/info.hpp> | |
23 #include <boost/spirit/home/support/has_semantic_action.hpp> | |
24 #include <boost/spirit/home/support/handles_container.hpp> | |
25 | |
26 namespace boost { namespace spirit | |
27 { | |
28 /////////////////////////////////////////////////////////////////////////// | |
29 // Enablers | |
30 /////////////////////////////////////////////////////////////////////////// | |
31 template <> | |
32 struct use_directive<qi::domain, tag::no_skip> // enables no_skip | |
33 : mpl::true_ {}; | |
34 }} | |
35 | |
36 namespace boost { namespace spirit { namespace qi | |
37 { | |
38 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS | |
39 using spirit::no_skip; | |
40 #endif | |
41 using spirit::no_skip_type; | |
42 | |
43 // same as lexeme[], but does not pre-skip | |
44 template <typename Subject> | |
45 struct no_skip_directive : unary_parser<no_skip_directive<Subject> > | |
46 { | |
47 typedef Subject subject_type; | |
48 no_skip_directive(Subject const& subject_) | |
49 : subject(subject_) {} | |
50 | |
51 template <typename Context, typename Iterator> | |
52 struct attribute | |
53 { | |
54 typedef typename | |
55 traits::attribute_of<subject_type, Context, Iterator>::type | |
56 type; | |
57 }; | |
58 | |
59 template <typename Iterator, typename Context | |
60 , typename Skipper, typename Attribute> | |
61 bool parse(Iterator& first, Iterator const& last | |
62 , Context& context, Skipper const& skipper | |
63 , Attribute& attr_) const | |
64 { | |
65 return subject.parse(first, last, context | |
66 , detail::unused_skipper<Skipper>(skipper), attr_); | |
67 } | |
68 | |
69 template <typename Context> | |
70 info what(Context& context) const | |
71 { | |
72 return info("no_skip", subject.what(context)); | |
73 | |
74 } | |
75 | |
76 Subject subject; | |
77 }; | |
78 | |
79 /////////////////////////////////////////////////////////////////////////// | |
80 // Parser generators: make_xxx function (objects) | |
81 /////////////////////////////////////////////////////////////////////////// | |
82 template <typename Subject, typename Modifiers> | |
83 struct make_directive<tag::no_skip, Subject, Modifiers> | |
84 { | |
85 typedef no_skip_directive<Subject> result_type; | |
86 result_type operator()(unused_type, Subject const& subject, unused_type) const | |
87 { | |
88 return result_type(subject); | |
89 } | |
90 }; | |
91 }}} | |
92 | |
93 namespace boost { namespace spirit { namespace traits | |
94 { | |
95 /////////////////////////////////////////////////////////////////////////// | |
96 template <typename Subject> | |
97 struct has_semantic_action<qi::no_skip_directive<Subject> > | |
98 : unary_has_semantic_action<Subject> {}; | |
99 | |
100 /////////////////////////////////////////////////////////////////////////// | |
101 template <typename Subject, typename Attribute, typename Context | |
102 , typename Iterator> | |
103 struct handles_container<qi::no_skip_directive<Subject>, Attribute | |
104 , Context, Iterator> | |
105 : unary_handles_container<Subject, Attribute, Context, Iterator> {}; | |
106 }}} | |
107 | |
108 #endif |