summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-10-07 19:55:41 +0100
committerGitHub <noreply@github.com>2019-10-07 19:55:41 +0100
commit59b34dd01774afe6309fa7e56cb68b3dcae2d43c (patch)
treecd378a67641e789553dbdfb473ecbd683386e960
parentf2b231dd76b017d43b89ead4931a37237beb3494 (diff)
parentd0e87c0df4d922c8b47e5935bb859518d347a24a (diff)
downloadale-59b34dd01774afe6309fa7e56cb68b3dcae2d43c.zip
Merge pull request #2813 from werneta/master
Update vlog parser to handle new output format
-rw-r--r--ale_linters/verilog/vlog.vim14
-rw-r--r--test/handler/test_vlog_handler.vader21
2 files changed, 34 insertions, 1 deletions
diff --git a/ale_linters/verilog/vlog.vim b/ale_linters/verilog/vlog.vim
index 37d21c4c..951e2037 100644
--- a/ale_linters/verilog/vlog.vim
+++ b/ale_linters/verilog/vlog.vim
@@ -24,6 +24,20 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort
\})
endfor
+ "Matches patterns like the following:
+ "** Warning: (vlog-2623) add.v(7): Undefined variable: C.
+ "** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C.
+ " let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
+ let l:pattern = '^**\s\(\w*\):\s\([^)]*)\)[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[3] + 0,
+ \ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
+ \ 'text': l:match[2] . ' ' . l:match[4],
+ \})
+ endfor
+
return l:output
endfunction
diff --git a/test/handler/test_vlog_handler.vader b/test/handler/test_vlog_handler.vader
index a70665db..daf3cdcf 100644
--- a/test/handler/test_vlog_handler.vader
+++ b/test/handler/test_vlog_handler.vader
@@ -4,7 +4,7 @@ Before:
After:
call ale#linter#Reset()
-Execute(The vlog handler should parse lines correctly):
+Execute(The vlog handler should parse old-style lines correctly):
AssertEqual
\ [
\ {
@@ -22,3 +22,22 @@ Execute(The vlog handler should parse lines correctly):
\ '** Warning: add.v(7): (vlog-2623) Undefined variable: C.',
\ '** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C.',
\ ])
+
+Execute(The vlog handler should parse new-style lines correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 7,
+ \ 'type': 'W',
+ \ 'text': '(vlog-2623) Undefined variable: C.'
+ \ },
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.'
+ \ },
+ \ ],
+ \ ale_linters#verilog#vlog#Handle(bufnr(''), [
+ \ '** Warning: (vlog-2623) add.v(7): Undefined variable: C.',
+ \ '** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C.',
+ \ ])