Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions inspect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,10 @@ local function escape(str)
"%c", shortControlCharEscapes))
end

local luaKeywords = {
['and'] = true,
['break'] = true,
['do'] = true,
['else'] = true,
['elseif'] = true,
['end'] = true,
['false'] = true,
['for'] = true,
['function'] = true,
['goto'] = true,
['if'] = true,
['in'] = true,
['local'] = true,
['nil'] = true,
['not'] = true,
['or'] = true,
['repeat'] = true,
['return'] = true,
['then'] = true,
['true'] = true,
['until'] = true,
['while'] = true,
}
local luaKeywords = {}
for k in ([[ and break do else elseif end false for function goto if
in local nil not or repeat return then true until while
]]):gmatch('%w') do luaKeywords[k] = true end

local function isIdentifier(str)
return type(str) == "string" and
Expand Down
30 changes: 6 additions & 24 deletions inspect.tl
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,12 @@ local function escape(str: string): string
"%c", shortControlCharEscapes))
end

local luaKeywords: {string:boolean} = {
['and'] = true,
['break'] = true,
['do'] = true,
['else'] = true,
['elseif'] = true,
['end'] = true,
['false'] = true,
['for'] = true,
['function'] = true,
['goto'] = true,
['if'] = true,
['in'] = true,
['local'] = true,
['nil'] = true,
['not'] = true,
['or'] = true,
['repeat'] = true,
['return'] = true,
['then'] = true,
['true'] = true,
['until'] = true,
['while'] = true,
}
local luaKeywords: {string:boolean} = {}
for k in ([[ and break do else elseif end false for function goto if
in local nil not or repeat return then true until while
]]):gmatch('%w') do
luaKeywords[k] = true
end

local function isIdentifier(str: any): boolean
return str is string
Expand Down
Loading