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

Function read_long_string

third-party/lua-5.3.5/src/llex.c:264–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262
263
264static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
265 int line = ls->linenumber; /* initial line (for error message) */
266 save_and_next(ls); /* skip 2nd '[' */
267 if (currIsNewline(ls)) /* string starts with a newline? */
268 inclinenumber(ls); /* skip it */
269 for (;;) {
270 switch (ls->current) {
271 case EOZ: { /* error */
272 const char *what = (seminfo ? "string" : "comment");
273 const char *msg = luaO_pushfstring(ls->L,
274 "unfinished long %s (starting at line %d)", what, line);
275 lexerror(ls, msg, TK_EOS);
276 break; /* to avoid warnings */
277 }
278 case ']': {
279 if (skip_sep(ls) == sep) {
280 save_and_next(ls); /* skip 2nd ']' */
281 goto endloop;
282 }
283 break;
284 }
285 case '\n': case '\r': {
286 save(ls, '\n');
287 inclinenumber(ls);
288 if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */
289 break;
290 }
291 default: {
292 if (seminfo) save_and_next(ls);
293 else next(ls);
294 }
295 }
296 } endloop:
297 if (seminfo)
298 seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),
299 luaZ_bufflen(ls->buff) - 2*(2 + sep));
300}
301
302
303static 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