diff options
-rw-r--r-- | lauxlib.c | 14 | ||||
-rw-r--r-- | lbaselib.c | 5 | ||||
-rw-r--r-- | ldebug.c | 4 | ||||
-rw-r--r-- | ldo.c | 4 | ||||
-rw-r--r-- | liolib.c | 6 | ||||
-rw-r--r-- | llex.c | 8 | ||||
-rw-r--r-- | loadlib.c | 19 | ||||
-rw-r--r-- | lobject.c | 7 | ||||
-rw-r--r-- | loslib.c | 4 | ||||
-rw-r--r-- | lparser.c | 14 | ||||
-rw-r--r-- | lstrlib.c | 19 | ||||
-rw-r--r-- | ltable.c | 4 | ||||
-rw-r--r-- | ltablib.c | 8 | ||||
-rw-r--r-- | lua.c | 13 | ||||
-rw-r--r-- | luaconf.h | 5 | ||||
-rw-r--r-- | lvm.c | 8 |
16 files changed, 67 insertions, 75 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.267 2014/07/19 14:37:09 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.268 2014/09/22 06:42:15 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -82,12 +82,12 @@ static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { | |||
82 | 82 | ||
83 | static void pushfuncname (lua_State *L, lua_Debug *ar) { | 83 | static void pushfuncname (lua_State *L, lua_Debug *ar) { |
84 | if (*ar->namewhat != '\0') /* is there a name? */ | 84 | if (*ar->namewhat != '\0') /* is there a name? */ |
85 | lua_pushfstring(L, "function " LUA_QS, ar->name); | 85 | lua_pushfstring(L, "function '%s'", ar->name); |
86 | else if (*ar->what == 'm') /* main? */ | 86 | else if (*ar->what == 'm') /* main? */ |
87 | lua_pushliteral(L, "main chunk"); | 87 | lua_pushliteral(L, "main chunk"); |
88 | else if (*ar->what == 'C') { | 88 | else if (*ar->what == 'C') { |
89 | if (pushglobalfuncname(L, ar)) { | 89 | if (pushglobalfuncname(L, ar)) { |
90 | lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1)); | 90 | lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); |
91 | lua_remove(L, -2); /* remove name */ | 91 | lua_remove(L, -2); /* remove name */ |
92 | } | 92 | } |
93 | else | 93 | else |
@@ -158,12 +158,12 @@ LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { | |||
158 | if (strcmp(ar.namewhat, "method") == 0) { | 158 | if (strcmp(ar.namewhat, "method") == 0) { |
159 | arg--; /* do not count `self' */ | 159 | arg--; /* do not count `self' */ |
160 | if (arg == 0) /* error is in the self argument itself? */ | 160 | if (arg == 0) /* error is in the self argument itself? */ |
161 | return luaL_error(L, "calling " LUA_QS " on bad self (%s)", | 161 | return luaL_error(L, "calling '%s' on bad self (%s)", |
162 | ar.name, extramsg); | 162 | ar.name, extramsg); |
163 | } | 163 | } |
164 | if (ar.name == NULL) | 164 | if (ar.name == NULL) |
165 | ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; | 165 | ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; |
166 | return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", | 166 | return luaL_error(L, "bad argument #%d to '%s' (%s)", |
167 | arg, ar.name, extramsg); | 167 | arg, ar.name, extramsg); |
168 | } | 168 | } |
169 | 169 | ||
@@ -335,7 +335,7 @@ LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, | |||
335 | if (strcmp(lst[i], name) == 0) | 335 | if (strcmp(lst[i], name) == 0) |
336 | return i; | 336 | return i; |
337 | return luaL_argerror(L, arg, | 337 | return luaL_argerror(L, arg, |
338 | lua_pushfstring(L, "invalid option " LUA_QS, name)); | 338 | lua_pushfstring(L, "invalid option '%s'", name)); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
@@ -823,7 +823,7 @@ LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, | |||
823 | /* try global variable (and create one if it does not exist) */ | 823 | /* try global variable (and create one if it does not exist) */ |
824 | lua_pushglobaltable(L); | 824 | lua_pushglobaltable(L); |
825 | if (luaL_findtable(L, 0, modname, sizehint) != NULL) | 825 | if (luaL_findtable(L, 0, modname, sizehint) != NULL) |
826 | luaL_error(L, "name conflict for module " LUA_QS, modname); | 826 | luaL_error(L, "name conflict for module '%s'", modname); |
827 | lua_pushvalue(L, -1); | 827 | lua_pushvalue(L, -1); |
828 | lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */ | 828 | lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */ |
829 | } | 829 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.300 2014/10/07 18:29:13 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.301 2014/10/15 14:27:40 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -32,8 +32,7 @@ static int luaB_print (lua_State *L) { | |||
32 | lua_call(L, 1, 1); | 32 | lua_call(L, 1, 1); |
33 | s = lua_tolstring(L, -1, &l); /* get result */ | 33 | s = lua_tolstring(L, -1, &l); /* get result */ |
34 | if (s == NULL) | 34 | if (s == NULL) |
35 | return luaL_error(L, | 35 | return luaL_error(L, "'tostring' must return a string to 'print'"); |
36 | LUA_QL("tostring") " must return a string to " LUA_QL("print")); | ||
37 | if (i>1) luai_writestring("\t", 1); | 36 | if (i>1) luai_writestring("\t", 1); |
38 | luai_writestring(s, l); | 37 | luai_writestring(s, l); |
39 | lua_pop(L, 1); /* pop result */ | 38 | lua_pop(L, 1); /* pop result */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.99 2014/07/17 12:30:53 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.100 2014/07/30 14:00:14 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -515,7 +515,7 @@ static const char *varinfo (lua_State *L, const TValue *o) { | |||
515 | kind = getobjname(ci_func(ci)->p, currentpc(ci), | 515 | kind = getobjname(ci_func(ci)->p, currentpc(ci), |
516 | cast_int(o - ci->u.l.base), &name); | 516 | cast_int(o - ci->u.l.base), &name); |
517 | } | 517 | } |
518 | return (kind) ? luaO_pushfstring(L, " (%s " LUA_QS ")", kind, name) : ""; | 518 | return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; |
519 | } | 519 | } |
520 | 520 | ||
521 | 521 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.128 2014/10/07 18:29:13 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.129 2014/10/08 12:20:26 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -662,7 +662,7 @@ struct SParser { /* data to `f_parser' */ | |||
662 | static void checkmode (lua_State *L, const char *mode, const char *x) { | 662 | static void checkmode (lua_State *L, const char *mode, const char *x) { |
663 | if (mode && strchr(mode, x[0]) == NULL) { | 663 | if (mode && strchr(mode, x[0]) == NULL) { |
664 | luaO_pushfstring(L, | 664 | luaO_pushfstring(L, |
665 | "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode); | 665 | "attempt to load a %s chunk (mode is '%s')", x, mode); |
666 | luaD_throw(L, LUA_ERRSYNTAX); | 666 | luaD_throw(L, LUA_ERRSYNTAX); |
667 | } | 667 | } |
668 | } | 668 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.131 2014/10/03 12:54:57 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.132 2014/10/15 14:27:40 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -70,7 +70,7 @@ | |||
70 | /* ANSI definitions */ | 70 | /* ANSI definitions */ |
71 | #define l_popen(L,c,m) \ | 71 | #define l_popen(L,c,m) \ |
72 | ((void)((void)c, m), \ | 72 | ((void)((void)c, m), \ |
73 | luaL_error(L, LUA_QL("popen") " not supported"), \ | 73 | luaL_error(L, "'popen' not supported"), \ |
74 | (FILE*)0) | 74 | (FILE*)0) |
75 | #define l_pclose(L,file) ((void)L, (void)file, -1) | 75 | #define l_pclose(L,file) ((void)L, (void)file, -1) |
76 | 76 | ||
@@ -244,7 +244,7 @@ static void opencheck (lua_State *L, const char *fname, const char *mode) { | |||
244 | LStream *p = newfile(L); | 244 | LStream *p = newfile(L); |
245 | p->f = fopen(fname, mode); | 245 | p->f = fopen(fname, mode); |
246 | if (p->f == NULL) | 246 | if (p->f == NULL) |
247 | luaL_error(L, "cannot open file " LUA_QS " (%s)", fname, strerror(errno)); | 247 | luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno)); |
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.81 2014/10/01 11:52:33 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.82 2014/10/10 22:23:04 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 | */ |
@@ -79,12 +79,12 @@ void luaX_init (lua_State *L) { | |||
79 | const char *luaX_token2str (LexState *ls, int token) { | 79 | const char *luaX_token2str (LexState *ls, int token) { |
80 | if (token < FIRST_RESERVED) { /* single-byte symbols? */ | 80 | if (token < FIRST_RESERVED) { /* single-byte symbols? */ |
81 | lua_assert(token == cast_uchar(token)); | 81 | lua_assert(token == cast_uchar(token)); |
82 | return luaO_pushfstring(ls->L, LUA_QL("%c"), token); | 82 | return luaO_pushfstring(ls->L, "'%c'", token); |
83 | } | 83 | } |
84 | else { | 84 | else { |
85 | const char *s = luaX_tokens[token - FIRST_RESERVED]; | 85 | const char *s = luaX_tokens[token - FIRST_RESERVED]; |
86 | if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ | 86 | if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ |
87 | return luaO_pushfstring(ls->L, LUA_QS, s); | 87 | return luaO_pushfstring(ls->L, "'%s'", s); |
88 | else /* names, strings, and numerals */ | 88 | else /* names, strings, and numerals */ |
89 | return s; | 89 | return s; |
90 | } | 90 | } |
@@ -96,7 +96,7 @@ static const char *txtToken (LexState *ls, int token) { | |||
96 | case TK_NAME: case TK_STRING: | 96 | case TK_NAME: case TK_STRING: |
97 | case TK_FLT: case TK_INT: | 97 | case TK_FLT: case TK_INT: |
98 | save(ls, '\0'); | 98 | save(ls, '\0'); |
99 | return luaO_pushfstring(ls->L, LUA_QS, luaZ_buffer(ls->buff)); | 99 | return luaO_pushfstring(ls->L, "'%s'", luaZ_buffer(ls->buff)); |
100 | default: | 100 | default: |
101 | return luaX_token2str(ls, token); | 101 | return luaX_token2str(ls, token); |
102 | } | 102 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.115 2014/07/28 17:47:53 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.116 2014/07/29 16:01:00 roberto Exp roberto $ |
3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | ** | 5 | ** |
@@ -396,7 +396,7 @@ static const char *searchpath (lua_State *L, const char *name, | |||
396 | lua_remove(L, -2); /* remove path template */ | 396 | lua_remove(L, -2); /* remove path template */ |
397 | if (readable(filename)) /* does file exist and is readable? */ | 397 | if (readable(filename)) /* does file exist and is readable? */ |
398 | return filename; /* return that file name */ | 398 | return filename; /* return that file name */ |
399 | lua_pushfstring(L, "\n\tno file " LUA_QS, filename); | 399 | lua_pushfstring(L, "\n\tno file '%s'", filename); |
400 | lua_remove(L, -2); /* remove file name */ | 400 | lua_remove(L, -2); /* remove file name */ |
401 | luaL_addvalue(&msg); /* concatenate error msg. entry */ | 401 | luaL_addvalue(&msg); /* concatenate error msg. entry */ |
402 | } | 402 | } |
@@ -426,7 +426,7 @@ static const char *findfile (lua_State *L, const char *name, | |||
426 | lua_getfield(L, lua_upvalueindex(1), pname); | 426 | lua_getfield(L, lua_upvalueindex(1), pname); |
427 | path = lua_tostring(L, -1); | 427 | path = lua_tostring(L, -1); |
428 | if (path == NULL) | 428 | if (path == NULL) |
429 | luaL_error(L, LUA_QL("package.%s") " must be a string", pname); | 429 | luaL_error(L, "'package.%s' must be a string", pname); |
430 | return searchpath(L, name, path, ".", dirsep); | 430 | return searchpath(L, name, path, ".", dirsep); |
431 | } | 431 | } |
432 | 432 | ||
@@ -437,8 +437,7 @@ static int checkload (lua_State *L, int stat, const char *filename) { | |||
437 | return 2; /* return open function and file name */ | 437 | return 2; /* return open function and file name */ |
438 | } | 438 | } |
439 | else | 439 | else |
440 | return luaL_error(L, "error loading module " LUA_QS | 440 | return luaL_error(L, "error loading module '%s' from file '%s':\n\t%s", |
441 | " from file " LUA_QS ":\n\t%s", | ||
442 | lua_tostring(L, 1), filename, lua_tostring(L, -1)); | 441 | lua_tostring(L, 1), filename, lua_tostring(L, -1)); |
443 | } | 442 | } |
444 | 443 | ||
@@ -499,8 +498,7 @@ static int searcher_Croot (lua_State *L) { | |||
499 | if (stat != ERRFUNC) | 498 | if (stat != ERRFUNC) |
500 | return checkload(L, 0, filename); /* real error */ | 499 | return checkload(L, 0, filename); /* real error */ |
501 | else { /* open function not found */ | 500 | else { /* open function not found */ |
502 | lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, | 501 | lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename); |
503 | name, filename); | ||
504 | return 1; | 502 | return 1; |
505 | } | 503 | } |
506 | } | 504 | } |
@@ -524,14 +522,13 @@ static void findloader (lua_State *L, const char *name) { | |||
524 | luaL_buffinit(L, &msg); | 522 | luaL_buffinit(L, &msg); |
525 | lua_getfield(L, lua_upvalueindex(1), "searchers"); /* will be at index 3 */ | 523 | lua_getfield(L, lua_upvalueindex(1), "searchers"); /* will be at index 3 */ |
526 | if (!lua_istable(L, 3)) | 524 | if (!lua_istable(L, 3)) |
527 | luaL_error(L, LUA_QL("package.searchers") " must be a table"); | 525 | luaL_error(L, "'package.searchers' must be a table"); |
528 | /* iterate over available searchers to find a loader */ | 526 | /* iterate over available searchers to find a loader */ |
529 | for (i = 1; ; i++) { | 527 | for (i = 1; ; i++) { |
530 | if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ | 528 | if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ |
531 | lua_pop(L, 1); /* remove nil */ | 529 | lua_pop(L, 1); /* remove nil */ |
532 | luaL_pushresult(&msg); /* create error message */ | 530 | luaL_pushresult(&msg); /* create error message */ |
533 | luaL_error(L, "module " LUA_QS " not found:%s", | 531 | luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); |
534 | name, lua_tostring(L, -1)); | ||
535 | } | 532 | } |
536 | lua_pushstring(L, name); | 533 | lua_pushstring(L, name); |
537 | lua_call(L, 1, 2); /* call it */ | 534 | lua_call(L, 1, 2); /* call it */ |
@@ -589,7 +586,7 @@ static void set_env (lua_State *L) { | |||
589 | if (lua_getstack(L, 1, &ar) == 0 || | 586 | if (lua_getstack(L, 1, &ar) == 0 || |
590 | lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ | 587 | lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ |
591 | lua_iscfunction(L, -1)) | 588 | lua_iscfunction(L, -1)) |
592 | luaL_error(L, LUA_QL("module") " not called from a Lua function"); | 589 | luaL_error(L, "'module' not called from a Lua function"); |
593 | lua_pushvalue(L, -2); /* copy new environment table to top */ | 590 | lua_pushvalue(L, -2); /* copy new environment table to top */ |
594 | lua_setupvalue(L, -2, 1); | 591 | lua_setupvalue(L, -2, 1); |
595 | lua_pop(L, 1); /* remove function */ | 592 | lua_pop(L, 1); /* remove function */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.91 2014/10/04 22:57:10 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.92 2014/10/10 22:23:04 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -415,9 +415,8 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
415 | break; | 415 | break; |
416 | } | 416 | } |
417 | default: { | 417 | default: { |
418 | luaG_runerror(L, | 418 | luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", |
419 | "invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"), | 419 | *(e + 1)); |
420 | *(e + 1)); | ||
421 | } | 420 | } |
422 | } | 421 | } |
423 | n += 2; | 422 | n += 2; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.47 2014/10/01 11:54:56 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.48 2014/10/08 19:57:31 roberto Exp roberto $ |
3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -189,7 +189,7 @@ static int getfield (lua_State *L, const char *key, int d) { | |||
189 | res = (int)lua_tointegerx(L, -1, &isnum); | 189 | res = (int)lua_tointegerx(L, -1, &isnum); |
190 | if (!isnum) { | 190 | if (!isnum) { |
191 | if (d < 0) | 191 | if (d < 0) |
192 | return luaL_error(L, "field " LUA_QS " missing in date table", key); | 192 | return luaL_error(L, "field '%s' missing in date table", key); |
193 | res = d; | 193 | res = d; |
194 | } | 194 | } |
195 | lua_pop(L, 1); | 195 | lua_pop(L, 1); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.141 2014/07/18 13:36:14 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.142 2014/07/21 16:02:10 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -340,7 +340,7 @@ static void closegoto (LexState *ls, int g, Labeldesc *label) { | |||
340 | if (gt->nactvar < label->nactvar) { | 340 | if (gt->nactvar < label->nactvar) { |
341 | TString *vname = getlocvar(fs, gt->nactvar)->varname; | 341 | TString *vname = getlocvar(fs, gt->nactvar)->varname; |
342 | const char *msg = luaO_pushfstring(ls->L, | 342 | const char *msg = luaO_pushfstring(ls->L, |
343 | "<goto %s> at line %d jumps into the scope of local " LUA_QS, | 343 | "<goto %s> at line %d jumps into the scope of local '%s'", |
344 | getstr(gt->name), gt->line, getstr(vname)); | 344 | getstr(gt->name), gt->line, getstr(vname)); |
345 | semerror(ls, msg); | 345 | semerror(ls, msg); |
346 | } | 346 | } |
@@ -457,7 +457,7 @@ static void breaklabel (LexState *ls) { | |||
457 | static l_noret undefgoto (LexState *ls, Labeldesc *gt) { | 457 | static l_noret undefgoto (LexState *ls, Labeldesc *gt) { |
458 | const char *msg = isreserved(gt->name) | 458 | const char *msg = isreserved(gt->name) |
459 | ? "<%s> at line %d not inside a loop" | 459 | ? "<%s> at line %d not inside a loop" |
460 | : "no visible label " LUA_QS " for <goto> at line %d"; | 460 | : "no visible label '%s' for <goto> at line %d"; |
461 | msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); | 461 | msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); |
462 | semerror(ls, msg); | 462 | semerror(ls, msg); |
463 | } | 463 | } |
@@ -761,7 +761,7 @@ static void parlist (LexState *ls) { | |||
761 | f->is_vararg = 1; | 761 | f->is_vararg = 1; |
762 | break; | 762 | break; |
763 | } | 763 | } |
764 | default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected"); | 764 | default: luaX_syntaxerror(ls, "<name> or '...' expected"); |
765 | } | 765 | } |
766 | } while (!f->is_vararg && testnext(ls, ',')); | 766 | } while (!f->is_vararg && testnext(ls, ',')); |
767 | } | 767 | } |
@@ -953,7 +953,7 @@ static void simpleexp (LexState *ls, expdesc *v) { | |||
953 | case TK_DOTS: { /* vararg */ | 953 | case TK_DOTS: { /* vararg */ |
954 | FuncState *fs = ls->fs; | 954 | FuncState *fs = ls->fs; |
955 | check_condition(ls, fs->f->is_vararg, | 955 | check_condition(ls, fs->f->is_vararg, |
956 | "cannot use " LUA_QL("...") " outside a vararg function"); | 956 | "cannot use '...' outside a vararg function"); |
957 | init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); | 957 | init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); |
958 | break; | 958 | break; |
959 | } | 959 | } |
@@ -1200,7 +1200,7 @@ static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { | |||
1200 | for (i = fs->bl->firstlabel; i < ll->n; i++) { | 1200 | for (i = fs->bl->firstlabel; i < ll->n; i++) { |
1201 | if (eqstr(label, ll->arr[i].name)) { | 1201 | if (eqstr(label, ll->arr[i].name)) { |
1202 | const char *msg = luaO_pushfstring(fs->ls->L, | 1202 | const char *msg = luaO_pushfstring(fs->ls->L, |
1203 | "label " LUA_QS " already defined on line %d", | 1203 | "label '%s' already defined on line %d", |
1204 | getstr(label), ll->arr[i].line); | 1204 | getstr(label), ll->arr[i].line); |
1205 | semerror(fs->ls, msg); | 1205 | semerror(fs->ls, msg); |
1206 | } | 1206 | } |
@@ -1367,7 +1367,7 @@ static void forstat (LexState *ls, int line) { | |||
1367 | switch (ls->t.token) { | 1367 | switch (ls->t.token) { |
1368 | case '=': fornum(ls, varname, line); break; | 1368 | case '=': fornum(ls, varname, line); break; |
1369 | case ',': case TK_IN: forlist(ls, varname); break; | 1369 | case ',': case TK_IN: forlist(ls, varname); break; |
1370 | default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); | 1370 | default: luaX_syntaxerror(ls, "'=' or 'in' expected"); |
1371 | } | 1371 | } |
1372 | check_match(ls, TK_END, TK_FOR, line); | 1372 | check_match(ls, TK_END, TK_FOR, line); |
1373 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ | 1373 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.202 2014/10/01 11:54:56 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.203 2014/10/17 10:55:28 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -250,14 +250,14 @@ static const char *classend (MatchState *ms, const char *p) { | |||
250 | switch (*p++) { | 250 | switch (*p++) { |
251 | case L_ESC: { | 251 | case L_ESC: { |
252 | if (p == ms->p_end) | 252 | if (p == ms->p_end) |
253 | luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); | 253 | luaL_error(ms->L, "malformed pattern (ends with '%%')"); |
254 | return p+1; | 254 | return p+1; |
255 | } | 255 | } |
256 | case '[': { | 256 | case '[': { |
257 | if (*p == '^') p++; | 257 | if (*p == '^') p++; |
258 | do { /* look for a `]' */ | 258 | do { /* look for a `]' */ |
259 | if (p == ms->p_end) | 259 | if (p == ms->p_end) |
260 | luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); | 260 | luaL_error(ms->L, "malformed pattern (missing ']')"); |
261 | if (*(p++) == L_ESC && p < ms->p_end) | 261 | if (*(p++) == L_ESC && p < ms->p_end) |
262 | p++; /* skip escapes (e.g. `%]') */ | 262 | p++; /* skip escapes (e.g. `%]') */ |
263 | } while (*p != ']'); | 263 | } while (*p != ']'); |
@@ -332,8 +332,7 @@ static int singlematch (MatchState *ms, const char *s, const char *p, | |||
332 | static const char *matchbalance (MatchState *ms, const char *s, | 332 | static const char *matchbalance (MatchState *ms, const char *s, |
333 | const char *p) { | 333 | const char *p) { |
334 | if (p >= ms->p_end - 1) | 334 | if (p >= ms->p_end - 1) |
335 | luaL_error(ms->L, "malformed pattern " | 335 | luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); |
336 | "(missing arguments to " LUA_QL("%%b") ")"); | ||
337 | if (*s != *p) return NULL; | 336 | if (*s != *p) return NULL; |
338 | else { | 337 | else { |
339 | int b = *p; | 338 | int b = *p; |
@@ -450,8 +449,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) { | |||
450 | const char *ep; char previous; | 449 | const char *ep; char previous; |
451 | p += 2; | 450 | p += 2; |
452 | if (*p != '[') | 451 | if (*p != '[') |
453 | luaL_error(ms->L, "missing " LUA_QL("[") " after " | 452 | luaL_error(ms->L, "missing '[' after '%%f' in pattern"); |
454 | LUA_QL("%%f") " in pattern"); | ||
455 | ep = classend(ms, p); /* points to what is next */ | 453 | ep = classend(ms, p); /* points to what is next */ |
456 | previous = (s == ms->src_init) ? '\0' : *(s - 1); | 454 | previous = (s == ms->src_init) ? '\0' : *(s - 1); |
457 | if (!matchbracketclass(uchar(previous), p, ep - 1) && | 455 | if (!matchbracketclass(uchar(previous), p, ep - 1) && |
@@ -694,8 +692,7 @@ static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, | |||
694 | i++; /* skip ESC */ | 692 | i++; /* skip ESC */ |
695 | if (!isdigit(uchar(news[i]))) { | 693 | if (!isdigit(uchar(news[i]))) { |
696 | if (news[i] != L_ESC) | 694 | if (news[i] != L_ESC) |
697 | luaL_error(L, "invalid use of " LUA_QL("%c") | 695 | luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); |
698 | " in replacement string", L_ESC); | ||
699 | luaL_addchar(b, news[i]); | 696 | luaL_addchar(b, news[i]); |
700 | } | 697 | } |
701 | else if (news[i] == '0') | 698 | else if (news[i] == '0') |
@@ -929,8 +926,8 @@ static int str_format (lua_State *L) { | |||
929 | } | 926 | } |
930 | } | 927 | } |
931 | default: { /* also treat cases `pnLlh' */ | 928 | default: { /* also treat cases `pnLlh' */ |
932 | return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " | 929 | return luaL_error(L, "invalid option '%%%c' to 'format'", |
933 | LUA_QL("format"), *(strfrmt - 1)); | 930 | *(strfrmt - 1)); |
934 | } | 931 | } |
935 | } | 932 | } |
936 | luaL_addsize(&b, nb); | 933 | luaL_addsize(&b, nb); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.94 2014/08/01 17:24:02 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.95 2014/09/04 18:15:29 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -181,7 +181,7 @@ static unsigned int findindex (lua_State *L, Table *t, StkId key) { | |||
181 | } | 181 | } |
182 | nx = gnext(n); | 182 | nx = gnext(n); |
183 | if (nx == 0) | 183 | if (nx == 0) |
184 | luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ | 184 | luaG_runerror(L, "invalid key to 'next'"); /* key not found */ |
185 | else n += nx; | 185 | else n += nx; |
186 | } | 186 | } |
187 | } | 187 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.75 2014/08/21 20:07:56 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.76 2014/09/22 06:42:15 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -91,7 +91,7 @@ static int tinsert (lua_State *L) { | |||
91 | break; | 91 | break; |
92 | } | 92 | } |
93 | default: { | 93 | default: { |
94 | return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); | 94 | return luaL_error(L, "wrong number of arguments to 'insert'"); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | (*ta.seti)(L, 1, pos); /* t[pos] = v */ | 97 | (*ta.seti)(L, 1, pos); /* t[pos] = v */ |
@@ -154,8 +154,8 @@ static int tmove (lua_State *L) { | |||
154 | static void addfield (lua_State *L, luaL_Buffer *b, TabA *ta, lua_Integer i) { | 154 | static void addfield (lua_State *L, luaL_Buffer *b, TabA *ta, lua_Integer i) { |
155 | (*ta->geti)(L, 1, i); | 155 | (*ta->geti)(L, 1, i); |
156 | if (!lua_isstring(L, -1)) | 156 | if (!lua_isstring(L, -1)) |
157 | luaL_error(L, "invalid value (%s) at index %d in table for " | 157 | luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", |
158 | LUA_QL("concat"), luaL_typename(L, -1), i); | 158 | luaL_typename(L, -1), i); |
159 | luaL_addvalue(b); | 159 | luaL_addvalue(b); |
160 | } | 160 | } |
161 | 161 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.213 2014/06/30 19:48:08 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.214 2014/09/25 14:20:37 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -134,9 +134,9 @@ static void print_usage (const char *badoption) { | |||
134 | luai_writestringerror( | 134 | luai_writestringerror( |
135 | "usage: %s [options] [script [args]]\n" | 135 | "usage: %s [options] [script [args]]\n" |
136 | "Available options are:\n" | 136 | "Available options are:\n" |
137 | " -e stat execute string " LUA_QL("stat") "\n" | 137 | " -e stat execute string 'stat'\n" |
138 | " -i enter interactive mode after executing " LUA_QL("script") "\n" | 138 | " -i enter interactive mode after executing 'script'\n" |
139 | " -l name require library " LUA_QL("name") "\n" | 139 | " -l name require library 'name'\n" |
140 | " -v show version information\n" | 140 | " -v show version information\n" |
141 | " -E ignore environment variables\n" | 141 | " -E ignore environment variables\n" |
142 | " -- stop handling options\n" | 142 | " -- stop handling options\n" |
@@ -388,9 +388,8 @@ static void l_print (lua_State *L) { | |||
388 | lua_getglobal(L, "print"); | 388 | lua_getglobal(L, "print"); |
389 | lua_insert(L, 1); | 389 | lua_insert(L, 1); |
390 | if (lua_pcall(L, n, 0, 0) != LUA_OK) | 390 | if (lua_pcall(L, n, 0, 0) != LUA_OK) |
391 | l_message(progname, lua_pushfstring(L, | 391 | l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", |
392 | "error calling " LUA_QL("print") " (%s)", | 392 | lua_tostring(L, -1))); |
393 | lua_tostring(L, -1))); | ||
394 | } | 393 | } |
395 | } | 394 | } |
396 | 395 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.216 2014/10/08 20:32:50 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.217 2014/10/15 14:53:20 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -243,7 +243,8 @@ | |||
243 | 243 | ||
244 | /* | 244 | /* |
245 | @@ LUA_QL describes how error messages quote program elements. | 245 | @@ LUA_QL describes how error messages quote program elements. |
246 | ** CHANGE it if you want a different appearance. | 246 | ** Lua does not use these macros anymore; they are here for |
247 | ** compatibility only. | ||
247 | */ | 248 | */ |
248 | #define LUA_QL(x) "'" x "'" | 249 | #define LUA_QL(x) "'" x "'" |
249 | #define LUA_QS LUA_QL("%s") | 250 | #define LUA_QS LUA_QL("%s") |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.222 2014/07/30 14:42:44 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.223 2014/09/04 18:15:29 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1033,13 +1033,13 @@ void luaV_execute (lua_State *L) { | |||
1033 | else { /* try making all values floats */ | 1033 | else { /* try making all values floats */ |
1034 | lua_Number ninit; lua_Number nlimit; lua_Number nstep; | 1034 | lua_Number ninit; lua_Number nlimit; lua_Number nstep; |
1035 | if (!tonumber(plimit, &nlimit)) | 1035 | if (!tonumber(plimit, &nlimit)) |
1036 | luaG_runerror(L, LUA_QL("for") " limit must be a number"); | 1036 | luaG_runerror(L, "'for' limit must be a number"); |
1037 | setfltvalue(plimit, nlimit); | 1037 | setfltvalue(plimit, nlimit); |
1038 | if (!tonumber(pstep, &nstep)) | 1038 | if (!tonumber(pstep, &nstep)) |
1039 | luaG_runerror(L, LUA_QL("for") " step must be a number"); | 1039 | luaG_runerror(L, "'for' step must be a number"); |
1040 | setfltvalue(pstep, nstep); | 1040 | setfltvalue(pstep, nstep); |
1041 | if (!tonumber(init, &ninit)) | 1041 | if (!tonumber(init, &ninit)) |
1042 | luaG_runerror(L, LUA_QL("for") " initial value must be a number"); | 1042 | luaG_runerror(L, "'for' initial value must be a number"); |
1043 | setfltvalue(init, luai_numsub(L, ninit, nstep)); | 1043 | setfltvalue(init, luai_numsub(L, ninit, nstep)); |
1044 | } | 1044 | } |
1045 | ci->u.l.savedpc += GETARG_sBx(i); | 1045 | ci->u.l.savedpc += GETARG_sBx(i); |