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

Function llex

app/redis-6.2.6/deps/lua/src/llex.c:338–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336
337
338static int llex (LexState *ls, SemInfo *seminfo) {
339 luaZ_resetbuffer(ls->buff);
340 for (;;) {
341 switch (ls->current) {
342 case '\n':
343 case '\r': {
344 inclinenumber(ls);
345 continue;
346 }
347 case '-': {
348 next(ls);
349 if (ls->current != '-') return '-';
350 /* else is a comment */
351 next(ls);
352 if (ls->current == '[') {
353 size_t sep = skip_sep(ls);
354 luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */
355 if (sep >= 2) {
356 read_long_string(ls, NULL, sep); /* long comment */
357 luaZ_resetbuffer(ls->buff);
358 continue;
359 }
360 }
361 /* else short comment */
362 while (!currIsNewline(ls) && ls->current != EOZ)
363 next(ls);
364 continue;
365 }
366 case '[': {
367 size_t sep = skip_sep(ls);
368 if (sep >= 2) {
369 read_long_string(ls, seminfo, sep);
370 return TK_STRING;
371 }
372 else if (sep == 0) /* '[=...' missing second bracket */
373 luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
374 return '[';
375 }
376 case '=': {
377 next(ls);
378 if (ls->current != '=') return '=';
379 else { next(ls); return TK_EQ; }
380 }
381 case '<': {
382 next(ls);
383 if (ls->current != '=') return '<';
384 else { next(ls); return TK_LE; }
385 }
386 case '>': {
387 next(ls);
388 if (ls->current != '=') return '>';
389 else { next(ls); return TK_GE; }
390 }
391 case '~': {
392 next(ls);
393 if (ls->current != '=') return '~';
394 else { next(ls); return TK_NE; }
395 }

Callers 2

luaX_nextFunction · 0.70
luaX_lookaheadFunction · 0.70

Calls 12

nextFunction · 0.85
luaX_lexerrorFunction · 0.85
isdigitFunction · 0.85
isspaceFunction · 0.85
isalphaFunction · 0.85
inclinenumberFunction · 0.70
skip_sepFunction · 0.70
read_long_stringFunction · 0.70
read_stringFunction · 0.70
check_nextFunction · 0.70
read_numeralFunction · 0.70
luaX_newstringFunction · 0.70

Tested by

no test coverage detected