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

Function llex

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

Source from the content-addressed store, hash-verified

396
397
398static int llex (LexState *ls, SemInfo *seminfo) {
399 luaZ_resetbuffer(ls->buff);
400 for (;;) {
401 switch (ls->current) {
402 case '\n': case '\r': { /* line breaks */
403 inclinenumber(ls);
404 break;
405 }
406 case ' ': case '\f': case '\t': case '\v': { /* spaces */
407 next(ls);
408 break;
409 }
410 case '-': { /* '-' or '--' (comment) */
411 next(ls);
412 if (ls->current != '-') return '-';
413 /* else is a comment */
414 next(ls);
415 if (ls->current == '[') { /* long comment? */
416 int sep = skip_sep(ls);
417 luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */
418 if (sep >= 0) {
419 read_long_string(ls, NULL, sep); /* skip long comment */
420 luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */
421 break;
422 }
423 }
424 /* else short comment */
425 while (!currIsNewline(ls) && ls->current != EOZ)
426 next(ls); /* skip until end of line (or end of file) */
427 break;
428 }
429 case '[': { /* long string or simply '[' */
430 int sep = skip_sep(ls);
431 if (sep >= 0) {
432 read_long_string(ls, seminfo, sep);
433 return TK_STRING;
434 } else if (sep == -1) {
435 return '[';
436 } else {
437 lexerror(ls, "invalid long string delimiter", TK_STRING);
438 break;
439 }
440 }
441 case '=': {
442 next(ls);
443 if (ls->current != '=') return '=';
444 else { next(ls); return TK_EQ; }
445 }
446 case '<': {
447 next(ls);
448 if (ls->current != '=') return '<';
449 else { next(ls); return TK_LE; }
450 }
451 case '>': {
452 next(ls);
453 if (ls->current != '=') return '>';
454 else { next(ls); return TK_GE; }
455 }

Callers 2

luaX_nextFunction · 0.70
luaX_lookaheadFunction · 0.70

Calls 9

nextFunction · 0.85
lexerrorFunction · 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