@@ -335,6 +335,7 @@ function s:PythonCompiler.compile_function(node)
335
335
if left == ' new'
336
336
return
337
337
endif
338
+ call self .emptyline ()
338
339
call insert (rlist, ' self' )
339
340
call self .incindent (' ' )
340
341
call self .out (' def %s(%s):' , left , join (rlist, ' , ' ))
@@ -343,12 +344,13 @@ function s:PythonCompiler.compile_function(node)
343
344
call self .decindent ()
344
345
call self .decindent ()
345
346
else
347
+ call self .emptyline ()
348
+ call self .emptyline ()
346
349
call self .out (' def %s(%s):' , left , join (rlist, ' , ' ))
347
350
call self .incindent (' ' )
348
351
call self .compile_body (a: node .body)
349
352
call self .decindent ()
350
353
endif
351
- call self .emptyline ()
352
354
endfunction
353
355
354
356
function s: PythonCompiler .compile_delfunction (node)
@@ -376,9 +378,13 @@ function s:PythonCompiler.compile_let(node)
376
378
if a: node .left isnot s: NIL
377
379
let left = self .compile (a: node .left )
378
380
if left == ' LvalueParser'
381
+ call self .emptyline ()
382
+ call self .emptyline ()
379
383
call self .out (' class LvalueParser(ExprParser):' )
380
384
return
381
385
elseif left = ~ ' ^\(VimLParser\|ExprTokenizer\|ExprParser\|LvalueParser\|StringReader\|Compiler\|RegexpParser\)$'
386
+ call self .emptyline ()
387
+ call self .emptyline ()
382
388
call self .out (' class %s:' , left )
383
389
return
384
390
elseif left = ~ ' ^\(VimLParser\|ExprTokenizer\|ExprParser\|LvalueParser\|StringReader\|Compiler\|RegexpParser\)\.'
@@ -763,7 +769,7 @@ function s:PythonCompiler.compile_list(node)
763
769
endfunction
764
770
765
771
function s: PythonCompiler .compile_dict (node)
766
- let value = map (a: node .value, ' self.compile(v:val[0]) . ":" . self.compile(v:val[1])' )
772
+ let value = map (a: node .value, ' self.compile(v:val[0]) . ": " . self.compile(v:val[1])' )
767
773
if empty (value)
768
774
return ' AttributeDict({})'
769
775
else
@@ -828,14 +834,16 @@ let s:viml_builtin_functions = map(copy(s:VimLParser.builtin_functions), 'v:val.
828
834
let s: script_dir = expand (' <sfile>:h' )
829
835
function ! s: convert (in , out)
830
836
let vimlfunc = fnamemodify (s: script_dir . ' /vimlfunc.py' , ' :p' )
831
- let head = readfile (vimlfunc)
837
+ let head = readfile (vimlfunc) + [ ' ' , ' ' ]
832
838
try
833
839
let r = s: StringReader .new (readfile (a: in ))
834
840
let p = s: VimLParser .new ()
835
841
let c = s: PythonCompiler .new ()
836
842
let lines = c .compile (p .parse (r ))
837
843
unlet lines [0 : index (lines , ' NIL = []' ) - 1 ]
838
844
let tail = [
845
+ \ ' ' ,
846
+ \ ' ' ,
839
847
\ ' if __name__ == '' __main__'' :' ,
840
848
\ ' main()' ,
841
849
\ ]
0 commit comments