Skip to content

Commit 2e70ab9

Browse files
committed
Do not make input flexible needlessly
It's hard to translate into other language especially if it has static type system. The changed line is introduced by #3 but it's just debugging purpose and we can convert string to list in caller side.
1 parent bd11dba commit 2e70ab9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

autoload/vimlparser.vim

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function! vimlparser#test(input, ...)
1818
else
1919
let l:neovim = 0
2020
endif
21-
let i = type(a:input) == 1 && filereadable(a:input) ? readfile(a:input) : a:input
21+
let i = type(a:input) == 1 && filereadable(a:input) ? readfile(a:input) : [a:input]
2222
let r = s:StringReader.new(i)
2323
let p = s:VimLParser.new(l:neovim)
2424
let c = s:Compiler.new()
@@ -3637,21 +3637,20 @@ function! s:StringReader.new(...)
36373637
endfunction
36383638

36393639
function! s:StringReader.__init__(lines)
3640-
let lines = type(a:lines) == 3 ? a:lines : [a:lines]
36413640
let self.buf = []
36423641
let self.pos = []
36433642
let lnum = 0
3644-
while lnum < len(lines)
3643+
while lnum < len(a:lines)
36453644
let col = 0
3646-
for c in split(lines[lnum], '\zs')
3645+
for c in split(a:lines[lnum], '\zs')
36473646
call add(self.buf, c)
36483647
call add(self.pos, [lnum + 1, col + 1])
36493648
let col += len(c)
36503649
endfor
3651-
while lnum + 1 < len(lines) && lines[lnum + 1] =~# '^\s*\\'
3650+
while lnum + 1 < len(a:lines) && a:lines[lnum + 1] =~# '^\s*\\'
36523651
let skip = 1
36533652
let col = 0
3654-
for c in split(lines[lnum + 1], '\zs')
3653+
for c in split(a:lines[lnum + 1], '\zs')
36553654
if skip
36563655
if c == '\'
36573656
let skip = 0

0 commit comments

Comments
 (0)