]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/vhdl/xvhdl.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / ale_linters / vhdl / xvhdl.vim
1 " Author:      John Gentile <johncgentile17@gmail.com>
2 " Description: Adds support for Xilinx Vivado `xvhdl` VHDL compiler/checker
3
4 call ale#Set('vhdl_xvhdl_executable', 'xvhdl')
5 " Use VHDL-2008. See `$ xvhdl -h` for more options
6 call ale#Set('vhdl_xvhdl_options', '--2008')
7
8 function! ale_linters#vhdl#xvhdl#GetCommand(buffer) abort
9     return '%e ' . ale#Pad(ale#Var(a:buffer, 'vhdl_xvhdl_options')) . ' %t'
10 endfunction
11
12 function! ale_linters#vhdl#xvhdl#Handle(buffer, lines) abort
13     "Matches patterns like the following:
14     " ERROR: [VRFC 10-91] aresetn is not declared [/path/to/file.vhd:17]
15     " ERROR: [VRFC 10-91] m_axis_tx_tdata is not declared [/home/user/tx_data.vhd:128]
16     let l:pattern = '^ERROR:\s\+\(\[.*\)\[.*:\([0-9]\+\)\]'
17     let l:output = []
18
19     " NOTE: `xvhdl` only prints 'INFO' and 'ERROR' messages
20     for l:match in ale#util#GetMatches(a:lines, l:pattern)
21         call add(l:output, {
22         \   'lnum': l:match[2] + 0,
23         \   'type': 'E',
24         \   'text': l:match[1],
25         \})
26     endfor
27
28     return l:output
29 endfunction
30
31 call ale#linter#Define('vhdl', {
32 \   'name': 'xvhdl',
33 \   'output_stream': 'stdout',
34 \   'executable': {b -> ale#Var(b, 'vhdl_xvhdl_executable')},
35 \   'command': function('ale_linters#vhdl#xvhdl#GetCommand'),
36 \   'callback': 'ale_linters#vhdl#xvhdl#Handle',
37 \})