diff options
Diffstat (limited to 'llex.c')
| -rw-r--r-- | llex.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 2.66 2013/05/14 15:59:04 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.67 2013/06/19 14:27:00 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 | */ |
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include "lctype.h" | 16 | #include "lctype.h" |
| 17 | #include "ldo.h" | 17 | #include "ldo.h" |
| 18 | #include "lgc.h" | ||
| 18 | #include "llex.h" | 19 | #include "llex.h" |
| 19 | #include "lobject.h" | 20 | #include "lobject.h" |
| 20 | #include "lparser.h" | 21 | #include "lparser.h" |
| @@ -64,9 +65,11 @@ static void save (LexState *ls, int c) { | |||
| 64 | 65 | ||
| 65 | void luaX_init (lua_State *L) { | 66 | void luaX_init (lua_State *L) { |
| 66 | int i; | 67 | int i; |
| 68 | TString *e = luaS_new(L, LUA_ENV); /* create env name */ | ||
| 69 | luaC_fix(L, obj2gco(e)); /* never collect this name */ | ||
| 67 | for (i=0; i<NUM_RESERVED; i++) { | 70 | for (i=0; i<NUM_RESERVED; i++) { |
| 68 | TString *ts = luaS_new(L, luaX_tokens[i]); | 71 | TString *ts = luaS_new(L, luaX_tokens[i]); |
| 69 | luaS_fix(ts); /* reserved words are never collected */ | 72 | luaC_fix(L, obj2gco(ts)); /* reserved words are never collected */ |
| 70 | ts->tsv.extra = cast_byte(i+1); /* reserved word */ | 73 | ts->tsv.extra = cast_byte(i+1); /* reserved word */ |
| 71 | } | 74 | } |
| 72 | } | 75 | } |
| @@ -163,8 +166,7 @@ void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, | |||
| 163 | ls->linenumber = 1; | 166 | ls->linenumber = 1; |
| 164 | ls->lastline = 1; | 167 | ls->lastline = 1; |
| 165 | ls->source = source; | 168 | ls->source = source; |
| 166 | ls->envn = luaS_new(L, LUA_ENV); /* create env name */ | 169 | ls->envn = luaS_new(L, LUA_ENV); /* get env name */ |
| 167 | luaS_fix(ls->envn); /* never collect this name */ | ||
| 168 | luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ | 170 | luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ |
| 169 | } | 171 | } |
| 170 | 172 | ||
