Skip to content

Commit

Permalink
Add language definition for Verilog
Browse files Browse the repository at this point in the history
Closes coala#5825
  • Loading branch information
kiy4h authored and gitmate-bot committed Nov 11, 2018
1 parent 23ab103 commit 98a285c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions coalib/bearlib/languages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from .definitions.TinyBasic import TinyBasic
from .definitions.TypeScript import TypeScript
from .definitions.Vala import Vala
from .definitions.Verilog import Verilog
from .definitions.VisualBasic import VisualBasic
from .definitions.XML import XML
from .definitions.ZShell import ZShell
Expand Down
31 changes: 31 additions & 0 deletions coalib/bearlib/languages/definitions/Verilog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from coalib.bearlib.languages.Language import Language


@Language
class Verilog:
aliases = 'verilog',
extensions = '.v',
comment_delimiters = '//',
multiline_comment_delimiters = {'/*': '*/'}
string_delimiters = {'"': '"'}
encapsulators = {'(': ')', '[': ']', '{': '}'}
string_delimiter_escape = {'"': '\\"', "'": "\\'"}
line_continuation = '\\'
keywords = [
'always', 'and', 'assign', 'attribute', 'begin', 'buf', 'bufif0',
'bufif1', 'case', 'casex', 'casez', 'cmos', 'deassign', 'default',
'defparam', 'disable', 'edge', 'else', 'end', 'endattribute',
'endcase', 'endfunction', 'endmodule', 'endprimitive', 'endspecify',
'endtable', 'endtask', 'event', 'for', 'force', 'forever', 'fork',
'function', 'highz0', 'highz1', 'if', 'ifnone', 'initial', 'inout',
'input', 'integer', 'join', 'medium', 'module', 'large', 'macromodule',
'nand', 'negedge', 'nmos', 'nor', 'not', 'notif0', 'notif1', 'or',
'output', 'parameter', 'pmos', 'posedge', 'primitive', 'pull0',
'pull1', 'pulldown', 'pullup', 'rcmos', 'real', 'realtime', 'reg',
'release', 'repeat', 'rnmos', 'rpmos', 'rtran', 'rtranif0', 'rtranif1',
'scalared', 'signed', 'small', 'specify', 'specparam', 'strength',
'strong0', 'strong1', 'supply0', 'supply1', 'table', 'task', 'time',
'tran', 'tranif0', 'tranif1', 'tri', 'tri0', 'tri1', 'triand', 'trior',
'trireg', 'unsigned', 'vectored', 'wait', 'wand', 'weak0', 'weak1',
'while', 'wire', 'wor', 'xnor', 'xor',
]
1 change: 1 addition & 0 deletions tests/TestUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
'TinyBasic 1.0, 2.0',
'TypeScript',
'Vala',
'Verilog',
'VisualBasic',
'm4',
'ZShell',
Expand Down

0 comments on commit 98a285c

Please sign in to comment.