diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-06-21 19:42:06 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-06-21 19:42:06 +0000 |
commit | e79638b70be57501bb9995b24665a109188922fc (patch) | |
tree | 9482f9a9fcd5a461a6b9cf1b9742b3bc0df505bb /plugins/MirLua/src/lua/llex.c | |
parent | 8ba0d63234b84060efe27542bf317cb9cf50b3af (diff) |
MirLua: lua updated to 5.3.1
git-svn-id: http://svn.miranda-ng.org/main/trunk@14308 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/lua/llex.c')
-rw-r--r-- | plugins/MirLua/src/lua/llex.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/plugins/MirLua/src/lua/llex.c b/plugins/MirLua/src/lua/llex.c index 6e4a457ad6..c35bd55fa7 100644 --- a/plugins/MirLua/src/lua/llex.c +++ b/plugins/MirLua/src/lua/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.89 2014/11/14 16:06:09 roberto Exp $ +** $Id: llex.c,v 2.93 2015/05/22 17:45:56 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -16,6 +16,7 @@ #include "lua.h" #include "lctype.h" +#include "ldebug.h" #include "ldo.h" #include "lgc.h" #include "llex.h" @@ -68,7 +69,7 @@ static void save (LexState *ls, int c) { void luaX_init (lua_State *L) { int i; - TString *e = luaS_new(L, LUA_ENV); /* create env name */ + TString *e = luaS_newliteral(L, LUA_ENV); /* create env name */ luaC_fix(L, obj2gco(e)); /* never collect this name */ for (i=0; i<NUM_RESERVED; i++) { TString *ts = luaS_new(L, luaX_tokens[i]); @@ -106,9 +107,7 @@ static const char *txtToken (LexState *ls, int token) { static l_noret lexerror (LexState *ls, const char *msg, int token) { - char buff[LUA_IDSIZE]; - luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE); - msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber); if (token) luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); luaD_throw(ls->L, LUA_ERRSYNTAX); @@ -172,7 +171,7 @@ void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, ls->linenumber = 1; ls->lastline = 1; ls->source = source; - ls->envn = luaS_new(L, LUA_ENV); /* get env name */ + ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ } @@ -221,11 +220,6 @@ static void buffreplace (LexState *ls, char from, char to) { } -#if !defined(l_getlocaledecpoint) -#define l_getlocaledecpoint() (localeconv()->decimal_point[0]) -#endif - - #define buff2num(b,o) (luaO_str2num(luaZ_buffer(b), o) != 0) /* @@ -234,7 +228,7 @@ static void buffreplace (LexState *ls, char from, char to) { */ static void trydecpoint (LexState *ls, TValue *o) { char old = ls->decpoint; - ls->decpoint = l_getlocaledecpoint(); + ls->decpoint = lua_getlocaledecpoint(); buffreplace(ls, old, ls->decpoint); /* try new decimal separator */ if (!buff2num(ls->buff, o)) { /* format error with correct decimal point: no more options */ @@ -283,8 +277,9 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { /* -** skip a sequence '[=*[' or ']=*]' and return its number of '='s or -** -1 if sequence is malformed +** skip a sequence '[=*[' or ']=*]'; if sequence is wellformed, return +** its number of '='s; otherwise, return a negative number (-1 iff there +** are no '='s after initial bracket) */ static int skip_sep (LexState *ls) { int count = 0; @@ -501,8 +496,9 @@ static int llex (LexState *ls, SemInfo *seminfo) { read_long_string(ls, seminfo, sep); return TK_STRING; } - else if (sep == -1) return '['; - else lexerror(ls, "invalid long string delimiter", TK_STRING); + else if (sep != -1) /* '[=...' missing second bracket */ + lexerror(ls, "invalid long string delimiter", TK_STRING); + return '['; } case '=': { next(ls); |