MCPcopy Create free account
hub / github.com/DFHack/dfhack / readutf8esc

Function readutf8esc

depends/lua/src/llex.c:330–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328
329
330static 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
348static void utf8esc (LexState *ls) {

Callers 1

utf8escFunction · 0.85

Calls 3

esccheckFunction · 0.85
gethexaFunction · 0.85
luaO_hexavalueFunction · 0.85

Tested by

no test coverage detected