summaryrefslogtreecommitdiff
path: root/ale_linters/vhdl/vcom.vim
diff options
context:
space:
mode:
authorJohn Gentile <johncgentile17@gmail.com>2019-01-27 04:46:33 -0500
committerw0rp <w0rp@users.noreply.github.com>2019-01-27 09:46:33 +0000
commitb8bf7b220d0f7ab461ed830b125f9dbc42a7836a (patch)
tree0f4b112c5c082b156ca8393d3242cb3fe762bfd8 /ale_linters/vhdl/vcom.vim
parent91c1fc3bb396dfcb495c484db7d39193df8826eb (diff)
downloadale-b8bf7b220d0f7ab461ed830b125f9dbc42a7836a.zip
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
Diffstat (limited to 'ale_linters/vhdl/vcom.vim')
-rw-r--r--ale_linters/vhdl/vcom.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/ale_linters/vhdl/vcom.vim b/ale_linters/vhdl/vcom.vim
new file mode 100644
index 00000000..3df5633e
--- /dev/null
+++ b/ale_linters/vhdl/vcom.vim
@@ -0,0 +1,38 @@
+" Author: John Gentile <johncgentile17@gmail.com>
+" Description: Adds support for Mentor Graphics Questa/ModelSim `vcom` VHDL compiler/checker
+
+call ale#Set('vhdl_vcom_executable', 'vcom')
+" Use VHDL-2008. See `$ vcom -h` for more options
+call ale#Set('vhdl_vcom_options', '-2008 -quiet -lint')
+
+function! ale_linters#vhdl#vcom#GetCommand(buffer) abort
+ return '%e ' . ale#Pad(ale#Var(a:buffer, 'vhdl_vcom_options')) . ' %t'
+endfunction
+
+function! ale_linters#vhdl#vcom#Handle(buffer, lines) abort
+ "Matches patterns like the following:
+ "** Warning: ../path/to/file.vhd(218): (vcom-1236) Shared variables must be of a protected type.
+ "** Error: tb_file.vhd(73): (vcom-1136) Unknown identifier "aresetn".
+ "** Error: tb_file.vhd(73): Bad resolution function (STD_LOGIC) for type (error).
+ "** Error: tb_file.vhd(73): near ":": (vcom-1576) expecting ';' or ')'.
+ let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[2] + 0,
+ \ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
+ \ 'text': l:match[3],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('vhdl', {
+\ 'name': 'vcom',
+\ 'output_stream': 'stdout',
+\ 'executable_callback': ale#VarFunc('vhdl_vcom_executable'),
+\ 'command_callback': 'ale_linters#vhdl#vcom#GetCommand',
+\ 'callback': 'ale_linters#vhdl#vcom#Handle',
+\})