diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-31 19:56:15 -0500 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-01-01 04:30:55 -0500 |
| commit | f3c242c13cc9aaefd29f750d211fff76e1fada68 (patch) | |
| tree | 5096f59f4d61c1493d37456fb8cb890f8a281d1e /src/nvim/generators | |
| parent | cf3a8610172feec1fb8ab2863bdad69eb1296f28 (diff) | |
| download | rneovim-f3c242c13cc9aaefd29f750d211fff76e1fada68.tar.gz rneovim-f3c242c13cc9aaefd29f750d211fff76e1fada68.tar.bz2 rneovim-f3c242c13cc9aaefd29f750d211fff76e1fada68.zip | |
vim-patch:8.1.1241: Ex command info contains confusing information
Problem: Ex command info contains confusing information.
Solution: When using the NOTADR flag use ADDR_OTHER for the address type.
Cleanup code using NOTADR. Check for errors in
create_cmdidxs.vim. Adjust Makefile to see the errors.
https://github.com/vim/vim/commit/b731689e85b4153af7edc8f0a6b9f99d36d8b011
Use Lua's "assert()" to make an invalid command definition
a compilation error.
Misc changes:
Remove 'RESTRICT' flag.
Neovim does not support "restricted" mode
since commit 7777532cebcfa9abc5ab2c7beae77f386feed3ca.
TODO:
Do not generate files before Lua assertions
so that CMake always runs the generator script
if the previous build has an invalid command definition.
Diffstat (limited to 'src/nvim/generators')
| -rw-r--r-- | src/nvim/generators/gen_ex_cmds.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nvim/generators/gen_ex_cmds.lua b/src/nvim/generators/gen_ex_cmds.lua index 2574af6218..844661adc3 100644 --- a/src/nvim/generators/gen_ex_cmds.lua +++ b/src/nvim/generators/gen_ex_cmds.lua @@ -22,7 +22,10 @@ local defsfname = autodir .. '/ex_cmds_defs.generated.h' local enumfile = io.open(enumfname, 'w') local defsfile = io.open(defsfname, 'w') -local defs = require('ex_cmds') +local bit = require 'bit' +local ex_cmds = require('ex_cmds') +local defs = ex_cmds.cmds +local flags = ex_cmds.flags local byte_a = string.byte('a') local byte_z = string.byte('z') @@ -51,6 +54,17 @@ static CommandDefinition cmdnames[%u] = { ]], #defs, #defs)) local cmds, cmdidxs1, cmdidxs2 = {}, {}, {} for _, cmd in ipairs(defs) do + if bit.band(cmd.flags, flags.RANGE) == flags.RANGE then + assert(cmd.addr_type ~= 'ADDR_NONE', + string.format('ex_cmds.lua:%s: Using RANGE with ADDR_NONE\n', cmd.command)) + else + assert(cmd.addr_type == 'ADDR_NONE', + string.format('ex_cmds.lua:%s: Missing ADDR_NONE\n', cmd.command)) + end + if bit.band(cmd.flags, flags.DFLALL) == flags.DFLALL then + assert(cmd.addr_type ~= 'ADDR_OTHER' and cmd.addr_type ~= 'ADDR_NONE', + string.format('ex_cmds.lua:%s: Missing misplaced DFLALL\n', cmd.command)) + end local enumname = cmd.enum or ('CMD_' .. cmd.command) local byte_cmd = cmd.command:sub(1, 1):byte() if byte_a <= byte_cmd and byte_cmd <= byte_z then |