]> git.madduck.net Git - etc/vim.git/blob - ale_linters/vhdl/ghdl.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / vhdl / ghdl.vim
1 " Author: John Gentile <johncgentile17@gmail.com>
2 " Description: Adds support for `ghdl` VHDL compiler/checker
3
4 call ale#Set('vhdl_ghdl_executable', 'ghdl')
5 " Compile w/VHDL-2008 support
6 call ale#Set('vhdl_ghdl_options', '--std=08')
7
8 function! ale_linters#vhdl#ghdl#GetCommand(buffer) abort
9     return '%e -s ' . ale#Pad(ale#Var(a:buffer, 'vhdl_ghdl_options')) . ' %t'
10 endfunction
11
12 function! ale_linters#vhdl#ghdl#Handle(buffer, lines) abort
13     " Look for 'error' lines like the following:
14     " dff_en.vhd:41:5:error: 'begin' is expected instead of 'if'
15     " /path/to/file.vhdl:12:8: no declaration for "i0"
16     let l:pattern = '^[a-zA-Z0-9\-\.\_\/ ]\+:\(\d\+\):\(\d\+\):\(.*\)'
17     let l:output = []
18
19     for l:match in ale#util#GetMatches(a:lines, l:pattern)
20         call add(l:output, {
21         \   'lnum': l:match[1] + 0,
22         \   'col' : l:match[2] + 0,
23         \   'text': l:match[3],
24         \   'type': 'E',
25         \})
26     endfor
27
28     return l:output
29 endfunction
30
31 call ale#linter#Define('vhdl', {
32 \   'name': 'ghdl',
33 \   'output_stream': 'stderr',
34 \   'executable': {b -> ale#Var(b, 'vhdl_ghdl_executable')},
35 \   'command': function('ale_linters#vhdl#ghdl#GetCommand'),
36 \   'callback': 'ale_linters#vhdl#ghdl#Handle',
37 \})