MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / readutf8esc

Function readutf8esc

third-party/lua-5.5.0/src/llex.c:365–380  ·  view source on GitHub ↗

** When reading a UTF-8 escape sequence, save everything to the buffer ** for error reporting in case of errors; 'i' counts the number of ** saved characters, so that they can be removed if case of success. */

Source from the content-addressed store, hash-verified

363** saved characters, so that they can be removed if case of success.
364*/
365static l_uint32 readutf8esc (LexState *ls) {
366 l_uint32 r;
367 int i = 4; /* number of chars to be removed: start with #"\u{X" */
368 save_and_next(ls); /* skip 'u' */
369 esccheck(ls, ls->current == '{', "missing '{'");
370 r = cast_uint(gethexa(ls)); /* must have at least one digit */
371 while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) {
372 i++;
373 esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");
374 r = (r << 4) + luaO_hexavalue(ls->current);
375 }
376 esccheck(ls, ls->current == '}', "missing '}'");
377 next(ls); /* skip '}' */
378 luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */
379 return r;
380}
381
382
383static void utf8esc (LexState *ls) {

Callers 1

utf8escFunction · 0.70

Calls 3

esccheckFunction · 0.70
gethexaFunction · 0.70
luaO_hexavalueFunction · 0.70

Tested by

no test coverage detected