@@ -72,7 +72,7 @@ function! s:Trie.remove(s) abort
7272 return v: true
7373endfunction
7474
75- function ! s: gen (ex_cmds_h) abort
75+ function ! s: parse (ex_cmds_h) abort
7676 let lines = readfile (a: ex_cmds_h )
7777
7878 " { 'name': string, 'flags': string, 'minlen': int, 'parser': string}
@@ -100,14 +100,14 @@ function! s:gen(ex_cmds_h) abort
100100 return cmds
101101endfunction
102102
103- function ! s: gen_new_builtin (existing, latest) abort
103+ function ! s: diff (existing, latest) abort
104104 let existing_names = {}
105105 for cmd in a: existing
106106 let existing_names[cmd.name] = v: true
107107 endfor
108108 let newcmds = []
109109 for cmd in filter (copy (a: latest ), {_, c - > ! has_key (existing_names, c .name)})
110- let newcmds = add (newcmds, extend ( cmd, { ' parser ' : ' parse_cmd_common ' }) )
110+ let newcmds = add (newcmds, cmd)
111111 endfor
112112 return newcmds
113113endfunction
@@ -125,8 +125,9 @@ endfunction
125125" ex_cmds_h: path to vim/src/ex_cmds.h
126126function ! VimLParserNewCmds (ex_cmds_h) abort
127127 let vimlparser = vimlparser#import ()
128- let latest = s: gen (a: ex_cmds_h )
129- let new_cmds = s: gen_new_builtin (vimlparser#import ().VimLParser.builtin_commands, latest)
128+ let latest = s: parse (a: ex_cmds_h )
129+ let new_cmds = s: diff (vimlparser#import ().VimLParser.builtin_commands, latest)
130+ call map (new_cmds, {_,cmd - > extend (cmd, {' parser' : ' parse_cmd_common' })})
130131 let generated_text = s: gen_viml (new_cmds)
131132 if generated_text == # ' '
132133 verbose echo ' s:VimLParser.builtin_commands in autoload/vimlparser.vim is up-to-date.'
0 commit comments