summaryrefslogtreecommitdiff
path: root/ale_linters/verilog/verilator.vim
diff options
context:
space:
mode:
authorBartek thindil Jasicki <thindil@laeran.pl>2020-06-07 09:26:06 +0200
committerBartek thindil Jasicki <thindil@laeran.pl>2020-06-07 09:26:06 +0200
commita5e7f2c8bb61f3e882bc26ce1773b130d1fbc32b (patch)
treecb85bc818b667acc9b28870755e079e20b935a3f /ale_linters/verilog/verilator.vim
parentb6828ac5c54c809336b5314e51f185124d90b23f (diff)
parent7265ceb6d050d1a4642741d248f11e4f2abd37e1 (diff)
downloadale-a5e7f2c8bb61f3e882bc26ce1773b130d1fbc32b.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ale_linters/verilog/verilator.vim')
-rw-r--r--ale_linters/verilog/verilator.vim27
1 files changed, 18 insertions, 9 deletions
diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim
index 64bb6e41..029dd4c9 100644
--- a/ale_linters/verilog/verilator.vim
+++ b/ale_linters/verilog/verilator.vim
@@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
" %Warning-UNUSED: test.v:4: Signal is not used: dout
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
- let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$'
+ " Since version 4.032 (04/2020) verilator linter messages also contain the column number,
+ " and look like:
+ " %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';'
+ "
+ " to stay compatible with old versions of the tool, the column number is
+ " optional in the researched pattern
+ let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- let l:line = l:match[3] + 0
- let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
- let l:text = l:match[4]
+ let l:item = {
+ \ 'lnum': str2nr(l:match[3]),
+ \ 'text': l:match[5],
+ \ 'type': l:match[1] is# 'Error' ? 'E' : 'W',
+ \}
+
+ if !empty(l:match[4])
+ let l:item.col = str2nr(l:match[4])
+ endif
+
let l:file = l:match[2]
if l:file =~# '_verilator_linted.v'
- call add(l:output, {
- \ 'lnum': l:line,
- \ 'text': l:text,
- \ 'type': l:type,
- \})
+ call add(l:output, l:item)
endif
endfor