style(syntax): only use `[]` index where necessary

It interferes with sumenko_lua.
This commit is contained in:
Iron-E 2021-08-22 15:22:58 -04:00
parent cac088df10
commit 94eda96eb8
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22
1 changed files with 7 additions and 7 deletions

View File

@ -93,7 +93,7 @@ local function tohex(rgb) return string.format('#%06x', rgb) end
local function use_background_with(attributes)
return setmetatable(
attributes[go.background],
{['__index'] = attributes}
{__index = attributes}
)
end
@ -116,10 +116,10 @@ function highlite.group(group_name)
return
{
['fg'] = group_definition.foreground and tohex(group_definition.foreground) or _NONE,
['bg'] = group_definition.background and tohex(group_definition.background) or _NONE,
['blend'] = group_definition.blend,
['style'] = style or _NONE
fg = group_definition.foreground and tohex(group_definition.foreground) or _NONE,
bg = group_definition.background and tohex(group_definition.background) or _NONE,
blend = group_definition.blend,
style = style or _NONE
}
end
@ -166,7 +166,7 @@ function highlite:highlight_terminal(terminal_colors)
end
end
return setmetatable(highlite, {['__call'] = function(self, normal, highlights, terminal_colors)
return setmetatable(highlite, {__call = function(self, normal, highlights, terminal_colors)
-- function to resolve function highlight groups being defined by function calls.
local function resolve(tbl, key, resolve_links)
local value = tbl[key]
@ -174,7 +174,7 @@ return setmetatable(highlite, {['__call'] = function(self, normal, highlights, t
if value_type == 'function' then -- call and cache the result; next time, if it isn't a function this step will be skipped
tbl[key] = value(setmetatable({},
{
['__index'] = function(_, inner_key) return resolve(tbl, inner_key, true) end
__index = function(_, inner_key) return resolve(tbl, inner_key, true) end
}))
elseif resolve_links and value_type == _TYPE_STRING and not string.find(value, '^#') then
return resolve(tbl, value, resolve_links)