MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / read_long_string

Function read_long_string

ThirdParty/lua/lua/llex.c:302–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

llexFunction · 0.85

Calls 6

inclinenumberFunction · 0.85
luaO_pushfstringFunction · 0.85
lexerrorFunction · 0.85
skip_sepFunction · 0.85
saveFunction · 0.85
luaX_newstringFunction · 0.85

Tested by

no test coverage detected