File indexing completed on 2025-01-31 10:02:34
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_X3_NEGATED_CHAR_PARSER_APR_16_2006_0906AM)
0008 #define BOOST_SPIRIT_X3_NEGATED_CHAR_PARSER_APR_16_2006_0906AM
0009
0010 #include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
0011 #include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
0012 #include <boost/spirit/home/x3/char/char_parser.hpp>
0013
0014 namespace boost { namespace spirit { namespace x3
0015 {
0016
0017
0018
0019 template <typename Positive>
0020 struct negated_char_parser :
0021 char_parser<negated_char_parser<Positive>>
0022 {
0023 constexpr negated_char_parser(Positive const& positive)
0024 : positive(positive) {}
0025
0026 template <typename CharParam, typename Context>
0027 bool test(CharParam ch, Context const& context) const
0028 {
0029 return !positive.test(ch, context);
0030 }
0031
0032 Positive positive;
0033 };
0034
0035 template <typename Positive>
0036 constexpr negated_char_parser<Positive>
0037 operator~(char_parser<Positive> const& cp)
0038 {
0039 return { cp.derived() };
0040 }
0041
0042 template <typename Positive>
0043 constexpr Positive const&
0044 operator~(negated_char_parser<Positive> const& cp)
0045 {
0046 return cp.positive;
0047 }
0048 }}}
0049
0050 namespace boost { namespace spirit { namespace x3 { namespace traits
0051 {
0052 template <typename Positive, typename Context>
0053 struct attribute_of<x3::negated_char_parser<Positive>, Context>
0054 : attribute_of<Positive, Context> {};
0055
0056 template <typename Positive, typename Context>
0057 struct has_attribute<x3::negated_char_parser<Positive>, Context>
0058 : has_attribute<Positive, Context> {};
0059 }}}}
0060
0061 #endif