aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-16 11:45:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-16 11:45:55 -0300
commitda19c436cc361401563eeda2cca3d161a6ddeef7 (patch)
tree9d2d7e3f6c00d88dc659d123c79d4157ffd36ffb /llex.c
parent0039feb9dae27e25c0c719f49d954741fb2babf3 (diff)
downloadlua-da19c436cc361401563eeda2cca3d161a6ddeef7.tar.gz
lua-da19c436cc361401563eeda2cca3d161a6ddeef7.tar.bz2
lua-da19c436cc361401563eeda2cca3d161a6ddeef7.zip
cleaning the stage for generational collection
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/llex.c b/llex.c
index 27f11134..339b92a1 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.107 2002/07/08 18:14:36 roberto Exp roberto $ 2** $Id: llex.c,v 1.108 2002/07/10 20:43:53 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*/
@@ -39,8 +39,9 @@ void luaX_init (lua_State *L) {
39 int i; 39 int i;
40 for (i=0; i<NUM_RESERVED; i++) { 40 for (i=0; i<NUM_RESERVED; i++) {
41 TString *ts = luaS_new(L, token2string[i]); 41 TString *ts = luaS_new(L, token2string[i]);
42 luaS_fix(ts); /* reserved words are never collected */
42 lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN); 43 lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN);
43 ts->tsv.marked = cast(unsigned short, RESERVEDMARK+i); /* reserved word */ 44 ts->tsv.reserved = cast(lu_byte, i+1); /* reserved word */
44 } 45 }
45} 46}
46 47
@@ -388,8 +389,8 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) {
388 /* identifier or reserved word */ 389 /* identifier or reserved word */
389 size_t l = readname(LS); 390 size_t l = readname(LS);
390 TString *ts = luaS_newlstr(LS->L, cast(char *, G(LS->L)->Mbuffer), l); 391 TString *ts = luaS_newlstr(LS->L, cast(char *, G(LS->L)->Mbuffer), l);
391 if (ts->tsv.marked >= RESERVEDMARK) /* reserved word? */ 392 if (ts->tsv.reserved > 0) /* reserved word? */
392 return ts->tsv.marked-RESERVEDMARK+FIRST_RESERVED; 393 return ts->tsv.reserved - 1 + FIRST_RESERVED;
393 seminfo->ts = ts; 394 seminfo->ts = ts;
394 return TK_NAME; 395 return TK_NAME;
395 } 396 }