blob: b889c5c594cd291f8da60e4ad25a7f1c10b492be [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
15" For version 5.x: Clear all syntax items
16" For version 6.x: Quit when a syntax file was already loaded
17if version < 600
18 syntax clear
19elseif exists("b:current_syntax")
20 finish
21endif
22
23" case is significant
24syn case match
25
26" HASTE keywords
27syn keyword hasteStatement act alias arb array begin bitvec
28syn keyword hasteStatement bitwidth boolvec broad case
29syn keyword hasteStatement cast chan const dataprobe do edge
30syn keyword hasteStatement else end export false ff fi file
31syn keyword hasteStatement fit for forever func if import
32syn keyword hasteStatement inprobe is les main narb narrow
33syn keyword hasteStatement negedge od of or outprobe pas
34syn keyword hasteStatement posedge probe proc ram ramreg
35syn keyword hasteStatement repeat rom romreg sample sel si
36syn keyword hasteStatement sign sizeof skip stop then true
37syn keyword hasteStatement type until var wait wire
38syn keyword hasteFutureExt Z ffe partial
39syn keyword hasteVerilog buf reg while
40
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"
44syn match hasteStatement "\<\(if\|then\|else\|fi\)\>"
45syn match hasteNone "\<else\s\+if\>$"
46syn match hasteNone "\<else\s\+if\>\s"
47syn match hasteNone "\<elseif\>\s"
48syn match hasteNone "\<elsif\>\s"
49syn match hasteStatement "\<\(case\|is\|si\)\>"
50syn match hasteStatement "\<\(repeat\|until\)\>"
51syn match hasteStatement "\<\(forever\|do\|od\)\>"
52syn match hasteStatement "\<\(for\|do\|od\)\>"
53syn match hasteStatement "\<\(do\|or\|od\)\>"
54syn match hasteStatement "\<\(sel\|les\)\>"
55syn match hasteError "\<\d\+[_a-zA-Z]\+\>"
Bram Moolenaarc236c162008-07-13 17:41:49 +000056syn match hasteError "\(\([[:alnum:]]\+\s*(\s\+\|)\s*,\)\)\s*\([[:alnum:]]\+\s*(\)"
Bram Moolenaar864207d2008-06-24 22:14:38 +000057
58" Predifined Haste types
59syn keyword hasteType bool
60
61" Values for standard Haste types
62" syn match hasteVector "\'[0L1HXWZU\-\?]\'"
63
64syn match hasteVector "0b\"[01_]\+\""
65syn match hasteVector "0x\"[0-9a-f_]\+\""
66syn match hasteCharacter "'.'"
Bram Moolenaarc236c162008-07-13 17:41:49 +000067" syn region hasteString start=+"+ end=+"+
Bram Moolenaar864207d2008-06-24 22:14:38 +000068syn match hasteIncluded display contained "<[^>]*>"
69syn match hasteIncluded display contained "<[^"]*>"
Bram Moolenaarc236c162008-07-13 17:41:49 +000070syn region hasteInclude start="^\s*#include\>\s*" end="$" contains=hasteIncluded,hasteString
Bram Moolenaar864207d2008-06-24 22:14:38 +000071
Bram Moolenaar864207d2008-06-24 22:14:38 +000072" integer numbers
Bram Moolenaarc236c162008-07-13 17:41:49 +000073syn match hasteNumber "\d\+\^[[:alnum:]]*[-+]\{0,1\}[[:alnum:]]*"
74syn match hasteNumber "-\=\<\d\+\(\^[+\-]\=\d\+\)\>"
Bram Moolenaar864207d2008-06-24 22:14:38 +000075syn match hasteNumber "-\=\<\d\+\>"
Bram Moolenaarc236c162008-07-13 17:41:49 +000076" syn match hasteNumber "0*2#[01_]\+#\(\^[+\-]\=\d\+\)\="
77" syn match hasteNumber "0*16#[0-9a-f_]\+#\(\^[+\-]\=\d\+\)\="
Bram Moolenaar864207d2008-06-24 22:14:38 +000078" operators
Bram Moolenaarc236c162008-07-13 17:41:49 +000079syn keyword hasteSeparators & , . \|
Bram Moolenaar864207d2008-06-24 22:14:38 +000080syn keyword hasteExecution \|\| ; @
Bram Moolenaarc236c162008-07-13 17:41:49 +000081syn keyword hasteOperator := ? ! :
Bram Moolenaar864207d2008-06-24 22:14:38 +000082syn keyword hasteTypeConstr "[" << >> .. "]" ~
83syn keyword hasteExprOp < <= >= > = # <> + - * == ##
84syn keyword hasteMisc ( ) 0x 0b
85"
86syn match hasteSeparators "[&:\|,.]"
87syn match hasteOperator ":="
Bram Moolenaarc236c162008-07-13 17:41:49 +000088syn match hasteOperator ":"
Bram Moolenaar864207d2008-06-24 22:14:38 +000089syn match hasteOperator "?"
90syn match hasteOperator "!"
91syn match hasteExecution "||"
92syn match hasteExecution ";"
93syn match hasteExecution "@"
94syn match hasteType "\[\["
95syn match hasteType "\]\]"
96syn match hasteType "<<"
97syn match hasteType ">>"
98syn match hasteExprOp "<"
99syn match hasteExprOp "<="
100syn match hasteExprOp ">="
101syn match hasteExprOp ">"
102syn match hasteExprOp "<>"
103syn match hasteExprOp "="
104syn match hasteExprOp "=="
105syn match hasteExprOp "##"
Bram Moolenaarc236c162008-07-13 17:41:49 +0000106" syn match hasteExprOp "#"
Bram Moolenaar864207d2008-06-24 22:14:38 +0000107syn match hasteExprOp "*"
108syn match hasteExprOp "+"
109
110syn region hasteComment start="/\*" end="\*/" contains=@Spell
111syn region hasteComment start="{" end="}" contains=@Spell
112syn match hasteComment "//.*" contains=@Spell
113
114" Define the default highlighting.
115" Only when an item doesn't have highlighting yet
116hi def link hasteSpecial Special
117hi def link hasteStatement Statement
118hi def link hasteCharacter String
119hi def link hasteString String
120hi def link hasteVector String
121hi def link hasteBoolean String
122hi def link hasteComment Comment
123hi def link hasteNumber String
124hi def link hasteTime String
125hi def link hasteType Type
126hi def link hasteGlobal Error
127hi def link hasteError Error
128hi def link hasteAttribute Type
Bram Moolenaarc236c162008-07-13 17:41:49 +0000129"
Bram Moolenaar864207d2008-06-24 22:14:38 +0000130hi def link hasteSeparators Special
131hi def link hasteExecution Special
132hi def link hasteTypeConstr Special
133hi def link hasteOperator Type
134hi def link hasteExprOp Type
135hi def link hasteMisc String
136hi def link hasteFutureExt Error
137hi def link hasteVerilog Error
138hi def link hasteDefine Macro
139hi def link hasteInclude Include
Bram Moolenaarc236c162008-07-13 17:41:49 +0000140" hi def link hastePreProc Preproc
141" hi def link hastePreProcVar Special
Bram Moolenaar864207d2008-06-24 22:14:38 +0000142
143let b:current_syntax = "haste"
144
145" vim: ts=8