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