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

Function read_long_string

third-party/lua-5.2.4/src/llex.c:270–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268
269
270static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
271 save_and_next(ls); /* skip 2nd `[' */
272 if (currIsNewline(ls)) /* string starts with a newline? */
273 inclinenumber(ls); /* skip it */
274 for (;;) {
275 switch (ls->current) {
276 case EOZ:
277 lexerror(ls, (seminfo) ? "unfinished long string" :
278 "unfinished long comment", TK_EOS);
279 break; /* to avoid warnings */
280 case ']': {
281 if (skip_sep(ls) == sep) {
282 save_and_next(ls); /* skip 2nd `]' */
283 goto endloop;
284 }
285 break;
286 }
287 case '\n': case '\r': {
288 save(ls, '\n');
289 inclinenumber(ls);
290 if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */
291 break;
292 }
293 default: {
294 if (seminfo) save_and_next(ls);
295 else next(ls);
296 }
297 }
298 } endloop:
299 if (seminfo)
300 seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),
301 luaZ_bufflen(ls->buff) - 2*(2 + sep));
302}
303
304
305static void escerror (LexState *ls, int *c, int n, const char *msg) {

Callers 1

llexFunction · 0.70

Calls 5

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

Tested by

no test coverage detected