Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:46

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003     Copyright (c) 2001-2011 Hartmut Kaiser
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 =============================================================================*/
0008 #ifndef BOOST_SPIRIT_QI_OPERATOR_EXPECT_HPP
0009 #define BOOST_SPIRIT_QI_OPERATOR_EXPECT_HPP
0010 
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014 
0015 #include <boost/spirit/home/qi/operator/sequence_base.hpp>
0016 #include <boost/spirit/home/qi/detail/expect_function.hpp>
0017 #include <boost/spirit/home/qi/detail/expectation_failure.hpp>
0018 #include <boost/spirit/home/qi/meta_compiler.hpp>
0019 #include <boost/spirit/home/support/has_semantic_action.hpp>
0020 #include <boost/spirit/home/support/handles_container.hpp>
0021 #include <boost/spirit/home/support/info.hpp>
0022 #include <boost/proto/operators.hpp>
0023 #include <boost/proto/tags.hpp>
0024 
0025 namespace boost { namespace spirit
0026 {
0027     ///////////////////////////////////////////////////////////////////////////
0028     // Enablers
0029     ///////////////////////////////////////////////////////////////////////////
0030     template <>
0031     struct use_operator<qi::domain, proto::tag::greater> // enables >
0032       : mpl::true_ {};
0033 
0034     template <>
0035     struct flatten_tree<qi::domain, proto::tag::greater> // flattens >
0036       : mpl::true_ {};
0037 }}
0038 
0039 namespace boost { namespace spirit { namespace qi
0040 {
0041     template <typename Elements>
0042     struct expect_operator : sequence_base<expect_operator<Elements>, Elements>
0043     {
0044         friend struct sequence_base<expect_operator<Elements>, Elements>;
0045 
0046         expect_operator(Elements const& elements)
0047           : sequence_base<expect_operator<Elements>, Elements>(elements) {}
0048 
0049     private:
0050 
0051         template <typename Iterator, typename Context, typename Skipper>
0052         static detail::expect_function<
0053             Iterator, Context, Skipper
0054           , expectation_failure<Iterator> >
0055         fail_function(
0056             Iterator& first, Iterator const& last
0057           , Context& context, Skipper const& skipper)
0058         {
0059             return detail::expect_function<
0060                 Iterator, Context, Skipper, expectation_failure<Iterator> >
0061                 (first, last, context, skipper);
0062         }
0063 
0064         std::string id() const { return "expect_operator"; }
0065     };
0066 
0067     ///////////////////////////////////////////////////////////////////////////
0068     // Parser generators: make_xxx function (objects)
0069     ///////////////////////////////////////////////////////////////////////////
0070     template <typename Elements, typename Modifiers>
0071     struct make_composite<proto::tag::greater, Elements, Modifiers>
0072       : make_nary_composite<Elements, expect_operator>
0073     {};
0074 }}}
0075 
0076 namespace boost { namespace spirit { namespace traits
0077 {
0078     ///////////////////////////////////////////////////////////////////////////
0079     template <typename Elements>
0080     struct has_semantic_action<qi::expect_operator<Elements> >
0081       : nary_has_semantic_action<Elements> {};
0082 
0083     ///////////////////////////////////////////////////////////////////////////
0084     template <typename Elements, typename Attribute, typename Context
0085       , typename Iterator>
0086     struct handles_container<qi::expect_operator<Elements>, Attribute, Context
0087           , Iterator>
0088       : mpl::true_ {};
0089 }}}
0090 
0091 #endif