diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-18 00:35:53 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-18 00:35:53 +0100 |
commit | bdad25eefd6526f8130f97edbe25a1179e27aadc (patch) | |
tree | c2e563e959121e77f6d96a256583849f6851f0a4 /ale_linters/verilog | |
parent | e237add9fdec64c80ed57f383e2b73464fb4b43d (diff) | |
download | ale-bdad25eefd6526f8130f97edbe25a1179e27aadc.zip |
Add a function for getting matches, and use it to simplify a lot of code
Diffstat (limited to 'ale_linters/verilog')
-rw-r--r-- | ale_linters/verilog/iverilog.vim | 9 | ||||
-rw-r--r-- | ale_linters/verilog/verilator.vim | 9 |
2 files changed, 2 insertions, 16 deletions
diff --git a/ale_linters/verilog/iverilog.vim b/ale_linters/verilog/iverilog.vim index a061e473..0f4cd7b3 100644 --- a/ale_linters/verilog/iverilog.vim +++ b/ale_linters/verilog/iverilog.vim @@ -11,19 +11,12 @@ function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort let l:pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?' let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) - - if len(l:match) == 0 - continue - endif - + for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:line = l:match[1] + 0 let l:type = l:match[2] =~# 'error' ? 'E' : 'W' let l:text = l:match[2] ==# 'syntax error' ? 'syntax error' : l:match[4] call add(l:output, { - \ 'bufnr': a:buffer, \ 'lnum': l:line, \ 'text': l:text, \ 'type': l:type, diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim index fbff2b2e..e2dbafac 100644 --- a/ale_linters/verilog/verilator.vim +++ b/ale_linters/verilog/verilator.vim @@ -23,13 +23,7 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$' let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) - - if len(l:match) == 0 - continue - endif - + for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:line = l:match[3] + 0 let l:type = l:match[1] ==# 'Error' ? 'E' : 'W' let l:text = l:match[4] @@ -37,7 +31,6 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort if l:file =~# '_verilator_linted.v' call add(l:output, { - \ 'bufnr': a:buffer, \ 'lnum': l:line, \ 'text': l:text, \ 'type': l:type, |