File indexing completed on 2025-09-17 08:51:25
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_SPIRIT_X3_NOT_PREDICATE_MARCH_23_2007_0618PM)
0010 #define BOOST_SPIRIT_X3_NOT_PREDICATE_MARCH_23_2007_0618PM
0011
0012 #include <boost/spirit/home/x3/core/parser.hpp>
0013 #include <boost/spirit/home/x3/support/expectation.hpp>
0014
0015 namespace boost { namespace spirit { namespace x3
0016 {
0017 template <typename Subject>
0018 struct not_predicate : unary_parser<Subject, not_predicate<Subject>>
0019 {
0020 typedef unary_parser<Subject, not_predicate<Subject>> base_type;
0021
0022 typedef unused_type attribute_type;
0023 static bool const has_attribute = false;
0024
0025 constexpr not_predicate(Subject const& subject)
0026 : base_type(subject) {}
0027
0028 template <typename Iterator, typename Context
0029 , typename RContext, typename Attribute>
0030 bool parse(Iterator& first, Iterator const& last
0031 , Context const& context, RContext& rcontext, Attribute& ) const
0032 {
0033 Iterator i = first;
0034 return !this->subject.parse(i, last, context, rcontext, unused)
0035 && !has_expectation_failure(context);
0036 }
0037 };
0038
0039 template <typename Subject>
0040 constexpr not_predicate<typename extension::as_parser<Subject>::value_type>
0041 operator!(Subject const& subject)
0042 {
0043 return { as_parser(subject) };
0044 }
0045 }}}
0046
0047 #endif