| 328 | |
| 329 | |
| 330 | static unsigned long readutf8esc (LexState *ls) { |
| 331 | unsigned long r; |
| 332 | int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ |
| 333 | save_and_next(ls); /* skip 'u' */ |
| 334 | esccheck(ls, ls->current == '{', "missing '{'"); |
| 335 | r = gethexa(ls); /* must have at least one digit */ |
| 336 | while ((save_and_next(ls), lisxdigit(ls->current))) { |
| 337 | i++; |
| 338 | r = (r << 4) + luaO_hexavalue(ls->current); |
| 339 | esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); |
| 340 | } |
| 341 | esccheck(ls, ls->current == '}', "missing '}'"); |
| 342 | next(ls); /* skip '}' */ |
| 343 | luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ |
| 344 | return r; |
| 345 | } |
| 346 | |
| 347 | |
| 348 | static void utf8esc (LexState *ls) { |
no test coverage detected