summaryrefslogtreecommitdiff
path: root/src/lua51/llex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua51/llex.c')
-rw-r--r--src/lua51/llex.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lua51/llex.c b/src/lua51/llex.c
index 88c6790..fe4e3ee 100644
--- a/src/lua51/llex.c
+++ b/src/lua51/llex.c
@@ -33,6 +33,7 @@
#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r')
+//c 对应RESERVED中的枚举, tokens
/* ORDER RESERVED */
const char *const luaX_tokens [] = {
"and", "break", "do", "else", "elseif",
@@ -61,12 +62,15 @@ static void save (LexState *ls, int c) {
}
+//c 设置保留字
void luaX_init (lua_State *L) {
int i;
for (i=0; i<NUM_RESERVED; i++) {
TString *ts = luaS_new(L, luaX_tokens[i]);
luaS_fix(ts); /* reserved words are never collected */
lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN);
+ //c 标记这个字符串为保留字,即不为零
+ //c luaX_tokens中的索引
ts->tsv.reserved = cast_byte(i+1); /* reserved word */
}
}