Skip to content

swizl/lua_cn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

基于 Lua 5.3.4, 增加名称识别,添加中文关键字。

llex.c:

/* ORDER RESERVED */
static const char *const luaX_tokens [] = {
    "and", "break", "do", "else", "elseif",
    "end", "false", "for", "function", "goto", "if",
    "in", "local", "nil", "not", "or", "repeat",
    "return", "then", "true", "until", "while",
    "//", "..", "...", "==", ">=", "<=", "~=",
    "<<", ">>", "::", "<eof>",
    "<number>", "<integer>", "<name>", "<string>"
};

#if defined(CJKV_SUPPORT)
static const char *const luaX_cn_tokens [] = {
	"与", "跳出", "运行", "另", "另如",
	"结束", "假", "对于", "方法", "跳转", "如",
	"中", "本地", "无", "非", "或", "重复",
	"返回", "则", "真", "直到", "每当"
};
#endif

lbaselib.c:

static const luaL_Reg base_funcs[] = {
  {"assert", luaB_assert},
  {"collectgarbage", luaB_collectgarbage},
  {"dofile", luaB_dofile},
  {"error", luaB_error},
  {"getmetatable", luaB_getmetatable},
  {"ipairs", luaB_ipairs},
  {"loadfile", luaB_loadfile},
  {"load", luaB_load},
#if defined(LUA_COMPAT_LOADSTRING)
  {"loadstring", luaB_load},
#endif
  {"next", luaB_next},
  {"pairs", luaB_pairs},
  {"pcall", luaB_pcall},
  {"print", luaB_print},
  {"rawequal", luaB_rawequal},
  {"rawlen", luaB_rawlen},
  {"rawget", luaB_rawget},
  {"rawset", luaB_rawset},
  {"select", luaB_select},
  {"setmetatable", luaB_setmetatable},
  {"tonumber", luaB_tonumber},
  {"tostring", luaB_tostring},
  {"type", luaB_type},
  {"xpcall", luaB_xpcall},
#if defined(CJKV_SUPPORT)
  {"执行文件", luaB_dofile},
  {"加载文件", luaB_loadfile},
  {"加载", luaB_load},
#if defined(LUA_COMPAT_LOADSTRING)
  {"加载字串", luaB_load},
#endif
  {"成对", luaB_pairs},
  {"打印", luaB_print},
  {"到数字", luaB_tonumber},
  {"到字串", luaB_tostring},
  {"类型", luaB_type},
#endif
  /* placeholders */
  {"_G", NULL},
  {"_VERSION", NULL},
  {NULL, NULL}
};

测试:
lua main.lua

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published