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