]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/verilog/yosys.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 '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / ale_linters / verilog / yosys.vim
1 " Author: Nathan Sharp <nwsharp+eda@live.com>
2 " Description: Yosys for Verilog files
3
4 call ale#Set('verilog_yosys_executable', 'yosys')
5 call ale#Set('verilog_yosys_options', '-Q -T -p ''read_verilog %s''')
6
7 function! ale_linters#verilog#yosys#GetCommand(buffer) abort
8     return '%e ' . ale#Var(a:buffer, 'verilog_yosys_options') . ' 2>&1'
9 endfunction
10
11 function! ale_linters#verilog#yosys#Handle(buffer, lines) abort
12     let l:output = []
13     let l:path = fnamemodify(bufname(a:buffer), ':p')
14
15     for l:match in ale#util#GetMatches(a:lines, '^\([^:]\+\):\(\d\+\): \(WARNING\|ERROR\): \(.\+\)$')
16         call add(l:output, {
17         \   'lnum': str2nr(l:match[2]),
18         \   'text': l:match[4],
19         \   'type': l:match[3][0],
20         \   'filename': l:match[1],
21         \})
22     endfor
23
24     for l:match in ale#util#GetMatches(a:lines, '^\(Warning\|ERROR\): \(.\+\)$')
25         call add(l:output, {
26         \   'lnum': 1,
27         \   'text': l:match[2],
28         \   'type': l:match[1][0],
29         \})
30     endfor
31
32     return l:output
33 endfunction
34
35 call ale#linter#Define('verilog', {
36 \   'name': 'yosys',
37 \   'output_stream': 'stdout',
38 \   'executable': {b -> ale#Var(b, 'verilog_yosys_executable')},
39 \   'command': function('ale_linters#verilog#yosys#GetCommand'),
40 \   'callback': 'ale_linters#verilog#yosys#Handle',
41 \   'lint_file': 1,
42 \})