File indexing completed on 2025-02-27 09:55:37
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_X3_ANY_CHAR_APRIL_16_2006_1051AM)
0008 #define BOOST_SPIRIT_X3_ANY_CHAR_APRIL_16_2006_1051AM
0009
0010 #include <boost/type_traits/extent.hpp>
0011 #include <boost/spirit/home/x3/char/literal_char.hpp>
0012 #include <boost/spirit/home/x3/char/char_set.hpp>
0013
0014 namespace boost { namespace spirit { namespace x3
0015 {
0016 template <typename Encoding>
0017 struct any_char : char_parser<any_char<Encoding>>
0018 {
0019 typedef typename Encoding::char_type char_type;
0020 typedef Encoding encoding;
0021 typedef char_type attribute_type;
0022 static bool const has_attribute = true;
0023
0024 template <typename Char, typename Context>
0025 bool test(Char ch_, Context const&) const
0026 {
0027 return encoding::ischar(ch_);
0028 }
0029
0030 template <typename Char>
0031 constexpr literal_char<Encoding> operator()(Char ch) const
0032 {
0033 return { ch };
0034 }
0035
0036 template <typename Char>
0037 constexpr literal_char<Encoding> operator()(const Char (&ch)[2]) const
0038 {
0039 return { ch[0] };
0040 }
0041
0042 template <typename Char, std::size_t N>
0043 constexpr char_set<Encoding> operator()(const Char (&ch)[N]) const
0044 {
0045 return { ch };
0046 }
0047
0048 template <typename Char>
0049 constexpr char_range<Encoding> operator()(Char from, Char to) const
0050 {
0051 return { from, to };
0052 }
0053
0054 template <typename Char>
0055 constexpr char_range<Encoding> operator()(Char (&from)[2], Char (&to)[2]) const
0056 {
0057 return { static_cast<char_type>(from[0]), static_cast<char_type>(to[0]) };
0058 }
0059
0060 template <typename Char>
0061 char_set<Encoding> operator()(std::basic_string<Char> const& s) const
0062 {
0063 return { s };
0064 }
0065 };
0066 }}}
0067
0068 #endif