| 440 | |
| 441 | |
| 442 | static int llex (LexState *ls, SemInfo *seminfo) { |
| 443 | luaZ_resetbuffer(ls->buff); |
| 444 | for (;;) { |
| 445 | switch (ls->current) { |
| 446 | case '\n': case '\r': { /* line breaks */ |
| 447 | inclinenumber(ls); |
| 448 | break; |
| 449 | } |
| 450 | case ' ': case '\f': case '\t': case '\v': { /* spaces */ |
| 451 | next(ls); |
| 452 | break; |
| 453 | } |
| 454 | case '-': { /* '-' or '--' (comment) */ |
| 455 | next(ls); |
| 456 | if (ls->current != '-') return '-'; |
| 457 | /* else is a comment */ |
| 458 | next(ls); |
| 459 | if (ls->current == '[') { /* long comment? */ |
| 460 | size_t sep = skip_sep(ls); |
| 461 | luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ |
| 462 | if (sep >= 2) { |
| 463 | read_long_string(ls, NULL, sep); /* skip long comment */ |
| 464 | luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ |
| 465 | break; |
| 466 | } |
| 467 | } |
| 468 | /* else short comment */ |
| 469 | while (!currIsNewline(ls) && ls->current != EOZ) |
| 470 | next(ls); /* skip until end of line (or end of file) */ |
| 471 | break; |
| 472 | } |
| 473 | case '[': { /* long string or simply '[' */ |
| 474 | size_t sep = skip_sep(ls); |
| 475 | if (sep >= 2) { |
| 476 | read_long_string(ls, seminfo, sep); |
| 477 | return TK_STRING; |
| 478 | } |
| 479 | else if (sep == 0) /* '[=...' missing second bracket? */ |
| 480 | lexerror(ls, "invalid long string delimiter", TK_STRING); |
| 481 | return '['; |
| 482 | } |
| 483 | case '=': { |
| 484 | next(ls); |
| 485 | if (check_next1(ls, '=')) return TK_EQ; |
| 486 | else return '='; |
| 487 | } |
| 488 | case '<': { |
| 489 | next(ls); |
| 490 | if (check_next1(ls, '=')) return TK_LE; |
| 491 | else if (check_next1(ls, '<')) return TK_SHL; |
| 492 | else return '<'; |
| 493 | } |
| 494 | case '>': { |
| 495 | next(ls); |
| 496 | if (check_next1(ls, '=')) return TK_GE; |
| 497 | else if (check_next1(ls, '>')) return TK_SHR; |
| 498 | else return '>'; |
| 499 | } |
no test coverage detected