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