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