Skip to content

Commit d823a89

Browse files
committed
Merge pull request #10 from Kuniwak/master
Support python module
2 parents a91a757 + bfeca97 commit d823a89

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

py/pycompiler.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,11 @@ function! s:test()
796796
let c = s:PythonCompiler.new()
797797
let lines = c.compile(p.parse(r))
798798
unlet lines[0 : index(lines, 'NIL = []') - 1]
799-
call writefile(head + lines + ['', 'main()'], pyfile)
799+
let tail = [
800+
\ 'if __name__ == ''__main__'':',
801+
\ ' main()',
802+
\ ]
803+
call writefile(head + lines + tail, pyfile)
800804
catch
801805
echoerr substitute(v:throwpoint, '\.\.\zs\d\+', '\=s:numtoname(submatch(0))', 'g') . "\n" . v:exception
802806
endtry

py/vimlparser.py

Lines changed: 32 additions & 5 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)