| 249 | } |
| 250 | |
| 251 | void GluaTokenParser::_loadutf8esc(std::string &code, std::stringstream *ss) |
| 252 | { |
| 253 | // char buff[8]; |
| 254 | unsigned long r; |
| 255 | int i = 4; // chars to be removed: '\', 'u', '{', and first digit |
| 256 | --_parsing_buff_len; |
| 257 | if (_current_char(code) != '{') |
| 258 | { |
| 259 | THROW_PERROR("in utf8 literal, need '{' after '\\u'"); |
| 260 | return; |
| 261 | } |
| 262 | ++_parsing_pos; |
| 263 | r = hexchar_to_base10(_current_char(code)); // must have at least one digit |
| 264 | while (is_base16_digit(_current_char(code)) && (!ss || *ss << (char)_current_char(code)) && _save_to_buff_and_next(hexchar_to_base10(_current_char(code)))) { |
| 265 | i++; |
| 266 | r = (r << 4) + hexchar_to_base10(_current_char(code)); |
| 267 | if (r > 0x10FFFF) |
| 268 | { |
| 269 | THROW_PERROR("UTF-8 value too large"); |
| 270 | return; |
| 271 | } |
| 272 | } |
| 273 | if (_current_char(code) != '}') |
| 274 | { |
| 275 | THROW_PERROR("missing '}' in UTF-8 value"); |
| 276 | return; |
| 277 | } |
| 278 | ++_parsing_pos; // skip } |
| 279 | } |
| 280 | |
| 281 | void GluaTokenParser::_loaddecesc(std::string &code, std::stringstream *ss) |
| 282 | { |
nothing calls this directly
no test coverage detected