summaryrefslogtreecommitdiff
path: root/ale_linters/verilog
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-18 00:35:53 +0100
committerw0rp <devw0rp@gmail.com>2017-04-18 00:35:53 +0100
commitbdad25eefd6526f8130f97edbe25a1179e27aadc (patch)
treec2e563e959121e77f6d96a256583849f6851f0a4 /ale_linters/verilog
parente237add9fdec64c80ed57f383e2b73464fb4b43d (diff)
downloadale-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.vim9
-rw-r--r--ale_linters/verilog/verilator.vim9
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,