diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-03-15 17:46:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 17:46:07 +0100 |
commit | f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0 (patch) | |
tree | 183cfb73ac950194b70c37a1b89aeb57028cec6d /scripts/gendispatch.lua | |
parent | ec4e84210b87965e7110b061a321c7ec8a359d47 (diff) | |
parent | 7d28489a338e7112c0c7dc5e5a131ba8dcd1b3d2 (diff) | |
download | rneovim-f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0.tar.gz rneovim-f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0.tar.bz2 rneovim-f4b8dbeeb21ca65c5cd19fa361c5588349c0a1e0.zip |
Merge pull request #5540 from bfredl/api_since
allow specify api since field and more api compatibility checks
Diffstat (limited to 'scripts/gendispatch.lua')
-rw-r--r-- | scripts/gendispatch.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua index 397ccc9aaf..45a4f4a4de 100644 --- a/scripts/gendispatch.lua +++ b/scripts/gendispatch.lua @@ -9,7 +9,8 @@ C, Ct, Cc, Cg = lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg any = P(1) -- (consume one character) letter = R('az', 'AZ') + S('_$') -alpha = letter + R('09') +num = R('09') +alpha = letter + num nl = P('\r\n') + P('\n') not_nl = any - nl ws = S(' \t') + nl @@ -35,6 +36,7 @@ c_proto = Ct( Cg(c_type, 'return_type') * Cg(c_id, 'name') * fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') * Cg(Cc(false), 'async') * + (fill * Cg((P('FUNC_API_SINCE(') * C(num ^ 1)) * P(')'), 'since') ^ -1) * (fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) * (fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) * (fill * Cg((P('FUNC_API_NOEVAL') * Cc(true)), 'noeval') ^ -1) * @@ -52,6 +54,7 @@ package.path = nvimsrcdir .. '/?.lua;' .. package.path -- names of all headers relative to the source root (for inclusion in the -- generated file) headers = {} + -- output h file with generated dispatch functions dispatch_outputf = arg[#arg-2] -- output h file with packed metadata @@ -114,9 +117,11 @@ local deprecated_aliases = require("api.dispatch_deprecated") for i,f in ipairs(shallowcopy(functions)) do local ismethod = false if startswith(f.name, "nvim_") then - -- TODO(bfredl) after 0.1.6 allow method definitions - -- to specify the since and deprecated_since field - f.since = 1 + if f.since == nil then + print("Function "..f.name.." lacks since field.\n") + os.exit(1) + end + f.since = tonumber(f.since) if startswith(f.name, "nvim_buf_") then ismethod = true elseif startswith(f.name, "nvim_win_") then |