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

Function read_long_string

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

Source from the content-addressed store, hash-verified

295
296
297static void read_long_string (LexState *ls, SemInfo *seminfo, size_t sep) {
298 int line = ls->linenumber; /* initial line (for error message) */
299 save_and_next(ls); /* skip 2nd '[' */
300 if (currIsNewline(ls)) /* string starts with a newline? */
301 inclinenumber(ls); /* skip it */
302 for (;;) {
303 switch (ls->current) {
304 case EOZ: { /* error */
305 const char *what = (seminfo ? "string" : "comment");
306 const char *msg = luaO_pushfstring(ls->L,
307 "unfinished long %s (starting at line %d)", what, line);
308 lexerror(ls, msg, TK_EOS);
309 break; /* to avoid warnings */
310 }
311 case ']': {
312 if (skip_sep(ls) == sep) {
313 save_and_next(ls); /* skip 2nd ']' */
314 goto endloop;
315 }
316 break;
317 }
318 case '\n': case '\r': {
319 save(ls, '\n');
320 inclinenumber(ls);
321 if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */
322 break;
323 }
324 default: {
325 if (seminfo) save_and_next(ls);
326 else next(ls);
327 }
328 }
329 } endloop:
330 if (seminfo)
331 seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + sep,
332 luaZ_bufflen(ls->buff) - 2 * sep);
333}
334
335
336static void esccheck (LexState *ls, int c, const char *msg) {

Callers 1

llexFunction · 0.70

Calls 6

inclinenumberFunction · 0.70
luaO_pushfstringFunction · 0.70
lexerrorFunction · 0.70
skip_sepFunction · 0.70
saveFunction · 0.70
luaX_newstringFunction · 0.70

Tested by

no test coverage detected