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 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 =============================================================================*/
0007 #ifndef BOOST_SPIRIT_QI_OPERATOR_AND_PREDICATE_HPP
0008 #define BOOST_SPIRIT_QI_OPERATOR_AND_PREDICATE_HPP
0009 
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013 
0014 #include <boost/spirit/home/qi/domain.hpp>
0015 #include <boost/spirit/home/qi/meta_compiler.hpp>
0016 #include <boost/spirit/home/qi/parser.hpp>
0017 #include <boost/spirit/home/qi/detail/attributes.hpp>
0018 #include <boost/spirit/home/support/info.hpp>
0019 #include <boost/spirit/home/support/has_semantic_action.hpp>
0020 #include <boost/spirit/home/support/handles_container.hpp>
0021 #include <boost/fusion/include/at.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::address_of> // enables &p
0032       : mpl::true_ {};
0033 }}
0034 
0035 namespace boost { namespace spirit { namespace qi
0036 {
0037     template <typename Subject>
0038     struct and_predicate : unary_parser<and_predicate<Subject> >
0039     {
0040         typedef Subject subject_type;
0041 
0042         template <typename Context, typename Iterator>
0043         struct attribute
0044         {
0045             typedef unused_type type;
0046         };
0047 
0048         and_predicate(Subject const& subject_)
0049           : subject(subject_) {}
0050 
0051         template <typename Iterator, typename Context
0052           , typename Skipper, typename Attribute>
0053         bool parse(Iterator& first, Iterator const& last
0054           , Context& context, Skipper const& skipper
0055           , Attribute& /*attr*/) const
0056         {
0057             Iterator i = first;
0058             return subject.parse(i, last, context, skipper, unused);
0059         }
0060 
0061         template <typename Context>
0062         info what(Context& context) const
0063         {
0064             return info("and-predicate", subject.what(context));
0065         }
0066 
0067         Subject subject;
0068     };
0069 
0070     ///////////////////////////////////////////////////////////////////////////
0071     // Parser generators: make_xxx function (objects)
0072     ///////////////////////////////////////////////////////////////////////////
0073     template <typename Elements, typename Modifiers>
0074     struct make_composite<proto::tag::address_of, Elements, Modifiers>
0075       : make_unary_composite<Elements, and_predicate>
0076     {};
0077 }}}
0078 
0079 namespace boost { namespace spirit { namespace traits
0080 {
0081     ///////////////////////////////////////////////////////////////////////////
0082     template <typename Subject>
0083     struct has_semantic_action<qi::and_predicate<Subject> >
0084       : unary_has_semantic_action<Subject> {};
0085 
0086     ///////////////////////////////////////////////////////////////////////////
0087     template <typename Subject, typename Attribute, typename Context
0088       , typename Iterator>
0089     struct handles_container<qi::and_predicate<Subject>, Attribute, Context
0090       , Iterator>
0091       : unary_handles_container<Subject, Attribute, Context, Iterator> {};
0092 }}}
0093 
0094 #endif