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#ifndef BOOST_SPIRIT_QI_OPERATOR_EXPECT_HPP
9#define BOOST_SPIRIT_QI_OPERATOR_EXPECT_HPP
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/detail/expectation_failure.hpp>
18#include <boost/spirit/home/qi/meta_compiler.hpp>
19#include <boost/spirit/home/support/has_semantic_action.hpp>
20#include <boost/spirit/home/support/handles_container.hpp>
21#include <boost/spirit/home/support/info.hpp>
22#include <boost/proto/operators.hpp>
23#include <boost/proto/tags.hpp>
24
25namespace boost { namespace spirit
26{
27 ///////////////////////////////////////////////////////////////////////////
28 // Enablers
29 ///////////////////////////////////////////////////////////////////////////
30 template <>
31 struct use_operator<qi::domain, proto::tag::greater> // enables >
32 : mpl::true_ {};
33
34 template <>
35 struct flatten_tree<qi::domain, proto::tag::greater> // flattens >
36 : mpl::true_ {};
37}}
38
39namespace boost { namespace spirit { namespace qi
40{
41 template <typename Elements>
42 struct expect_operator : sequence_base<expect_operator<Elements>, Elements>
43 {
44 friend struct sequence_base<expect_operator<Elements>, Elements>;
45
46 expect_operator(Elements const& elements)
47 : sequence_base<expect_operator<Elements>, Elements>(elements) {}
48
49 private:
50
51 template <typename Iterator, typename Context, typename Skipper>
52 static detail::expect_function<
53 Iterator, Context, Skipper
54 , expectation_failure<Iterator> >
55 fail_function(
56 Iterator& first, Iterator const& last
57 , Context& context, Skipper const& skipper)
58 {
59 return detail::expect_function<
60 Iterator, Context, Skipper, expectation_failure<Iterator> >
61 (first, last, context, skipper);
62 }
63
64 std::string id() const { return "expect_operator"; }
65 };
66
67 ///////////////////////////////////////////////////////////////////////////
68 // Parser generators: make_xxx function (objects)
69 ///////////////////////////////////////////////////////////////////////////
70 template <typename Elements, typename Modifiers>
71 struct make_composite<proto::tag::greater, Elements, Modifiers>
72 : make_nary_composite<Elements, expect_operator>
73 {};
74}}}
75
76namespace boost { namespace spirit { namespace traits
77{
78 ///////////////////////////////////////////////////////////////////////////
79 template <typename Elements>
80 struct has_semantic_action<qi::expect_operator<Elements> >
81 : nary_has_semantic_action<Elements> {};
82
83 ///////////////////////////////////////////////////////////////////////////
84 template <typename Elements, typename Attribute, typename Context
85 , typename Iterator>
86 struct handles_container<qi::expect_operator<Elements>, Attribute, Context
87 , Iterator>
88 : mpl::true_ {};
89}}}
90
91#endif
92

source code of boost/libs/spirit/include/boost/spirit/home/qi/operator/expect.hpp