Explorar el Código

field 'reserved' -> 'extra' (may be used for other purposes too)

Roberto Ierusalimschy hace 13 años
padre
commit
291f564485
Se han modificado 3 ficheros con 7 adiciones y 7 borrados
  1. 4 4
      llex.c
  2. 1 1
      lobject.h
  3. 2 2
      lstring.c

+ 4 - 4
llex.c

@@ -1,5 +1,5 @@
 /*
-** $Id: llex.c,v 2.59 2011/11/30 12:43:51 roberto Exp roberto $
+** $Id: llex.c,v 2.60 2012/01/20 18:35:36 roberto Exp roberto $
 ** Lexical Analyzer
 ** See Copyright Notice in lua.h
 */
@@ -67,7 +67,7 @@ void luaX_init (lua_State *L) {
   for (i=0; i<NUM_RESERVED; i++) {
     TString *ts = luaS_new(L, luaX_tokens[i]);
     luaS_fix(ts);  /* reserved words are never collected */
-    ts->tsv.reserved = cast_byte(i+1);  /* reserved word */
+    ts->tsv.extra = cast_byte(i+1);  /* reserved word */
   }
 }
 
@@ -491,8 +491,8 @@ static int llex (LexState *ls, SemInfo *seminfo) {
           ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
                                   luaZ_bufflen(ls->buff));
           seminfo->ts = ts;
-          if (ts->tsv.reserved > 0)  /* reserved word? */
-            return ts->tsv.reserved - 1 + FIRST_RESERVED;
+          if (isreserved(ts))  /* reserved word? */
+            return ts->tsv.extra - 1 + FIRST_RESERVED;
           else {
             return TK_NAME;
           }

+ 1 - 1
lobject.h

@@ -409,7 +409,7 @@ typedef union TString {
   L_Umaxalign dummy;  /* ensures maximum alignment for strings */
   struct {
     CommonHeader;
-    lu_byte reserved;
+    lu_byte extra;  /* reserved words for strings */
     unsigned int hash;
     size_t len;  /* number of characters in string */
   } tsv;

+ 2 - 2
lstring.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstring.c,v 2.18 2010/05/10 18:23:45 roberto Exp roberto $
+** $Id: lstring.c,v 2.19 2011/05/03 16:01:57 roberto Exp roberto $
 ** String table (keeps all strings handled by Lua)
 ** See Copyright Notice in lua.h
 */
@@ -65,7 +65,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l,
   ts = &luaC_newobj(L, LUA_TSTRING, totalsize, list, 0)->ts;
   ts->tsv.len = l;
   ts->tsv.hash = h;
-  ts->tsv.reserved = 0;
+  ts->tsv.extra = 0;
   memcpy(ts+1, str, l*sizeof(char));
   ((char *)(ts+1))[l] = '\0';  /* ending 0 */
   tb->nuse++;