Chris@102
|
1 /*=============================================================================
|
Chris@102
|
2 Copyright (c) 2001-2014 Joel de Guzman
|
Chris@102
|
3
|
Chris@102
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@102
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
6 ==============================================================================*/
|
Chris@102
|
7 #if !defined(BOOST_SPIRIT_X3_CHAR_APRIL_16_2006_1051AM)
|
Chris@102
|
8 #define BOOST_SPIRIT_X3_CHAR_APRIL_16_2006_1051AM
|
Chris@102
|
9
|
Chris@102
|
10 #if defined(_MSC_VER)
|
Chris@102
|
11 #pragma once
|
Chris@102
|
12 #endif
|
Chris@102
|
13
|
Chris@102
|
14 #include <boost/spirit/home/x3/char/any_char.hpp>
|
Chris@102
|
15 #include <boost/spirit/home/support/char_encoding/ascii.hpp>
|
Chris@102
|
16 #include <boost/spirit/home/support/char_encoding/standard.hpp>
|
Chris@102
|
17 #include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
|
Chris@102
|
18
|
Chris@102
|
19 namespace boost { namespace spirit { namespace x3
|
Chris@102
|
20 {
|
Chris@102
|
21 namespace standard
|
Chris@102
|
22 {
|
Chris@102
|
23 typedef any_char<char_encoding::standard> char_type;
|
Chris@102
|
24 char_type const char_ = char_type();
|
Chris@102
|
25 }
|
Chris@102
|
26
|
Chris@102
|
27 using standard::char_type;
|
Chris@102
|
28 using standard::char_;
|
Chris@102
|
29
|
Chris@102
|
30 namespace standard_wide
|
Chris@102
|
31 {
|
Chris@102
|
32 typedef any_char<char_encoding::standard_wide> char_type;
|
Chris@102
|
33 char_type const char_ = char_type();
|
Chris@102
|
34 }
|
Chris@102
|
35
|
Chris@102
|
36 namespace ascii
|
Chris@102
|
37 {
|
Chris@102
|
38 typedef any_char<char_encoding::ascii> char_type;
|
Chris@102
|
39 char_type const char_ = char_type();
|
Chris@102
|
40 }
|
Chris@102
|
41
|
Chris@102
|
42 namespace extension
|
Chris@102
|
43 {
|
Chris@102
|
44 template <>
|
Chris@102
|
45 struct as_parser<char>
|
Chris@102
|
46 {
|
Chris@102
|
47 typedef literal_char<
|
Chris@102
|
48 char_encoding::standard, unused_type>
|
Chris@102
|
49 type;
|
Chris@102
|
50
|
Chris@102
|
51 typedef type value_type;
|
Chris@102
|
52
|
Chris@102
|
53 static type call(char ch)
|
Chris@102
|
54 {
|
Chris@102
|
55 return type(ch);
|
Chris@102
|
56 }
|
Chris@102
|
57 };
|
Chris@102
|
58
|
Chris@102
|
59 template <>
|
Chris@102
|
60 struct as_parser<wchar_t>
|
Chris@102
|
61 {
|
Chris@102
|
62 typedef literal_char<
|
Chris@102
|
63 char_encoding::standard_wide, unused_type>
|
Chris@102
|
64 type;
|
Chris@102
|
65
|
Chris@102
|
66 typedef type value_type;
|
Chris@102
|
67
|
Chris@102
|
68 static type call(wchar_t ch)
|
Chris@102
|
69 {
|
Chris@102
|
70 return type(ch);
|
Chris@102
|
71 }
|
Chris@102
|
72 };
|
Chris@102
|
73 }
|
Chris@102
|
74
|
Chris@102
|
75 inline literal_char<char_encoding::standard, unused_type>
|
Chris@102
|
76 lit(char ch)
|
Chris@102
|
77 {
|
Chris@102
|
78 return literal_char<char_encoding::standard, unused_type>(ch);
|
Chris@102
|
79 }
|
Chris@102
|
80
|
Chris@102
|
81 inline literal_char<char_encoding::standard_wide, unused_type>
|
Chris@102
|
82 lit(wchar_t ch)
|
Chris@102
|
83 {
|
Chris@102
|
84 return literal_char<char_encoding::standard_wide, unused_type>(ch);
|
Chris@102
|
85 }
|
Chris@102
|
86 }}}
|
Chris@102
|
87
|
Chris@102
|
88 #endif
|