aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/llex.c b/llex.c
index 328a4833..046182cb 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 2.75 2014/04/30 16:48:44 roberto Exp roberto $ 2** $Id: llex.c,v 2.76 2014/05/01 18:18:06 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -284,15 +284,19 @@ static int skip_sep (LexState *ls) {
284 284
285 285
286static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { 286static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
287 int line = ls->linenumber; /* initial line (for error message) */
287 save_and_next(ls); /* skip 2nd `[' */ 288 save_and_next(ls); /* skip 2nd `[' */
288 if (currIsNewline(ls)) /* string starts with a newline? */ 289 if (currIsNewline(ls)) /* string starts with a newline? */
289 inclinenumber(ls); /* skip it */ 290 inclinenumber(ls); /* skip it */
290 for (;;) { 291 for (;;) {
291 switch (ls->current) { 292 switch (ls->current) {
292 case EOZ: 293 case EOZ: { /* error */
293 lexerror(ls, (seminfo) ? "unfinished long string" : 294 const char *what = (seminfo ? "string" : "comment");
294 "unfinished long comment", TK_EOS); 295 const char *msg = luaO_pushfstring(ls->L,
296 "unfinished long %s (starting at line %d)", what, line);
297 lexerror(ls, msg, TK_EOS);
295 break; /* to avoid warnings */ 298 break; /* to avoid warnings */
299 }
296 case ']': { 300 case ']': {
297 if (skip_sep(ls) == sep) { 301 if (skip_sep(ls) == sep) {
298 save_and_next(ls); /* skip 2nd `]' */ 302 save_and_next(ls); /* skip 2nd `]' */