diff options
author | Nathan Sharp <39231199+nwsharp@users.noreply.github.com> | 2021-07-12 06:39:53 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 21:39:53 +0900 |
commit | c8f669249ae064aa014ec180df3934f0a82cab29 (patch) | |
tree | 3ba9d4e7e7d25cfddde068b4b868a5cde2da8ce5 /ale_linters | |
parent | 9a9fd24b17db32e452609e68e6a9729461625720 (diff) | |
download | ale-c8f669249ae064aa014ec180df3934f0a82cab29.zip |
Add Yosys linter for Verilog files. (#3713)
* Add yosys for verilog files.
* Add handler test for yosys.
* fix typo in yosys handler test
* fix array order in yosys handler test
* add yosys linter to filetype defaults test
* fix duplicate tag
* add 'yosys' to 'ale-supported-languages-and-tools.txt'
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/verilog/yosys.vim | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/ale_linters/verilog/yosys.vim b/ale_linters/verilog/yosys.vim new file mode 100644 index 00000000..29657755 --- /dev/null +++ b/ale_linters/verilog/yosys.vim @@ -0,0 +1,42 @@ +" Author: Nathan Sharp <nwsharp+eda@live.com> +" Description: Yosys for Verilog files + +call ale#Set('verilog_yosys_executable', 'yosys') +call ale#Set('verilog_yosys_options', '-Q -T -p ''read_verilog %s''') + +function! ale_linters#verilog#yosys#GetCommand(buffer) abort + return '%e ' . ale#Var(a:buffer, 'verilog_yosys_options') . ' 2>&1' +endfunction + +function! ale_linters#verilog#yosys#Handle(buffer, lines) abort + let l:output = [] + let l:path = fnamemodify(bufname(a:buffer), ':p') + + for l:match in ale#util#GetMatches(a:lines, '^\([^:]\+\):\(\d\+\): \(WARNING\|ERROR\): \(.\+\)$') + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'text': l:match[4], + \ 'type': l:match[3][0], + \ 'filename': l:match[1], + \}) + endfor + + for l:match in ale#util#GetMatches(a:lines, '^\(Warning\|ERROR\): \(.\+\)$') + call add(l:output, { + \ 'lnum': 1, + \ 'text': l:match[2], + \ 'type': l:match[1][0], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('verilog', { +\ 'name': 'yosys', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'verilog_yosys_executable')}, +\ 'command': function('ale_linters#verilog#yosys#GetCommand'), +\ 'callback': 'ale_linters#verilog#yosys#Handle', +\ 'lint_file': 1, +\}) |