summaryrefslogtreecommitdiff
path: root/src/lua51/llex.c
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-07-20 09:42:30 +0800
committerchai <chaifix@163.com>2020-07-20 09:42:30 +0800
commit77ac95b9985f5669d6659bfb54728786d28c2ef0 (patch)
treeab42f7da14ffbd9ba72f503baff71b44298b113a /src/lua51/llex.c
parentc5d9668a1b7092262b7132679e961a5297da2f75 (diff)
*misc
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 */
}
}