1 /*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(BOOST_SPIRIT_X3_ANY_CHAR_APRIL_16_2006_1051AM)
8 #define BOOST_SPIRIT_X3_ANY_CHAR_APRIL_16_2006_1051AM
10 #include <boost/type_traits/extent.hpp>
11 #include <boost/spirit/home/x3/char/literal_char.hpp>
12 #include <boost/spirit/home/x3/char/char_set.hpp>
14 namespace boost { namespace spirit { namespace x3
16 template <typename Encoding>
17 struct any_char : char_parser<any_char<Encoding>>
19 typedef typename Encoding::char_type char_type;
20 typedef Encoding encoding;
21 typedef char_type attribute_type;
22 static bool const has_attribute = true;
24 template <typename Char, typename Context>
25 bool test(Char ch_, Context const&) const
27 return ((sizeof(Char) <= sizeof(char_type)) || encoding::ischar(ch_));
30 template <typename Char>
31 literal_char<Encoding> operator()(Char ch) const
36 template <typename Char>
37 literal_char<Encoding> operator()(const Char (&ch)[2]) const
42 template <typename Char, std::size_t N>
43 char_set<Encoding> operator()(const Char (&ch)[N]) const
48 template <typename Char>
49 char_range<Encoding> operator()(Char from, Char to) const
54 template <typename Char>
55 char_range<Encoding> operator()(Char (&from)[2], Char (&to)[2]) const
57 return { static_cast<char_type>(from[0]), static_cast<char_type>(to[0]) };
60 template <typename Char>
61 char_set<Encoding> operator()(std::basic_string<Char> const& s) const