2 " Language: HASTE - a language for VLSI IC programming
3 " Maintainer: M. Tranchero - maurizio.tranchero?gmail.com
4 " Credits: some parts have been taken from vhdl, verilog, and C syntax
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
12 if exists("b:current_syntax")
15 " For version 5.x: Clear all syntax items
16 " For version 6.x: Quit when a syntax file was already loaded
19 elseif exists("b:current_syntax")
27 syn keyword hasteStatement act alias arb array begin bitvec
28 syn keyword hasteStatement bitwidth boolvec broad case
29 syn keyword hasteStatement cast chan const dataprobe do edge
30 syn keyword hasteStatement else end export false ff fi file
31 syn keyword hasteStatement fit for forever func if import
32 syn keyword hasteStatement inprobe is les main narb narrow
33 syn keyword hasteStatement negedge od of or outprobe pas
34 syn keyword hasteStatement posedge probe proc ram ramreg
35 syn keyword hasteStatement repeat rom romreg sample sel si
36 syn keyword hasteStatement sign sizeof skip stop then true
37 syn keyword hasteStatement type until var wait wire
38 syn keyword hasteFutureExt Z ffe partial
39 syn keyword hasteVerilog buf reg while
41 " Special match for "if", "or", and "else" since "else if"
42 " and other "else+if" combination shouldn't be highlighted.
43 " The right keyword is "or"
44 syn match hasteStatement "\<\(if\|then\|else\|fi\)\>"
45 syn match hasteNone "\<else\s\+if\>$"
46 syn match hasteNone "\<else\s\+if\>\s"
47 syn match hasteNone "\<elseif\>\s"
48 syn match hasteNone "\<elsif\>\s"
49 syn match hasteStatement "\<\(case\|is\|si\)\>"
50 syn match hasteStatement "\<\(repeat\|until\)\>"
51 syn match hasteStatement "\<\(forever\|do\|od\)\>"
52 syn match hasteStatement "\<\(for\|do\|od\)\>"
53 syn match hasteStatement "\<\(do\|or\|od\)\>"
54 syn match hasteStatement "\<\(sel\|les\)\>"
55 syn match hasteError "\<\d\+[_a-zA-Z]\+\>"
56 syn match hasteError "\(\([[:alnum:]]\+\s*(\s\+\|)\s*,\)\)\s*\([[:alnum:]]\+\s*(\)"
58 " Predifined Haste types
59 syn keyword hasteType bool
61 " Values for standard Haste types
62 " syn match hasteVector "\'[0L1HXWZU\-\?]\'"
64 syn match hasteVector "0b\"[01_]\+\""
65 syn match hasteVector "0x\"[0-9a-f_]\+\""
66 syn match hasteCharacter "'.'"
67 " syn region hasteString start=+"+ end=+"+
68 syn match hasteIncluded display contained "<[^>]*>"
69 syn match hasteIncluded display contained "<[^"]*>"
70 syn region hasteInclude start="^\s*#include\>\s*" end="$" contains=hasteIncluded,hasteString
73 syn match hasteNumber "\d\+\^[[:alnum:]]*[-+]\{0,1\}[[:alnum:]]*"
74 syn match hasteNumber "-\=\<\d\+\(\^[+\-]\=\d\+\)\>"
75 syn match hasteNumber "-\=\<\d\+\>"
76 " syn match hasteNumber "0*2#[01_]\+#\(\^[+\-]\=\d\+\)\="
77 " syn match hasteNumber "0*16#[0-9a-f_]\+#\(\^[+\-]\=\d\+\)\="
79 syn keyword hasteSeparators & , . \|
80 syn keyword hasteExecution \|\| ; @
81 syn keyword hasteOperator := ? ! :
82 syn keyword hasteTypeConstr "[" << >> .. "]" ~
83 syn keyword hasteExprOp < <= >= > = # <> + - * == ##
84 syn keyword hasteMisc ( ) 0x 0b
86 syn match hasteSeparators "[&:\|,.]"
87 syn match hasteOperator ":="
88 syn match hasteOperator ":"
89 syn match hasteOperator "?"
90 syn match hasteOperator "!"
91 syn match hasteExecution "||"
92 syn match hasteExecution ";"
93 syn match hasteExecution "@"
94 syn match hasteType "\[\["
95 syn match hasteType "\]\]"
96 syn match hasteType "<<"
97 syn match hasteType ">>"
98 syn match hasteExprOp "<"
99 syn match hasteExprOp "<="
100 syn match hasteExprOp ">="
101 syn match hasteExprOp ">"
102 syn match hasteExprOp "<>"
103 syn match hasteExprOp "="
104 syn match hasteExprOp "=="
105 syn match hasteExprOp "##"
106 " syn match hasteExprOp "#"
107 syn match hasteExprOp "*"
108 syn match hasteExprOp "+"
110 syn region hasteComment start="/\*" end="\*/" contains=@Spell
111 syn region hasteComment start="{" end="}" contains=@Spell
112 syn match hasteComment "//.*" contains=@Spell
114 " Define the default highlighting.
115 " Only when an item doesn't have highlighting yet
116 hi def link hasteSpecial Special
117 hi def link hasteStatement Statement
118 hi def link hasteCharacter String
119 hi def link hasteString String
120 hi def link hasteVector String
121 hi def link hasteBoolean String
122 hi def link hasteComment Comment
123 hi def link hasteNumber String
124 hi def link hasteTime String
125 hi def link hasteType Type
126 hi def link hasteGlobal Error
127 hi def link hasteError Error
128 hi def link hasteAttribute Type
130 hi def link hasteSeparators Special
131 hi def link hasteExecution Special
132 hi def link hasteTypeConstr Special
133 hi def link hasteOperator Type
134 hi def link hasteExprOp Type
135 hi def link hasteMisc String
136 hi def link hasteFutureExt Error
137 hi def link hasteVerilog Error
138 hi def link hasteDefine Macro
139 hi def link hasteInclude Include
140 " hi def link hastePreProc Preproc
141 " hi def link hastePreProcVar Special
143 let b:current_syntax = "haste"