| 359 | |
| 360 | |
| 361 | static unsigned long readutf8esc(LexState *ls) { |
| 362 | unsigned long r; |
| 363 | int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ |
| 364 | save_and_next(ls); /* skip 'u' */ |
| 365 | esccheck(ls, ls->current == '{', "missing '{'"); |
| 366 | r = gethexa(ls); /* must have at least one digit */ |
| 367 | while ((save_and_next(ls), lisxdigit(ls->current))) { |
| 368 | i++; |
| 369 | r = (r << 4) + luaO_hexavalue(ls->current); |
| 370 | esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); |
| 371 | } |
| 372 | esccheck(ls, ls->current == '}', "missing '}'"); |
| 373 | next(ls); /* skip '}' */ |
| 374 | luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ |
| 375 | return r; |
| 376 | } |
| 377 | |
| 378 | |
| 379 | static void utf8esc(LexState *ls) { |
no test coverage detected