From b8bf7b220d0f7ab461ed830b125f9dbc42a7836a Mon Sep 17 00:00:00 2001 From: John Gentile Date: Sun, 27 Jan 2019 04:46:33 -0500 Subject: Add VHDL Support & Newer Verilog Linters (#2229) * Added VHDL file support with ghdl compiler * Update ghdl.vim * Create vcom.vim * Create xvhdl.vim * Update xvlog.vim * Added documentation for VHDL & Verilog linters * Added tests to VHDL & Verilog linters --- ale_linters/verilog/xvlog.vim | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ale_linters/verilog/xvlog.vim (limited to 'ale_linters/verilog/xvlog.vim') diff --git a/ale_linters/verilog/xvlog.vim b/ale_linters/verilog/xvlog.vim new file mode 100644 index 00000000..db2227cd --- /dev/null +++ b/ale_linters/verilog/xvlog.vim @@ -0,0 +1,35 @@ +" Author: John Gentile +" Description: Adds support for Xilinx Vivado `xvlog` Verilog compiler/checker + +call ale#Set('verilog_xvlog_executable', 'xvlog') +call ale#Set('verilog_xvlog_options', '') + +function! ale_linters#verilog#xvlog#GetCommand(buffer) abort + return '%e ' . ale#Pad(ale#Var(a:buffer, 'verilog_xvlog_options')) . ' %t' +endfunction + +function! ale_linters#verilog#xvlog#Handle(buffer, lines) abort + "Matches patterns like the following: + " ERROR: [VRFC 10-1412] syntax error near output [/path/to/file.v:5] + let l:pattern = '^ERROR:\s\+\(\[.*\)\[.*:\([0-9]\+\)\]' + let l:output = [] + + " NOTE: `xvlog` only prints 'INFO' and 'ERROR' messages + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'type': 'E', + \ 'text': l:match[1], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('verilog', { +\ 'name': 'xvlog', +\ 'output_stream': 'stdout', +\ 'executable_callback': ale#VarFunc('verilog_xvlog_executable'), +\ 'command_callback': 'ale_linters#verilog#xvlog#GetCommand', +\ 'callback': 'ale_linters#verilog#xvlog#Handle', +\}) -- cgit v1.2.3