mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
msgpack-gen: Fix for Lua 5.1. (#4857)
goto statement was only introduced in Lua 5.2.
This commit is contained in:
parent
568da8ef3b
commit
634d59f646
@ -45,7 +45,7 @@ grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
|
|||||||
assert(#arg >= 1)
|
assert(#arg >= 1)
|
||||||
functions = {}
|
functions = {}
|
||||||
|
|
||||||
-- names of all headers relative to the source root(for inclusion in the
|
-- names of all headers relative to the source root (for inclusion in the
|
||||||
-- generated file)
|
-- generated file)
|
||||||
headers = {}
|
headers = {}
|
||||||
-- output file(dispatch function + metadata serialized with msgpack)
|
-- output file(dispatch function + metadata serialized with msgpack)
|
||||||
@ -64,24 +64,22 @@ for i = 1, #arg - 1 do
|
|||||||
local tmp = grammar:match(input:read('*all'))
|
local tmp = grammar:match(input:read('*all'))
|
||||||
for i = 1, #tmp do
|
for i = 1, #tmp do
|
||||||
local fn = tmp[i]
|
local fn = tmp[i]
|
||||||
if fn.noexport then
|
if not fn.noexport then
|
||||||
goto continue
|
functions[#functions + 1] = tmp[i]
|
||||||
|
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
|
||||||
|
-- this function should receive the channel id
|
||||||
|
fn.receives_channel_id = true
|
||||||
|
-- remove the parameter since it won't be passed by the api client
|
||||||
|
table.remove(fn.parameters, 1)
|
||||||
|
end
|
||||||
|
if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
|
||||||
|
-- function can fail if the last parameter type is 'Error'
|
||||||
|
fn.can_fail = true
|
||||||
|
-- remove the error parameter, msgpack has it's own special field
|
||||||
|
-- for specifying errors
|
||||||
|
fn.parameters[#fn.parameters] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
functions[#functions + 1] = tmp[i]
|
|
||||||
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
|
|
||||||
-- this function should receive the channel id
|
|
||||||
fn.receives_channel_id = true
|
|
||||||
-- remove the parameter since it won't be passed by the api client
|
|
||||||
table.remove(fn.parameters, 1)
|
|
||||||
end
|
|
||||||
if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
|
|
||||||
-- function can fail if the last parameter type is 'Error'
|
|
||||||
fn.can_fail = true
|
|
||||||
-- remove the error parameter, msgpack has it's own special field
|
|
||||||
-- for specifying errors
|
|
||||||
fn.parameters[#fn.parameters] = nil
|
|
||||||
end
|
|
||||||
::continue::
|
|
||||||
end
|
end
|
||||||
input:close()
|
input:close()
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user