MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / read_long_string

Function read_long_string

src/Chain/libraries/glua/llex.cpp:298–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

llexFunction · 0.85

Calls 7

inclinenumberFunction · 0.85
luaO_pushfstringFunction · 0.85
lexerrorFunction · 0.85
skip_sepFunction · 0.85
luaX_newstringFunction · 0.85
saveFunction · 0.70
nextFunction · 0.50

Tested by

no test coverage detected