diff --git a/lua/entities/gmod_wire_expression2/base/tokenizer.lua b/lua/entities/gmod_wire_expression2/base/tokenizer.lua index d5c7367a20..6e4cb498ba 100644 --- a/lua/entities/gmod_wire_expression2/base/tokenizer.lua +++ b/lua/entities/gmod_wire_expression2/base/tokenizer.lua @@ -15,6 +15,7 @@ AddCSLuaFile() local Trace, Warning, Error = E2Lib.Debug.Trace, E2Lib.Debug.Warning, E2Lib.Debug.Error +local ReservedWord = E2Lib.ReservedWord local tonumber = tonumber local string_find, string_gsub, string_sub = string.find, string.gsub, string.sub @@ -269,6 +270,7 @@ function Tokenizer:Next() elseif match == "false" then return Token.new(TokenVariant.Boolean, false) elseif string_sub(match, 1, 1) ~= "#" then + if ReservedWord[match] then self:Warning("'".. match .. "' is a reserved identifier and may break your code in the future") end return Token.new(TokenVariant.LowerIdent, match) end end diff --git a/lua/entities/gmod_wire_expression2/core/e2lib.lua b/lua/entities/gmod_wire_expression2/core/e2lib.lua index 205550ae97..e1db2c58d9 100644 --- a/lua/entities/gmod_wire_expression2/core/e2lib.lua +++ b/lua/entities/gmod_wire_expression2/core/e2lib.lua @@ -653,6 +653,59 @@ local Keyword = { E2Lib.Keyword = Keyword +--- A list of every word that we might use in the future +E2Lib.ReservedWord = { + abstract = true, + as = true, + await = true, + async = true, + class = true, + constructor = true, + debugger = true, + declare = true, + default = true, + delete = true, + enum = true, + export = true, + extends = true, + ["false"] = true, + finally = true, + from = true, + implements = true, + import = true, + ["in"] = true, + instanceof = true, + interface = true, + match = true, + macro = true, + mod = true, + module = true, + mut = true, + namespace = true, + new = true, + null = true, + of = true, + package = true, + private = true, + protected =true, + public = true, + require = true, + static = true, + struct = true, + super = true, + this = true, + throw = true, + throws = true, + ["true"] = true, + type = true, + typeof = true, + undefined = true, + union = true, + use = true, + yield = true, + var = true, +} + ---@type table E2Lib.KeywordLookup = {}