| 7043 | |
| 7044 | |
| 7045 | static int llex (LexState *ls, SemInfo *seminfo) { |
| 7046 | luaZ_resetbuffer(ls->buff); |
| 7047 | for (;;) { |
| 7048 | switch (ls->current) { |
| 7049 | case '\n': |
| 7050 | case '\r': { |
| 7051 | inclinenumber(ls); |
| 7052 | continue; |
| 7053 | } |
| 7054 | case '-': { |
| 7055 | next(ls); |
| 7056 | if (ls->current != '-') return '-'; |
| 7057 | /* else is a comment */ |
| 7058 | next(ls); |
| 7059 | if (ls->current == '[') { |
| 7060 | int sep = skip_sep(ls); |
| 7061 | luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ |
| 7062 | if (sep >= 0) { |
| 7063 | read_long_string(ls, NULL, sep); /* long comment */ |
| 7064 | luaZ_resetbuffer(ls->buff); |
| 7065 | continue; |
| 7066 | } |
| 7067 | } |
| 7068 | /* else short comment */ |
| 7069 | while (!currIsNewline(ls) && ls->current != EOZ) |
| 7070 | next(ls); |
| 7071 | continue; |
| 7072 | } |
| 7073 | case '[': { |
| 7074 | int sep = skip_sep(ls); |
| 7075 | if (sep >= 0) { |
| 7076 | read_long_string(ls, seminfo, sep); |
| 7077 | return TK_STRING; |
| 7078 | } |
| 7079 | else if (sep == -1) return '['; |
| 7080 | else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); |
| 7081 | } |
| 7082 | case '=': { |
| 7083 | next(ls); |
| 7084 | if (ls->current != '=') return '='; |
| 7085 | else { next(ls); return TK_EQ; } |
| 7086 | } |
| 7087 | case '<': { |
| 7088 | next(ls); |
| 7089 | if (ls->current != '=') return '<'; |
| 7090 | else { next(ls); return TK_LE; } |
| 7091 | } |
| 7092 | case '>': { |
| 7093 | next(ls); |
| 7094 | if (ls->current != '=') return '>'; |
| 7095 | else { next(ls); return TK_GE; } |
| 7096 | } |
| 7097 | case '~': { |
| 7098 | next(ls); |
| 7099 | if (ls->current != '=') return '~'; |
| 7100 | else { next(ls); return TK_NE; } |
| 7101 | } |
| 7102 | case '"': |
no test coverage detected