mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Add reserved words (#3201)
This commit is contained in:
parent
6a9bc3cd56
commit
254aa69180
@ -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
|
||||
|
@ -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<string, Keyword>
|
||||
E2Lib.KeywordLookup = {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user