12 for(std::size_t i=0;i<str.size();i++) {
15 if(
'a' <= ch && ch <=
'f')
16 digit = ch -
'a' + 10;
17 else if(
'A' <= ch && ch <=
'F')
18 digit = ch -
'A' + 10;
19 else if(
'0' <= ch && ch <=
'9')
24 value = (value << 4) + digit;
42 for(
int i=0;i<codeLength;i++)
49 if((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
50 std::stringstream msg;
58 else if(value <= 0x7FF)
59 return Str(0xC0 + (value >> 6)) +
Str(0x80 + (value & 0x3F));
60 else if(value <= 0xFFFF)
61 return Str(0xE0 + (value >> 12)) +
Str(0x80 + ((value >> 6) & 0x3F)) +
Str(0x80 + (value & 0x3F));
63 return Str(0xF0 + (value >> 18)) +
Str(0x80 + ((value >> 12) & 0x3F)) +
64 Str(0x80 + ((value >> 6) & 0x3F)) +
Str(0x80 + (value & 0x3F));
74 char escape = in.
get();
80 if(escape ==
'\'' && ch ==
'\'')
86 case 'a':
return "\x07";
87 case 'b':
return "\x08";
89 case '\t':
return "\x09";
90 case 'n':
return "\x0A";
91 case 'v':
return "\x0B";
92 case 'f':
return "\x0C";
93 case 'r':
return "\x0D";
94 case 'e':
return "\x1B";
95 case ' ':
return "\x20";
96 case '\"':
return "\"";
97 case '\'':
return "\'";
98 case '\\':
return "\\";
100 case 'N':
return "\x85";
101 case '_':
return "\xA0";
102 case 'L':
return "\xE2\x80\xA8";
103 case 'P':
return "\xE2\x80\xA9";
104 case 'x':
return Escape(in, 2);
105 case 'u':
return Escape(in, 4);
106 case 'U':
return Escape(in, 8);
109 std::stringstream msg;
std::string Str(unsigned ch)
const char *const INVALID_HEX
const char *const INVALID_ESCAPE
unsigned ParseHex(const std::string &str, const Mark &mark)
const char *const INVALID_UNICODE
std::string Escape(Stream &in, int codeLength)