|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: llex.c,v 2.66 2013/05/14 15:59:04 roberto Exp roberto $
|
|
|
+** $Id: llex.c,v 2.67 2013/06/19 14:27:00 roberto Exp roberto $
|
|
|
** Lexical Analyzer
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -15,6 +15,7 @@
|
|
|
|
|
|
#include "lctype.h"
|
|
|
#include "ldo.h"
|
|
|
+#include "lgc.h"
|
|
|
#include "llex.h"
|
|
|
#include "lobject.h"
|
|
|
#include "lparser.h"
|
|
@@ -64,9 +65,11 @@ 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 */
|
|
|
+ luaC_fix(L, obj2gco(e)); /* never collect this name */
|
|
|
for (i=0; i<NUM_RESERVED; i++) {
|
|
|
TString *ts = luaS_new(L, luaX_tokens[i]);
|
|
|
- luaS_fix(ts); /* reserved words are never collected */
|
|
|
+ luaC_fix(L, obj2gco(ts)); /* reserved words are never collected */
|
|
|
ts->tsv.extra = cast_byte(i+1); /* reserved word */
|
|
|
}
|
|
|
}
|
|
@@ -163,8 +166,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); /* create env name */
|
|
|
- luaS_fix(ls->envn); /* never collect this name */
|
|
|
+ ls->envn = luaS_new(L, LUA_ENV); /* get env name */
|
|
|
luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */
|
|
|
}
|
|
|
|