Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/qi/operator/expect.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
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_EXPECT_APRIL_29_2007_0445PM) | |
9 #define SPIRIT_EXPECT_APRIL_29_2007_0445PM | |
10 | |
11 #if defined(_MSC_VER) | |
12 #pragma once | |
13 #endif | |
14 | |
15 #include <boost/spirit/home/qi/operator/sequence_base.hpp> | |
16 #include <boost/spirit/home/qi/detail/expect_function.hpp> | |
17 #include <boost/spirit/home/qi/meta_compiler.hpp> | |
18 #include <boost/spirit/home/support/has_semantic_action.hpp> | |
19 #include <boost/spirit/home/support/handles_container.hpp> | |
20 #include <boost/spirit/home/support/info.hpp> | |
21 #include <stdexcept> | |
22 | |
23 namespace boost { namespace spirit | |
24 { | |
25 /////////////////////////////////////////////////////////////////////////// | |
26 // Enablers | |
27 /////////////////////////////////////////////////////////////////////////// | |
28 template <> | |
29 struct use_operator<qi::domain, proto::tag::greater> // enables > | |
30 : mpl::true_ {}; | |
31 | |
32 template <> | |
33 struct flatten_tree<qi::domain, proto::tag::greater> // flattens > | |
34 : mpl::true_ {}; | |
35 }} | |
36 | |
37 namespace boost { namespace spirit { namespace qi | |
38 { | |
39 template <typename Iterator> | |
40 struct expectation_failure : std::runtime_error | |
41 { | |
42 expectation_failure(Iterator first_, Iterator last_, info const& what) | |
43 : std::runtime_error("boost::spirit::qi::expectation_failure") | |
44 , first(first_), last(last_), what_(what) | |
45 {} | |
46 ~expectation_failure() throw() {} | |
47 | |
48 Iterator first; | |
49 Iterator last; | |
50 info what_; | |
51 }; | |
52 | |
53 template <typename Elements> | |
54 struct expect : sequence_base<expect<Elements>, Elements> | |
55 { | |
56 friend struct sequence_base<expect<Elements>, Elements>; | |
57 | |
58 expect(Elements const& elements) | |
59 : sequence_base<expect<Elements>, Elements>(elements) {} | |
60 | |
61 private: | |
62 | |
63 template <typename Iterator, typename Context, typename Skipper> | |
64 static detail::expect_function< | |
65 Iterator, Context, Skipper | |
66 , expectation_failure<Iterator> > | |
67 fail_function( | |
68 Iterator& first, Iterator const& last | |
69 , Context& context, Skipper const& skipper) | |
70 { | |
71 return detail::expect_function< | |
72 Iterator, Context, Skipper, expectation_failure<Iterator> > | |
73 (first, last, context, skipper); | |
74 } | |
75 | |
76 std::string id() const { return "expect"; } | |
77 }; | |
78 | |
79 /////////////////////////////////////////////////////////////////////////// | |
80 // Parser generators: make_xxx function (objects) | |
81 /////////////////////////////////////////////////////////////////////////// | |
82 template <typename Elements, typename Modifiers> | |
83 struct make_composite<proto::tag::greater, Elements, Modifiers> | |
84 : make_nary_composite<Elements, expect> | |
85 {}; | |
86 }}} | |
87 | |
88 namespace boost { namespace spirit { namespace traits | |
89 { | |
90 /////////////////////////////////////////////////////////////////////////// | |
91 template <typename Elements> | |
92 struct has_semantic_action<qi::expect<Elements> > | |
93 : nary_has_semantic_action<Elements> {}; | |
94 | |
95 /////////////////////////////////////////////////////////////////////////// | |
96 template <typename Elements, typename Attribute, typename Context | |
97 , typename Iterator> | |
98 struct handles_container<qi::expect<Elements>, Attribute, Context | |
99 , Iterator> | |
100 : mpl::true_ {}; | |
101 }}} | |
102 | |
103 #endif |