diff options
Diffstat (limited to 'luatokens.lua')
-rw-r--r-- | luatokens.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/luatokens.lua b/luatokens.lua index 9ca19ac..12fbd24 100644 --- a/luatokens.lua +++ b/luatokens.lua @@ -89,6 +89,7 @@ local TK_AND, TK_BREAK, TK_SHL, TK_SHR, -- misc TK_DBCOLON, TK_EOS, + -- values/constants TK_FLT, TK_INT, TK_NAME, TK_STRING = {}, {}, {}, {}, {}, {}, {}, {}, {}, @@ -748,13 +749,16 @@ local tokens = { TK_DBCOLON = TK_DBCOLON, TK_EOS = TK_EOS, TK_FLT = TK_FLT, TK_INT = TK_INT, TK_NAME = TK_NAME, TK_STRING = TK_STRING } +local TK = {} for k,v in pairs(tokens) do setmetatable(v, {__name=k, __tostring=function(self) return getmetatable(self).__name end}) + TK[k:sub(4)] = v end return { defs = defs, tokens = tokens, + TK = TK, reverse_keywords = reverse_keywords, reverse_tokens = { [TK_IDIV] = "//", [TK_CONCAT] = "..", [TK_DOTS] = "...", [TK_EQ] = "==", [TK_GE] = ">=", [TK_LE] = "<=", [TK_NE] = "~=", |