blob: 79e9f5ec5659d882dd2c6a29afc38261c2376241 [file] [log] [blame]
Bram Moolenaar864207d2008-06-24 22:14:38 +00001" Vim syntax file
Bram Moolenaarc236c162008-07-13 17:41:49 +00002" Language: HASTE - a language for VLSI IC programming
Bram Moolenaar864207d2008-06-24 22:14:38 +00003" Maintainer: M. Tranchero - maurizio.tranchero?gmail.com
4" Credits: some parts have been taken from vhdl, verilog, and C syntax
5" files
Bram Moolenaarc236c162008-07-13 17:41:49 +00006" Version: 0.9
7" Last Change: 0.9 improvement of haste numbers detection
8" Change: 0.8 error matching for wrong hierarchical connections
9" Change: 0.7 added more rules to highlight pre-processor directives
Bram Moolenaar864207d2008-06-24 22:14:38 +000010
11" HASTE
12if exists("b:current_syntax")
13 finish
14endif
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020015" quit when a syntax file was already loaded
16if exists("b:current_syntax")
Bram Moolenaar864207d2008-06-24 22:14:38 +000017 finish
18endif
19
20" case is significant
21syn case match
22
23" HASTE keywords
24syn keyword hasteStatement act alias arb array begin bitvec
25syn keyword hasteStatement bitwidth boolvec broad case
26syn keyword hasteStatement cast chan const dataprobe do edge
27syn keyword hasteStatement else end export false ff fi file
28syn keyword hasteStatement fit for forever func if import
29syn keyword hasteStatement inprobe is les main narb narrow
30syn keyword hasteStatement negedge od of or outprobe pas
31syn keyword hasteStatement posedge probe proc ram ramreg
32syn keyword hasteStatement repeat rom romreg sample sel si
33syn keyword hasteStatement sign sizeof skip stop then true
34syn keyword hasteStatement type until var wait wire
35syn keyword hasteFutureExt Z ffe partial
36syn keyword hasteVerilog buf reg while
37
38" Special match for "if", "or", and "else" since "else if"
39" and other "else+if" combination shouldn't be highlighted.
40" The right keyword is "or"
41syn match hasteStatement "\<\(if\|then\|else\|fi\)\>"
42syn match hasteNone "\<else\s\+if\>$"
43syn match hasteNone "\<else\s\+if\>\s"
44syn match hasteNone "\<elseif\>\s"
45syn match hasteNone "\<elsif\>\s"
46syn match hasteStatement "\<\(case\|is\|si\)\>"
47syn match hasteStatement "\<\(repeat\|until\)\>"
48syn match hasteStatement "\<\(forever\|do\|od\)\>"
49syn match hasteStatement "\<\(for\|do\|od\)\>"
50syn match hasteStatement "\<\(do\|or\|od\)\>"
51syn match hasteStatement "\<\(sel\|les\)\>"
52syn match hasteError "\<\d\+[_a-zA-Z]\+\>"
Bram Moolenaarc236c162008-07-13 17:41:49 +000053syn match hasteError "\(\([[:alnum:]]\+\s*(\s\+\|)\s*,\)\)\s*\([[:alnum:]]\+\s*(\)"
Bram Moolenaar864207d2008-06-24 22:14:38 +000054
55" Predifined Haste types
56syn keyword hasteType bool
57
58" Values for standard Haste types
59" syn match hasteVector "\'[0L1HXWZU\-\?]\'"
60
61syn match hasteVector "0b\"[01_]\+\""
62syn match hasteVector "0x\"[0-9a-f_]\+\""
63syn match hasteCharacter "'.'"
Bram Moolenaarc236c162008-07-13 17:41:49 +000064" syn region hasteString start=+"+ end=+"+
Bram Moolenaar864207d2008-06-24 22:14:38 +000065syn match hasteIncluded display contained "<[^>]*>"
66syn match hasteIncluded display contained "<[^"]*>"
Bram Moolenaarc236c162008-07-13 17:41:49 +000067syn region hasteInclude start="^\s*#include\>\s*" end="$" contains=hasteIncluded,hasteString
Bram Moolenaar864207d2008-06-24 22:14:38 +000068
Bram Moolenaar864207d2008-06-24 22:14:38 +000069" integer numbers
Bram Moolenaarc236c162008-07-13 17:41:49 +000070syn match hasteNumber "\d\+\^[[:alnum:]]*[-+]\{0,1\}[[:alnum:]]*"
71syn match hasteNumber "-\=\<\d\+\(\^[+\-]\=\d\+\)\>"
Bram Moolenaar864207d2008-06-24 22:14:38 +000072syn match hasteNumber "-\=\<\d\+\>"
Bram Moolenaarc236c162008-07-13 17:41:49 +000073" syn match hasteNumber "0*2#[01_]\+#\(\^[+\-]\=\d\+\)\="
74" syn match hasteNumber "0*16#[0-9a-f_]\+#\(\^[+\-]\=\d\+\)\="
Bram Moolenaar864207d2008-06-24 22:14:38 +000075" operators
Bram Moolenaarc236c162008-07-13 17:41:49 +000076syn keyword hasteSeparators & , . \|
Bram Moolenaar864207d2008-06-24 22:14:38 +000077syn keyword hasteExecution \|\| ; @
Bram Moolenaarc236c162008-07-13 17:41:49 +000078syn keyword hasteOperator := ? ! :
Bram Moolenaar864207d2008-06-24 22:14:38 +000079syn keyword hasteTypeConstr "[" << >> .. "]" ~
80syn keyword hasteExprOp < <= >= > = # <> + - * == ##
81syn keyword hasteMisc ( ) 0x 0b
82"
83syn match hasteSeparators "[&:\|,.]"
84syn match hasteOperator ":="
Bram Moolenaarc236c162008-07-13 17:41:49 +000085syn match hasteOperator ":"
Bram Moolenaar864207d2008-06-24 22:14:38 +000086syn match hasteOperator "?"
87syn match hasteOperator "!"
88syn match hasteExecution "||"
89syn match hasteExecution ";"
90syn match hasteExecution "@"
91syn match hasteType "\[\["
92syn match hasteType "\]\]"
93syn match hasteType "<<"
94syn match hasteType ">>"
95syn match hasteExprOp "<"
96syn match hasteExprOp "<="
97syn match hasteExprOp ">="
98syn match hasteExprOp ">"
99syn match hasteExprOp "<>"
100syn match hasteExprOp "="
101syn match hasteExprOp "=="
102syn match hasteExprOp "##"
Bram Moolenaarc236c162008-07-13 17:41:49 +0000103" syn match hasteExprOp "#"
Bram Moolenaar864207d2008-06-24 22:14:38 +0000104syn match hasteExprOp "*"
105syn match hasteExprOp "+"
106
107syn region hasteComment start="/\*" end="\*/" contains=@Spell
108syn region hasteComment start="{" end="}" contains=@Spell
109syn match hasteComment "//.*" contains=@Spell
110
111" Define the default highlighting.
112" Only when an item doesn't have highlighting yet
113hi def link hasteSpecial Special
114hi def link hasteStatement Statement
115hi def link hasteCharacter String
116hi def link hasteString String
117hi def link hasteVector String
118hi def link hasteBoolean String
119hi def link hasteComment Comment
120hi def link hasteNumber String
121hi def link hasteTime String
122hi def link hasteType Type
123hi def link hasteGlobal Error
124hi def link hasteError Error
125hi def link hasteAttribute Type
Bram Moolenaarc236c162008-07-13 17:41:49 +0000126"
Bram Moolenaar864207d2008-06-24 22:14:38 +0000127hi def link hasteSeparators Special
128hi def link hasteExecution Special
129hi def link hasteTypeConstr Special
130hi def link hasteOperator Type
131hi def link hasteExprOp Type
132hi def link hasteMisc String
133hi def link hasteFutureExt Error
134hi def link hasteVerilog Error
135hi def link hasteDefine Macro
136hi def link hasteInclude Include
Bram Moolenaarc236c162008-07-13 17:41:49 +0000137" hi def link hastePreProc Preproc
138" hi def link hastePreProcVar Special
Bram Moolenaar864207d2008-06-24 22:14:38 +0000139
140let b:current_syntax = "haste"
141
142" vim: ts=8