| 268 | |
| 269 | |
| 270 | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { |
| 271 | save_and_next(ls); /* skip 2nd `[' */ |
| 272 | if (currIsNewline(ls)) /* string starts with a newline? */ |
| 273 | inclinenumber(ls); /* skip it */ |
| 274 | for (;;) { |
| 275 | switch (ls->current) { |
| 276 | case EOZ: |
| 277 | lexerror(ls, (seminfo) ? "unfinished long string" : |
| 278 | "unfinished long comment", TK_EOS); |
| 279 | break; /* to avoid warnings */ |
| 280 | case ']': { |
| 281 | if (skip_sep(ls) == sep) { |
| 282 | save_and_next(ls); /* skip 2nd `]' */ |
| 283 | goto endloop; |
| 284 | } |
| 285 | break; |
| 286 | } |
| 287 | case '\n': case '\r': { |
| 288 | save(ls, '\n'); |
| 289 | inclinenumber(ls); |
| 290 | if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ |
| 291 | break; |
| 292 | } |
| 293 | default: { |
| 294 | if (seminfo) save_and_next(ls); |
| 295 | else next(ls); |
| 296 | } |
| 297 | } |
| 298 | } endloop: |
| 299 | if (seminfo) |
| 300 | seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), |
| 301 | luaZ_bufflen(ls->buff) - 2*(2 + sep)); |
| 302 | } |
| 303 | |
| 304 | |
| 305 | static void escerror (LexState *ls, int *c, int n, const char *msg) { |
no test coverage detected