diff src/create_cmdidxs.vim @ 16475:854fb0ad4be6 v8.1.1241

patch 8.1.1241: Ex command info contains confusing information commit https://github.com/vim/vim/commit/b731689e85b4153af7edc8f0a6b9f99d36d8b011 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 1 18:08:42 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 May 2019 18:15:07 +0200
parents 889da8649221
children 72ce5ca82a75
line wrap: on
line diff
--- a/src/create_cmdidxs.vim
+++ b/src/create_cmdidxs.vim
@@ -10,7 +10,10 @@
 let cmds = []
 let skipped_cmds = 0
 
-for line in readfile('ex_cmds.h')
+let lines = readfile('ex_cmds.h')
+let idx = 0
+while idx < len(lines)
+  let line = lines[idx]
   if line =~ '^EX(CMD_'
     let m = matchlist(line, '^EX(CMD_\S*,\s*"\([a-z][^"]*\)"')
     if len(m) >= 2
@@ -18,8 +21,28 @@ for line in readfile('ex_cmds.h')
     else
       let skipped_cmds += 1
     endif
+
+    let idx += 1
+    let flags = lines[idx]
+    let idx += 1
+    let addr_type = lines[idx]
+
+    if flags =~ '\<RANGE\>'
+      if addr_type =~ 'ADDR_NONE'
+	echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Using RANGE with ADDR_NONE: ' .. line
+      endif
+    else
+      if addr_type !~ 'ADDR_NONE'
+	echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Missing ADDR_NONE: ' .. line
+      endif
+    endif
+
+    if flags =~ '\<DFLALL\>' && (addr_type =~ 'ADDR_OTHER' || addr_type =~ 'ADDR_NONE')
+      echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Missing misplaced DFLALL: ' .. line
+    endif
   endif
-endfor
+  let idx += 1
+endwhile
 
 let cmdidxs1 = {}
 let cmdidxs2 = {}