safe
[ghsmtp.git] / UTF8.hpp
blobc22bc87dda28cf3340281e10d984a43d43d98f85
1 #ifndef UTF8_DOT_HPP
2 #define UTF8_DOT_HPP
4 // clang-format off
6 struct UTF8_tail : range<'\x80', '\xBF'> {};
8 struct UTF8_1 : range<'\x00', '\x7F'> {};
10 struct UTF8_2 : seq<range<'\xC2', '\xDF'>, UTF8_tail> {};
12 struct UTF8_3 : sor<seq<one<'\xE0'>, range<'\xA0', '\xBF'>, UTF8_tail>,
13 seq<range<'\xE1', '\xEC'>, rep<2, UTF8_tail>>,
14 seq<one<'\xED'>, range<'\x80', '\x9F'>, UTF8_tail>,
15 seq<range<'\xEE', '\xEF'>, rep<2, UTF8_tail>>> {};
17 struct UTF8_4 : sor<seq<one<'\xF0'>, range<'\x90', '\xBF'>, rep<2, UTF8_tail>>,
18 seq<range<'\xF1', '\xF3'>, rep<3, UTF8_tail>>,
19 seq<one<'\xF4'>, range<'\x80', '\x8F'>, rep<2, UTF8_tail>>> {};
21 struct UTF8_non_ascii : sor<UTF8_2, UTF8_3, UTF8_4> {};
23 struct VUCHAR : sor<VCHAR, UTF8_non_ascii> {};
25 // clang-format on
27 #endif // UTF8_DOT_HPP