Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/spirit/home/qi/operator/not_predicate.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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_NOT_PREDICATE_HPP
0008 #define BOOST_SPIRIT_QI_OPERATOR_NOT_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/has_semantic_action.hpp>
0019 #include <boost/spirit/home/support/handles_container.hpp>
0020 #include <boost/spirit/home/support/info.hpp>
0021 #include <boost/proto/operators.hpp>
0022 #include <boost/proto/tags.hpp>
0023 
0024 namespace boost { namespace spirit
0025 {
0026     ///////////////////////////////////////////////////////////////////////////
0027     // Enablers
0028     ///////////////////////////////////////////////////////////////////////////
0029     template <>
0030     struct use_operator<qi::domain, proto::tag::logical_not> // enables !p
0031       : mpl::true_ {};
0032 }}
0033 
0034 namespace boost { namespace spirit { namespace qi
0035 {
0036     template <typename Subject>
0037     struct not_predicate : unary_parser<not_predicate<Subject> >
0038     {
0039         typedef Subject subject_type;
0040 
0041         template <typename Context, typename Iterator>
0042         struct attribute
0043         {
0044             typedef unused_type type;
0045         };
0046 
0047         not_predicate(Subject const& subject_)
0048           : subject(subject_) {}
0049 
0050         template <typename Iterator, typename Context
0051           , typename Skipper, typename Attribute>
0052         bool parse(Iterator& first, Iterator const& last
0053           , Context& context, Skipper const& skipper
0054           , Attribute& /*attr*/) const
0055         {
0056             Iterator i = first;
0057             return !subject.parse(i, last, context, skipper, unused);
0058         }
0059 
0060         template <typename Context>
0061         info what(Context& context) const
0062         {
0063             return info("not-predicate", subject.what(context));
0064         }
0065 
0066         Subject subject;
0067     };
0068 
0069     ///////////////////////////////////////////////////////////////////////////
0070     // Parser generators: make_xxx function (objects)
0071     ///////////////////////////////////////////////////////////////////////////
0072     template <typename Elements, typename Modifiers>
0073     struct make_composite<proto::tag::logical_not, Elements, Modifiers>
0074       : make_unary_composite<Elements, not_predicate>
0075     {};
0076 }}}
0077 
0078 namespace boost { namespace spirit { namespace traits
0079 {
0080     ///////////////////////////////////////////////////////////////////////////
0081     template <typename Subject>
0082     struct has_semantic_action<qi::not_predicate<Subject> >
0083       : unary_has_semantic_action<Subject> {};
0084 
0085     ///////////////////////////////////////////////////////////////////////////
0086     template <typename Subject, typename Attribute, typename Context
0087         , typename Iterator>
0088     struct handles_container<qi::not_predicate<Subject>, Attribute
0089         , Context, Iterator>
0090       : unary_handles_container<Subject, Attribute, Context, Iterator> {};
0091 }}}
0092 
0093 #endif