| 399 | |
| 400 | |
| 401 | static int llex (LexState *ls, SemInfo *seminfo) { |
| 402 | luaZ_resetbuffer(ls->buff); |
| 403 | for (;;) { |
| 404 | switch (ls->current) { |
| 405 | case '\n': case '\r': { /* line breaks */ |
| 406 | inclinenumber(ls); |
| 407 | break; |
| 408 | } |
| 409 | case ' ': case '\f': case '\t': case '\v': { /* spaces */ |
| 410 | next(ls); |
| 411 | break; |
| 412 | } |
| 413 | case '-': { /* '-' or '--' (comment) */ |
| 414 | next(ls); |
| 415 | if (ls->current != '-') return '-'; |
| 416 | /* else is a comment */ |
| 417 | next(ls); |
| 418 | if (ls->current == '[') { /* long comment? */ |
| 419 | int sep = skip_sep(ls); |
| 420 | luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ |
| 421 | if (sep >= 0) { |
| 422 | read_long_string(ls, NULL, sep); /* skip long comment */ |
| 423 | luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ |
| 424 | break; |
| 425 | } |
| 426 | } |
| 427 | /* else short comment */ |
| 428 | while (!currIsNewline(ls) && ls->current != EOZ) |
| 429 | next(ls); /* skip until end of line (or end of file) */ |
| 430 | break; |
| 431 | } |
| 432 | case '[': { /* long string or simply '[' */ |
| 433 | int sep = skip_sep(ls); |
| 434 | if (sep >= 0) { |
| 435 | read_long_string(ls, seminfo, sep); |
| 436 | return TK_STRING; |
| 437 | } |
| 438 | else if (sep == -1) return '['; |
| 439 | else lexerror(ls, "invalid long string delimiter", TK_STRING); |
| 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 | } |
| 456 | case '~': { |
| 457 | next(ls); |
| 458 | if (ls->current != '=') return '~'; |
no test coverage detected