| 338 | |
| 339 | |
| 340 | static unsigned long readutf8esc (LexState *ls) { |
| 341 | unsigned long r; |
| 342 | int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ |
| 343 | save_and_next(ls); /* skip 'u' */ |
| 344 | esccheck(ls, ls->current == '{', "missing '{'"); |
| 345 | r = gethexa(ls); /* must have at least one digit */ |
| 346 | while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) { |
| 347 | i++; |
| 348 | esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large"); |
| 349 | r = (r << 4) + luaO_hexavalue(ls->current); |
| 350 | } |
| 351 | esccheck(ls, ls->current == '}', "missing '}'"); |
| 352 | next(ls); /* skip '}' */ |
| 353 | luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ |
| 354 | return r; |
| 355 | } |
| 356 | |
| 357 | |
| 358 | static void utf8esc (LexState *ls) { |
no test coverage detected