-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathlinter.py
57 lines (41 loc) · 1.37 KB
/
linter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Bruno JJE
# Copyright (c) 2015 Bruno JJE
#
# License: MIT
#
"""This module exports the Xvhdl plugin class."""
from SublimeLinter.lint import Linter
class Xvhdl(Linter):
"""Provides an interface to xvhdl (from Xilinx Vivado Simulator)."""
name = 'xvhdl'
cmd = 'xvhdl ${file}'
defaults = {
'selector': 'source.vhdl, source.vhd',
}
tempfile_suffix = 'vhd'
# the following attributes are marked useless for SL4
#version_args = '--version --nolog'
#version_re = r'Vivado Simulator (?P<version>\d+\.\d+)'
#version_requirement = '>= 2014.4'
# Here is a sample xvhdl error output:
# ----8<------------
# ERROR: [VRFC 10-91] td_logic is not declared [/home/BrunoJJE/src/filtre8.vhd:35]
# ----8<------------
regex = (
r"^(?P<error>ERROR: )(?P<message>\[.*\].*)"
r"\[(?P<path>.*):(?P<line>[0-9]+)\]"
)
def split_match(self, match):
"""
Extract and return values from match.
We override this method to prefix the error message with the
linter name.
"""
match, line, col, error, warning, message, near = super().split_match(match)
if match:
message = '[xvhdl] ' + message
return match, line, col, error, warning, message, near