MCPcopy Create free account
hub / github.com/F-Stack/f-stack / read_long_string

Function read_long_string

freebsd/contrib/openzfs/module/lua/llex.c:267–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

llexFunction · 0.70

Calls 6

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

Tested by

no test coverage detected