aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-09-23 07:14:10 -0700
committerGitHub <noreply@github.com>2024-09-23 07:14:10 -0700
commit34a40d3a50f71a4b5e06c36ed9f9110983984dbf (patch)
tree69f647ce5f5dba8f16cb2a55a2511b89df4db87e /src/nvim/generators
parent47e6b2233feffc6e9d94f6086fb904eb5688fa25 (diff)
parent17027d64726864c7bbdba5bee004eb581ac4b54a (diff)
downloadrneovim-34a40d3a50f71a4b5e06c36ed9f9110983984dbf.tar.gz
rneovim-34a40d3a50f71a4b5e06c36ed9f9110983984dbf.tar.bz2
rneovim-34a40d3a50f71a4b5e06c36ed9f9110983984dbf.zip
Merge #30435 refactor: rename "Dictionary" => "Dict"
Diffstat (limited to 'src/nvim/generators')
-rw-r--r--src/nvim/generators/c_grammar.lua6
-rw-r--r--src/nvim/generators/gen_api_dispatch.lua24
-rw-r--r--src/nvim/generators/gen_api_ui_events.lua7
-rw-r--r--src/nvim/generators/gen_declarations.lua2
-rw-r--r--src/nvim/generators/gen_options_enum.lua2
5 files changed, 19 insertions, 22 deletions
diff --git a/src/nvim/generators/c_grammar.lua b/src/nvim/generators/c_grammar.lua
index 4e7de7adb4..ed6e30ea10 100644
--- a/src/nvim/generators/c_grammar.lua
+++ b/src/nvim/generators/c_grammar.lua
@@ -35,11 +35,7 @@ local cdoc_comment = P('///') * opt(Ct(Cg(rep(space) * rep(not_nl), 'comment')))
local c_preproc = P('#') * rep(not_nl)
local dllexport = P('DLLEXPORT') * rep1(ws)
-local typed_container = (
- (P('ArrayOf(') + P('DictionaryOf(') + P('Dict('))
- * rep1(any - P(')'))
- * P(')')
-)
+local typed_container = ((P('ArrayOf(') + P('DictOf(') + P('Dict(')) * rep1(any - P(')')) * P(')'))
local c_id = (typed_container + (letter * rep(alpha)))
local c_void = P('void')
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua
index 3567831c41..9e0aa407a1 100644
--- a/src/nvim/generators/gen_api_dispatch.lua
+++ b/src/nvim/generators/gen_api_dispatch.lua
@@ -216,15 +216,15 @@ for _, f in ipairs(functions) do
end
f_exported.parameters = {}
for i, param in ipairs(f.parameters) do
- if param[1] == 'DictionaryOf(LuaRef)' then
- param = { 'Dictionary', param[2] }
+ if param[1] == 'DictOf(LuaRef)' then
+ param = { 'Dict', param[2] }
elseif startswith(param[1], 'Dict(') then
- param = { 'Dictionary', param[2] }
+ param = { 'Dict', param[2] }
end
f_exported.parameters[i] = param
end
if startswith(f.return_type, 'Dict(') then
- f_exported.return_type = 'Dictionary'
+ f_exported.return_type = 'Dict'
end
exported_functions[#exported_functions + 1] = f_exported
end
@@ -406,7 +406,7 @@ local function real_type(type)
if rv:match('Array') then
rv = 'Array'
else
- rv = 'Dictionary'
+ rv = 'Dict'
end
end
return rv
@@ -466,7 +466,7 @@ for i = 1, #functions do
output:write('\n ' .. converted .. ' = args.items[' .. (j - 1) .. '];\n')
elseif rt:match('^KeyDict_') then
converted = '&' .. converted
- output:write('\n if (args.items[' .. (j - 1) .. '].type == kObjectTypeDictionary) {') --luacheck: ignore 631
+ output:write('\n if (args.items[' .. (j - 1) .. '].type == kObjectTypeDict) {') --luacheck: ignore 631
output:write('\n memset(' .. converted .. ', 0, sizeof(*' .. converted .. '));') -- TODO: neeeee
output:write(
'\n if (!api_dict_to_keydict('
@@ -475,7 +475,7 @@ for i = 1, #functions do
.. rt
.. '_get_field, args.items['
.. (j - 1)
- .. '].data.dictionary, error)) {'
+ .. '].data.dict, error)) {'
)
output:write('\n goto cleanup;')
output:write('\n }')
@@ -554,7 +554,7 @@ for i = 1, #functions do
)
end
-- accept empty lua tables as empty dictionaries
- if rt:match('^Dictionary') then
+ if rt:match('^Dict') then
output:write(
'\n } else if (args.items['
.. (j - 1)
@@ -562,7 +562,7 @@ for i = 1, #functions do
.. (j - 1)
.. '].data.array.size == 0) {'
) --luacheck: ignore 631
- output:write('\n ' .. converted .. ' = (Dictionary)ARRAY_DICT_INIT;')
+ output:write('\n ' .. converted .. ' = (Dict)ARRAY_DICT_INIT;')
end
output:write('\n } else {')
output:write(
@@ -643,7 +643,7 @@ for i = 1, #functions do
if string.match(ret_type, '^KeyDict_') then
local table = string.sub(ret_type, 9) .. '_table'
output:write(
- '\n ret = DICTIONARY_OBJ(api_keydict_to_dict(&rv, '
+ '\n ret = DICT_OBJ(api_keydict_to_dict(&rv, '
.. table
.. ', ARRAY_SIZE('
.. table
@@ -779,12 +779,12 @@ local function process_function(fn)
local param = fn.parameters[j]
local cparam = string.format('arg%u', j)
local param_type = real_type(param[1])
- local extra = param_type == 'Dictionary' and 'false, ' or ''
+ local extra = param_type == 'Dict' and 'false, ' or ''
local arg_free_code = ''
if param[1] == 'Object' then
extra = 'true, '
arg_free_code = 'api_luarefs_free_object(' .. cparam .. ');'
- elseif param[1] == 'DictionaryOf(LuaRef)' then
+ elseif param[1] == 'DictOf(LuaRef)' then
extra = 'true, '
arg_free_code = 'api_luarefs_free_dict(' .. cparam .. ');'
elseif param[1] == 'LuaRef' then
diff --git a/src/nvim/generators/gen_api_ui_events.lua b/src/nvim/generators/gen_api_ui_events.lua
index c5b37672bf..3e8ae19c9a 100644
--- a/src/nvim/generators/gen_api_ui_events.lua
+++ b/src/nvim/generators/gen_api_ui_events.lua
@@ -54,7 +54,7 @@ local function call_ui_event_method(output, ev)
local kind = ev.parameters[j][1]
if kind ~= 'Object' then
if kind == 'HlAttrs' then
- kind = 'Dictionary'
+ kind = 'Dict'
end
output:write('\n || args.items[' .. (j - 1) .. '].type != kObjectType' .. kind .. '')
end
@@ -74,7 +74,7 @@ local function call_ui_event_method(output, ev)
output:write(
'ui_client_dict2hlattrs(args.items['
.. (j - 1)
- .. '].data.dictionary, '
+ .. '].data.dict, '
.. (hlattrs_args_count == 0 and 'true' or 'false')
.. ');\n'
)
@@ -205,7 +205,8 @@ for _, ev in ipairs(events) do
ev_exported[attr] = ev[attr]
end
for _, p in ipairs(ev_exported.parameters) do
- if p[1] == 'HlAttrs' then
+ if p[1] == 'HlAttrs' or p[1] == 'Dict' then
+ -- TODO(justinmk): for back-compat, but do clients actually look at this?
p[1] = 'Dictionary'
end
end
diff --git a/src/nvim/generators/gen_declarations.lua b/src/nvim/generators/gen_declarations.lua
index f4d1d19481..2ec0e9ab68 100644
--- a/src/nvim/generators/gen_declarations.lua
+++ b/src/nvim/generators/gen_declarations.lua
@@ -70,7 +70,7 @@ local raw_word = concat(w, any_amount(aw))
local right_word = concat(raw_word, neg_look_ahead(aw))
local word = branch(
concat(
- branch(lit('ArrayOf('), lit('DictionaryOf('), lit('Dict(')), -- typed container macro
+ branch(lit('ArrayOf('), lit('DictOf('), lit('Dict(')), -- typed container macro
one_or_more(any_character - lit(')')),
lit(')')
),
diff --git a/src/nvim/generators/gen_options_enum.lua b/src/nvim/generators/gen_options_enum.lua
index 9a3953fcbc..d1419137d3 100644
--- a/src/nvim/generators/gen_options_enum.lua
+++ b/src/nvim/generators/gen_options_enum.lua
@@ -80,7 +80,7 @@ enum_w('')
--- @type { [string]: string }
local option_index = {}
--- Generate option index enum and populate the `option_index` dictionary.
+-- Generate option index enum and populate the `option_index` dict.
enum_w('typedef enum {')
enum_w(' kOptInvalid = -1,')