Browse Source

better quotes for strings in error messages

Roberto Ierusalimschy 20 năm trước cách đây
mục cha
commit
c2bb9abcec
16 tập tin đã thay đổi với 85 bổ sung78 xóa
  1. 7 5
      lauxlib.c
  2. 5 3
      lbaselib.c
  3. 4 3
      ldblib.c
  4. 3 4
      ldebug.c
  5. 1 3
      liolib.c
  6. 2 2
      llex.c
  7. 14 12
      loadlib.c
  8. 2 2
      lobject.c
  9. 3 3
      loslib.c
  10. 7 7
      lparser.c
  11. 6 8
      lstrlib.c
  12. 2 2
      ltable.c
  13. 2 2
      ltablib.c
  14. 7 7
      lua.c
  15. 16 11
      luaconf.h
  16. 4 4
      lvm.c

+ 7 - 5
lauxlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lauxlib.c,v 1.130 2005/03/16 16:58:41 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.131 2005/05/16 19:21:11 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -47,11 +47,12 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
   if (strcmp(ar.namewhat, "method") == 0) {
     narg--;  /* do not count `self' */
     if (narg == 0)  /* error is in the self argument itself? */
-      return luaL_error(L, "calling `%s' on bad self (%s)", ar.name, extramsg);
+      return luaL_error(L, "calling " LUA_SM " on bad self (%s)",
+                           ar.name, extramsg);
   }
   if (ar.name == NULL)
     ar.name = "?";
-  return luaL_error(L, "bad argument #%d to `%s' (%s)",
+  return luaL_error(L, "bad argument #%d to " LUA_SM " (%s)",
                         narg, ar.name, extramsg);
 }
 
@@ -244,7 +245,7 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname,
       luaL_setfield(L, LUA_GLOBALSINDEX, libname);
     }
     else if (!lua_istable(L, -1))
-      luaL_error(L, "name conflict for library `%s'", libname);
+      luaL_error(L, "name conflict for library " LUA_SM, libname);
     lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
     lua_pushvalue(L, -2);
     lua_setfield(L, -2, libname);  /* _LOADED[modname] = new table */
@@ -365,7 +366,8 @@ LUALIB_API const char *luaL_searchpath (lua_State *L, const char *name,
   for (;;) {
     const char *fname;
     if ((p = pushnexttemplate(L, p)) == NULL) {
-      lua_pushfstring(L, "no readable `%s' in path `%s'", name, path);
+      lua_pushfstring(L, "no readable " LUA_SM " in path " LUA_SM "",
+                         name, path);
       return NULL;
     }
     fname = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name);

+ 5 - 3
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.173 2005/03/28 17:17:53 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.174 2005/05/16 19:21:11 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -39,7 +39,8 @@ static int luaB_print (lua_State *L) {
     lua_call(L, 1, 1);
     s = lua_tostring(L, -1);  /* get result */
     if (s == NULL)
-      return luaL_error(L, "`tostring' must return a string to `print'");
+      return luaL_error(L, LUA_SM " must return a string to " LUA_SM,
+                           "tostring", "print");
     if (i>1) fputs("\t", stdout);
     fputs(s, stdout);
     lua_pop(L, 1);  /* pop result */
@@ -148,7 +149,8 @@ static int luaB_setfenv (lua_State *L) {
     return 0;
   }
   else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
-    luaL_error(L, "`setfenv' cannot change environment of given object");
+    luaL_error(L, LUA_SM " cannot change environment of given object",
+                  "setfenv");
   return 1;
 }
 

+ 4 - 3
ldblib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldblib.c,v 1.95 2005/05/05 20:47:02 roberto Exp roberto $
+** $Id: ldblib.c,v 1.96 2005/05/16 18:45:15 roberto Exp roberto $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -48,7 +48,8 @@ static int db_setfenv (lua_State *L) {
   luaL_checktype(L, 2, LUA_TTABLE);
   lua_settop(L, 2);
   if (lua_setfenv(L, 1) == 0)
-    luaL_error(L, "`setfenv' cannot change environment of given object");
+    luaL_error(L, LUA_SM " cannot change environment of given object",
+                  "setfenv");
   return 1;
 }
 
@@ -347,7 +348,7 @@ static int db_errorfb (lua_State *L) {
     if (ar.currentline > 0)
       lua_pushfstring(L, "%d:", ar.currentline);
     if (*ar.namewhat != '\0')  /* is there a name? */
-        lua_pushfstring(L, " in function `%s'", ar.name);
+        lua_pushfstring(L, " in function " LUA_SM, ar.name);
     else {
       if (*ar.what == 'm')  /* main? */
         lua_pushfstring(L, " in main chunk");

+ 3 - 4
ldebug.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldebug.c,v 2.17 2005/05/05 20:47:02 roberto Exp roberto $
+** $Id: ldebug.c,v 2.18 2005/05/16 18:45:15 roberto Exp roberto $
 ** Debug Interface
 ** See Copyright Notice in lua.h
 */
@@ -236,8 +236,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
   lua_lock(L);
   if (*what == '>') {
     StkId func = L->top - 1;
-    if (!ttisfunction(func))
-      luaG_runerror(L, "value for `lua_getinfo' is not a function");
+    luai_apicheck(L, ttisfunction(func));
     what++;  /* skip the '>' */
     f = clvalue(func);
     L->top--;  /* pop function */
@@ -549,7 +548,7 @@ void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
   const char *kind = (isinstack(L->ci, o)) ?
                          getobjname(L, L->ci, o - L->base, &name) : NULL;
   if (kind)
-    luaG_runerror(L, "attempt to %s %s `%s' (a %s value)",
+    luaG_runerror(L, "attempt to %s %s " LUA_SM " (a %s value)",
                 op, kind, name, t);
   else
     luaG_runerror(L, "attempt to %s a %s value", op, t);

+ 1 - 3
liolib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: liolib.c,v 2.58 2005/02/18 12:40:02 roberto Exp roberto $
+** $Id: liolib.c,v 2.59 2005/03/18 18:01:14 roberto Exp roberto $
 ** Standard I/O (and system) library
 ** See Copyright Notice in lua.h
 */
@@ -319,8 +319,6 @@ static int g_read (lua_State *L, FILE *f, int first) {
             read_chars(L, f, ~((size_t)0));  /* read MAX_SIZE_T chars */
             success = 1; /* always success */
             break;
-          case 'w':  /* word */
-            return luaL_error(L, "obsolete option `*w' to `read'");
           default:
             return luaL_argerror(L, n, "invalid format");
         }

+ 2 - 2
llex.c

@@ -1,5 +1,5 @@
 /*
-** $Id: llex.c,v 2.9 2004/12/03 20:54:12 roberto Exp roberto $
+** $Id: llex.c,v 2.10 2005/04/27 18:37:51 roberto Exp roberto $
 ** Lexical Analyzer
 ** See Copyright Notice in lua.h
 */
@@ -102,7 +102,7 @@ void luaX_lexerror (LexState *ls, const char *msg, int token) {
   luaO_chunkid(buff, getstr(ls->source), MAXSRC);
   msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg);
   if (token)
-    luaO_pushfstring(ls->L, "%s near `%s'", msg, txtToken(ls, token));
+    luaO_pushfstring(ls->L, "%s near " LUA_SM, msg, txtToken(ls, token));
   luaD_throw(ls->L, LUA_ERRSYNTAX);
 }
 

+ 14 - 12
loadlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: loadlib.c,v 1.25 2005/03/30 19:50:29 roberto Exp roberto $
+** $Id: loadlib.c,v 1.26 2005/04/13 17:24:20 roberto Exp roberto $
 ** Dynamic library loader for Lua
 ** See Copyright Notice in lua.h
 **
@@ -191,7 +191,7 @@ static void *ll_load (lua_State *L, const char *path) {
 static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
   NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym);
   if (nss == NULL) {
-    lua_pushfstring(L, "symbol `%s' not found", sym);
+    lua_pushfstring(L, "symbol " LUA_SM " not found", sym);
     return NULL;
   }
   return (lua_CFunction)NSAddressOfSymbol(nss);
@@ -213,9 +213,9 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
 
 
 #if defined(__ELF__) || defined(__sun) || defined(sgi) || defined(__hpux)
-#define DLMSG "`loadlib' not enabled; check your Lua installation"
+#define DLMSG "'loadlib' not enabled; check your Lua installation"
 #else
-#define DLMSG		"`loadlib' not supported"
+#define DLMSG		"'loadlib' not supported"
 #endif
 
 static void ll_unloadlib (void *lib) {
@@ -327,11 +327,12 @@ static int loader_Lua (lua_State *L) {
     path = lua_tostring(L, -1);
   }
   if (path == NULL)
-    luaL_error(L, "`package.path' must be a string");
+    luaL_error(L, LUA_SM " must be a string", "package.path");
   fname = luaL_searchpath(L, fname, path);
   if (fname == NULL) return 0;  /* library not found in this path */
   if (luaL_loadfile(L, fname) != 0)
-    luaL_error(L, "error loading package `%s' (%s)", name, lua_tostring(L, -1));
+    luaL_error(L, "error loading package " LUA_SM " (%s)",
+                  name, lua_tostring(L, -1));
   return 1;  /* library loaded successfully */
 }
 
@@ -344,13 +345,14 @@ static int loader_C (lua_State *L) {
   lua_getfield(L, LUA_ENVIRONINDEX, "cpath");
   path = lua_tostring(L, -1);
   if (path == NULL)
-    luaL_error(L, "`package.cpath' must be a string");
+    luaL_error(L, LUA_SM " must be a string", "package.cpath");
   fname = luaL_searchpath(L, fname, path);
   if (fname == NULL) return 0;  /* library not found in this path */
   funcname = luaL_gsub(L, name, ".", LUA_OFSEP);
   funcname = lua_pushfstring(L, "%s%s", POF, funcname);
   if (ll_loadfunc(L, fname, funcname) != 1)
-    luaL_error(L, "error loading package `%s' (%s)", name, lua_tostring(L, -2));
+    luaL_error(L, "error loading package " LUA_SM " (%s)",
+                  name, lua_tostring(L, -2));
   return 1;  /* library loaded successfully */
 }
 
@@ -358,7 +360,7 @@ static int loader_C (lua_State *L) {
 static int loader_preload (lua_State *L) {
   lua_getfield(L, LUA_ENVIRONINDEX, "preload");
   if (!lua_istable(L, -1))
-    luaL_error(L, "`package.preload' must be a table");
+    luaL_error(L, LUA_SM " must be a table", "package.preload");
   lua_getfield(L, -1, luaL_checkstring(L, 1));
   return 1;
 }
@@ -378,11 +380,11 @@ static int ll_require (lua_State *L) {
   /* iterate over available loaders */
   lua_getfield(L, LUA_ENVIRONINDEX, "loaders");
   if (!lua_istable(L, -1))
-    luaL_error(L, "`package.loaders' must be a table");
+    luaL_error(L, LUA_SM " must be a table", "package.loaders");
   for (i=1;; i++) {
     lua_rawgeti(L, -1, i);  /* get a loader */
     if (lua_isnil(L, -1))
-      return luaL_error(L, "package `%s' not found", name);
+      return luaL_error(L, "package " LUA_SM " not found", name);
     lua_pushstring(L, name);
     lua_call(L, 1, 1);  /* call it */
     if (lua_isnil(L, -1)) lua_pop(L, 1);
@@ -421,7 +423,7 @@ static int ll_module (lua_State *L) {
     luaL_setfield(L, LUA_GLOBALSINDEX, modname);
   }
   else if (!lua_istable(L, -1))
-    return luaL_error(L, "name conflict for module `%s'", modname);
+    return luaL_error(L, "name conflict for module " LUA_SM, modname);
   /* check whether table already has a _NAME field */
   lua_getfield(L, -1, "_NAME");
   if (!lua_isnil(L, -1))  /* is table an initialized module? */

+ 2 - 2
lobject.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.c,v 2.11 2005/03/09 16:28:07 roberto Exp roberto $
+** $Id: lobject.c,v 2.12 2005/03/28 12:53:40 roberto Exp roberto $
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -184,7 +184,7 @@ void luaO_chunkid (char *out, const char *source, int bufflen) {
     if (*source == '@') {
       int l;
       source++;  /* skip the `@' */
-      bufflen -= sizeof(" `...' ");
+      bufflen -= sizeof(" '...' ");
       l = strlen(source);
       strcpy(out, "");
       if (l>bufflen) {

+ 3 - 3
loslib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: loslib.c,v 1.6 2005/03/09 16:28:07 roberto Exp roberto $
+** $Id: loslib.c,v 1.7 2005/03/18 18:02:04 roberto Exp roberto $
 ** Standard Operating System library
 ** See Copyright Notice in lua.h
 */
@@ -113,7 +113,7 @@ static int getfield (lua_State *L, const char *key, int d) {
     res = (int)lua_tointeger(L, -1);
   else {
     if (d < 0)
-      return luaL_error(L, "field `%s' missing in date table", key);
+      return luaL_error(L, "field " LUA_SM " missing in date table", key);
     res = d;
   }
   lua_pop(L, 1);
@@ -151,7 +151,7 @@ static int io_date (lua_State *L) {
     if (strftime(b, sizeof(b), s, stm))
       lua_pushstring(L, b);
     else
-      return luaL_error(L, "`date' format too long");
+      return luaL_error(L, LUA_SM " format too long", "date");
   }
   return 1;
 }

+ 7 - 7
lparser.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lparser.c,v 2.24 2005/05/04 20:42:28 roberto Exp roberto $
+** $Id: lparser.c,v 2.25 2005/05/05 20:47:02 roberto Exp roberto $
 ** Lua Parser
 ** See Copyright Notice in lua.h
 */
@@ -82,7 +82,7 @@ static void anchor_token (LexState *ls) {
 
 static void error_expected (LexState *ls, int token) {
   luaX_syntaxerror(ls,
-         luaO_pushfstring(ls->L, "`%s' expected", luaX_token2str(ls, token)));
+      luaO_pushfstring(ls->L, LUA_SM " expected", luaX_token2str(ls, token)));
 }
 
 
@@ -125,7 +125,7 @@ static void check_match (LexState *ls, int what, int who, int where) {
       error_expected(ls, what);
     else {
       luaX_syntaxerror(ls, luaO_pushfstring(ls->L,
-             "`%s' expected (to close `%s' at line %d)",
+             LUA_SM " expected (to close " LUA_SM " at line %d)",
               luaX_token2str(ls, what), luaX_token2str(ls, who), where));
     }
   }
@@ -577,7 +577,7 @@ static void parlist (LexState *ls) {
           f->is_vararg = 1;
           break;
         }
-        default: luaX_syntaxerror(ls, "<name> or `...' expected");
+        default: luaX_syntaxerror(ls, "<name> or '...' expected");
       }
     } while (!f->is_vararg && testnext(ls, ','));
   }
@@ -765,7 +765,7 @@ static void simpleexp (LexState *ls, expdesc *v) {
     case TK_DOTS: {  /* vararg */
       FuncState *fs = ls->fs;
       check_condition(ls, fs->f->is_vararg,
-                      "cannot use `...' outside a vararg function");
+                      "cannot use '...' outside a vararg function");
       fs->f->is_vararg = NEWSTYLEVARARG;
       init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
       break;
@@ -1017,7 +1017,7 @@ static void whilestat (LexState *ls, int line) {
   fs->jpc = NO_JUMP;
   sizeexp = fs->pc - expinit;  /* size of expression code */
   if (sizeexp > LUAI_MAXEXPWHILE) 
-    luaX_syntaxerror(ls, "`while' condition too complex");
+    luaX_syntaxerror(ls, "'while' condition too complex");
   for (i = 0; i < sizeexp; i++)  /* save `exp' code */
     codeexp[i] = fs->f->code[expinit + i];
   fs->pc = expinit;  /* remove `exp' code */
@@ -1141,7 +1141,7 @@ static void forstat (LexState *ls, int line) {
   switch (ls->t.token) {
     case '=': fornum(ls, varname, line); break;
     case ',': case TK_IN: forlist(ls, varname); break;
-    default: luaX_syntaxerror(ls, "`=' or `in' expected");
+    default: luaX_syntaxerror(ls, "'=' or 'in' expected");
   }
   check_match(ls, TK_END, TK_FOR, line);
   leaveblock(fs);  /* loop scope (`break' jumps to this point) */

+ 6 - 8
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.112 2005/05/05 15:34:03 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.113 2005/05/16 19:21:11 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -200,14 +200,14 @@ static const char *classend (MatchState *ms, const char *p) {
   switch (*p++) {
     case L_ESC: {
       if (*p == '\0')
-        luaL_error(ms->L, "malformed pattern (ends with `%%')");
+        luaL_error(ms->L, "malformed pattern (ends with '%%')");
       return p+1;
     }
     case '[': {
       if (*p == '^') p++;
       do {  /* look for a `]' */
         if (*p == '\0')
-          luaL_error(ms->L, "malformed pattern (missing `]')");
+          luaL_error(ms->L, "malformed pattern (missing ']')");
         if (*(p++) == L_ESC && *p != '\0')
           p++;  /* skip escapes (e.g. `%]') */
       } while (*p != ']');
@@ -382,7 +382,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
           const char *ep; char previous;
           p += 2;
           if (*p != '[')
-            luaL_error(ms->L, "missing `[' after `%%f' in pattern");
+            luaL_error(ms->L, "missing '[' after '%%f' in pattern");
           ep = classend(ms, p);  /* points to what is next */
           previous = (s == ms->src_init) ? '\0' : *(s-1);
           if (matchbracketclass(uchar(previous), p, ep-1) ||
@@ -705,8 +705,6 @@ static int str_format (lua_State *L) {
       char form[MAX_FORMAT];  /* to store the format (`%...') */
       char buff[MAX_ITEM];  /* to store the formatted item */
       int hasprecision = 0;
-      if (isdigit(uchar(*strfrmt)) && *(strfrmt+1) == '$')
-        return luaL_error(L, "obsolete option (d$) to `format'");
       arg++;
       strfrmt = scanformat(L, strfrmt, form, &hasprecision);
       switch (*strfrmt++) {
@@ -725,7 +723,7 @@ static int str_format (lua_State *L) {
         }
         case 'q': {
           addquoted(L, &b, arg);
-          continue;  /* skip the `addsize' at the end */
+          continue;  /* skip the 'addsize' at the end */
         }
         case 's': {
           size_t l;
@@ -743,7 +741,7 @@ static int str_format (lua_State *L) {
           }
         }
         default: {  /* also treat cases `pnLlh' */
-          return luaL_error(L, "invalid option to `format'");
+          return luaL_error(L, "invalid option to " LUA_SM, "format");
         }
       }
       luaL_addlstring(&b, buff, strlen(buff));

+ 2 - 2
ltable.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltable.c,v 2.20 2005/04/01 13:51:37 roberto Exp roberto $
+** $Id: ltable.c,v 2.21 2005/05/03 19:30:17 roberto Exp roberto $
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 */
@@ -151,7 +151,7 @@ static int findindex (lua_State *L, Table *t, StkId key) {
       }
       else n = gnext(n);
     } while (n);
-    luaG_runerror(L, "invalid key for `next'");  /* key not found */
+    luaG_runerror(L, "invalid key to " LUA_SM, "next");  /* key not found */
     return 0;  /* to avoid warnings */
   }
 }

+ 2 - 2
ltablib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltablib.c,v 1.28 2005/03/16 16:58:41 roberto Exp roberto $
+** $Id: ltablib.c,v 1.29 2005/03/28 17:17:53 roberto Exp roberto $
 ** Library for Table Manipulation
 ** See Copyright Notice in lua.h
 */
@@ -65,7 +65,7 @@ static int setn (lua_State *L) {
 #ifndef luaL_setn
   luaL_setn(L, 1, luaL_checkint(L, 2));
 #else
-  luaL_error(L, "`setn' is obsolete");
+  luaL_error(L, LUA_SM " is obsolete", "setn");
 #endif
   lua_pushvalue(L, 1);
   return 1;

+ 7 - 7
lua.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lua.c,v 1.141 2005/04/11 18:01:35 roberto Exp roberto $
+** $Id: lua.c,v 1.142 2005/04/13 17:24:20 roberto Exp roberto $
 ** Lua stand-alone interpreter
 ** See Copyright Notice in lua.h
 */
@@ -44,9 +44,9 @@ static void print_usage (void) {
   "usage: %s [options] [script [args]].\n"
   "Available options are:\n"
   "  -        execute stdin as a file\n"
-  "  -e stat  execute string `stat'\n"
-  "  -i       enter interactive mode after executing `script'\n"
-  "  -l name  require library `name'\n"
+  "  -e stat  execute string 'stat'\n"
+  "  -i       enter interactive mode after executing 'script'\n"
+  "  -l name  require library 'name'\n"
   "  -v       show version information\n"
   "  -w       trap access to undefined globals\n"
   "  --       stop handling options\n" ,
@@ -149,7 +149,7 @@ static const char *get_prompt (lua_State *L, int firstline) {
 
 static int incomplete (lua_State *L, int status) {
   if (status == LUA_ERRSYNTAX &&
-         strstr(lua_tostring(L, -1), "near `<eof>'") != NULL) {
+         strstr(lua_tostring(L, -1), "<eof>") != NULL) {
     lua_pop(L, 1);
     return 1;
   }
@@ -209,7 +209,7 @@ static void dotty (lua_State *L) {
       lua_getglobal(L, "print");
       lua_insert(L, 1);
       if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0)
-        l_message(progname, lua_pushfstring(L, "error calling `print' (%s)",
+        l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)",
                                                lua_tostring(L, -1)));
     }
   }
@@ -222,7 +222,7 @@ static void dotty (lua_State *L) {
 static int checkvar (lua_State *L) {
   const char *name = lua_tostring(L, 2);
   if (name)
-    luaL_error(L, "attempt to access undefined variable `%s'", name);
+    luaL_error(L, "attempt to access undefined variable " LUA_SM, name);
   return 0;
 }
 

+ 16 - 11
luaconf.h

@@ -1,5 +1,5 @@
 /*
-** $Id: luaconf.h,v 1.46 2005/04/29 13:53:59 roberto Exp $
+** $Id: luaconf.h,v 1.47 2005/05/03 19:30:17 roberto Exp roberto $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */
@@ -140,6 +140,11 @@
 #define lua_assert(c)		((void)0)
 
 
+/*
+@@ LUA_SM describes how variable strings appear in error messages.
+** CHANGE it if you want a different appearance.
+*/
+#define LUA_SM		"'%s'"
 
 /*
 ** {==================================================================
@@ -151,7 +156,7 @@
 
 /*
 @@ lua_stdin_is_tty is a function to detect whether the standard input is
-@* a `tty' (that is, is interactive).
+@* a 'tty' (that is, is interactive).
 ** CHANGE it if you have a better definition for non-POSIX/non-Windows
 ** systems.
 */
@@ -238,7 +243,7 @@
 ** collection. (Higher values mean coarser collections. 0 represents
 ** infinity, where each step performs a full collection.)
 */
-#define LUAI_GCMUL	200 /* GC runs `twice the speed' of memory allocation */
+#define LUAI_GCMUL	200 /* GC runs 'twice the speed' of memory allocation */
 
 
 /*
@@ -250,22 +255,22 @@
 
 /*
 @@ LUA_COMPAT_PATH controls compatibility about LUA_PATH.
-** CHANGE it to 1 if you want `require' to look for global LUA_PATH
+** CHANGE it to 1 if you want 'require' to look for global LUA_PATH
 ** before checking package.path.
 */
 #define LUA_COMPAT_PATH		0
 
 /*
 @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
-** CHANGE it to 1 if you want a global `loadlib' function (otherwise
-** the function is only available as `package.loadlib').
+** CHANGE it to 1 if you want a global 'loadlib' function (otherwise
+** the function is only available as 'package.loadlib').
 */
 #define LUA_COMPAT_LOADLIB	1
 
 /*
 @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
-** CHANGE it to 1 if you want vararg functions that do not use `...'
-** to get an `arg' table with their extra arguments.
+** CHANGE it to 1 if you want vararg functions that do not use '...'
+** to get an 'arg' table with their extra arguments.
 */
 #define LUA_COMPAT_VARARG	1
 
@@ -317,7 +322,7 @@
 @@ LUAI_MEM is an a signed integer big enough to count the total memory
 @* used by Lua.
 ** CHANGE here if for some weird reason the default definitions are not
-** good enough for your machine. (The `else' definition always works,
+** good enough for your machine. (The 'else' definition always works,
 ** but may waste space on machines with 64-bit longs.) Probably you do
 ** not need to change this.
 */
@@ -393,7 +398,7 @@
 
 /*
 @@ LUAI_MAXEXPWHILE is the maximum size of code for expressions
-@* controling a `while' loop.
+@* controling a 'while' loop.
 */
 #define LUAI_MAXEXPWHILE	100
 
@@ -466,7 +471,7 @@
 
 /*
 @@ LUA_NUMBER is the type of numbers in Lua.
-@@ LUAI_UACNUMBER is the result of an `usual argument conversion'
+@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
 @* over a number.
 */
 #define LUA_NUMBER	double

+ 4 - 4
lvm.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.c,v 2.41 2005/05/03 19:30:17 roberto Exp roberto $
+** $Id: lvm.c,v 2.42 2005/05/04 20:42:28 roberto Exp roberto $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -688,11 +688,11 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
         const TValue *pstep = ra+2;
         L->savedpc = pc;  /* next steps may throw errors */
         if (!tonumber(init, ra))
-          luaG_runerror(L, "`for' initial value must be a number");
+          luaG_runerror(L, "'for' initial value must be a number");
         else if (!tonumber(plimit, ra+1))
-          luaG_runerror(L, "`for' limit must be a number");
+          luaG_runerror(L, "'for' limit must be a number");
         else if (!tonumber(pstep, ra+2))
-          luaG_runerror(L, "`for' step must be a number");
+          luaG_runerror(L, "'for' step must be a number");
         setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
         dojump(L, pc, GETARG_sBx(i));
         continue;