@@ -72,7 +72,7 @@ function! s:Trie.remove(s) abort
72
72
return v: true
73
73
endfunction
74
74
75
- function ! s: gen (ex_cmds_h) abort
75
+ function ! s: parse (ex_cmds_h) abort
76
76
let lines = readfile (a: ex_cmds_h )
77
77
78
78
" { 'name': string, 'flags': string, 'minlen': int, 'parser': string}
@@ -100,14 +100,14 @@ function! s:gen(ex_cmds_h) abort
100
100
return cmds
101
101
endfunction
102
102
103
- function ! s: gen_new_builtin (existing, latest) abort
103
+ function ! s: diff (existing, latest) abort
104
104
let existing_names = {}
105
105
for cmd in a: existing
106
106
let existing_names[cmd.name] = v: true
107
107
endfor
108
108
let newcmds = []
109
109
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)
111
111
endfor
112
112
return newcmds
113
113
endfunction
@@ -125,8 +125,9 @@ endfunction
125
125
" ex_cmds_h: path to vim/src/ex_cmds.h
126
126
function ! VimLParserNewCmds (ex_cmds_h) abort
127
127
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' })})
130
131
let generated_text = s: gen_viml (new_cmds)
131
132
if generated_text == # ' '
132
133
verbose echo ' s:VimLParser.builtin_commands in autoload/vimlparser.vim is up-to-date.'
0 commit comments