diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-07-30 21:12:16 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-07-30 21:12:16 -0300 |
commit | 4b365cdab1296bc88509c6f8610318adefb0ef0e (patch) | |
tree | 528741562b21cc0d81d7c71aca3eaee5e8433934 /luatokens.lua | |
parent | af3acfbb80bca7447af9fe0d4a34cf860163b218 (diff) |
It... kinda works?
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] = "~=", |