添加注释

This commit is contained in:
2024-10-21 08:53:06 +08:00
parent 52bd9dda8e
commit f0aa32fbfb

View File

@@ -103,7 +103,7 @@ const char *luaX_token2str (LexState *ls, int token) {
}
}
// 返回token的字符串
static const char *txtToken (LexState *ls, int token) {
switch (token) {
case TK_NAME: case TK_STRING:
@@ -138,6 +138,10 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) {
** is irrelevant. We use the string itself as the value only because it
** is a TValue readily available. Later, the code generation can change
** this value.
创建一个新字符串并将其锚定在scanner的表中以便在编译结束之前不会收集它
到那时,它应该已经锚定在某个地方了。它还将长字符串内部化,确保每个唯一字符串只有一个副本。
这里的表用作一个集合:字符串作为键输入,而其值无关紧要。
我们使用字符串本身作为值只是因为它是一个现成的TValue。稍后代码生成可以更改此值。
*/
TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
lua_State *L = ls->L;