|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: llex.c,v 2.5 2004/11/24 19:16:03 roberto Exp roberto $
|
|
|
+** $Id: llex.c,v 2.6 2004/12/01 15:46:18 roberto Exp roberto $
|
|
|
** Lexical Analyzer
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -32,13 +32,14 @@
|
|
|
|
|
|
|
|
|
/* ORDER RESERVED */
|
|
|
-static const char *const token2string [] = {
|
|
|
+const char *const luaX_tokens [] = {
|
|
|
"and", "break", "do", "else", "elseif",
|
|
|
"end", "false", "for", "function", "if",
|
|
|
"in", "local", "nil", "not", "or", "repeat",
|
|
|
"return", "then", "true", "until", "while", "*name",
|
|
|
"..", "...", "==", ">=", "<=", "~=",
|
|
|
- "*number", "*string", "<eof>"
|
|
|
+ "*number", "*string", "<eof>",
|
|
|
+ NULL
|
|
|
};
|
|
|
|
|
|
|
|
@@ -61,9 +62,9 @@ static void save (LexState *ls, int c) {
|
|
|
void luaX_init (lua_State *L) {
|
|
|
int i;
|
|
|
for (i=0; i<NUM_RESERVED; i++) {
|
|
|
- TString *ts = luaS_new(L, token2string[i]);
|
|
|
+ TString *ts = luaS_new(L, luaX_tokens[i]);
|
|
|
luaS_fix(ts); /* reserved words are never collected */
|
|
|
- lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN);
|
|
|
+ lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN);
|
|
|
ts->tsv.reserved = cast(lu_byte, i+1); /* reserved word */
|
|
|
}
|
|
|
}
|
|
@@ -79,7 +80,7 @@ const char *luaX_token2str (LexState *ls, int token) {
|
|
|
luaO_pushfstring(ls->L, "%c", token);
|
|
|
}
|
|
|
else
|
|
|
- return token2string[token-FIRST_RESERVED];
|
|
|
+ return luaX_tokens[token-FIRST_RESERVED];
|
|
|
}
|
|
|
|
|
|
|