1623
|
1 " Vim syntax file
|
1668
|
2 " Language: HASTE - a language for VLSI IC programming
|
1623
|
3 " Maintainer: M. Tranchero - maurizio.tranchero?gmail.com
|
|
4 " Credits: some parts have been taken from vhdl, verilog, and C syntax
|
|
5 " files
|
1668
|
6 " 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
|
1623
|
10
|
|
11 " HASTE
|
|
12 if exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15 " For version 5.x: Clear all syntax items
|
|
16 " For version 6.x: Quit when a syntax file was already loaded
|
|
17 if version < 600
|
|
18 syntax clear
|
|
19 elseif exists("b:current_syntax")
|
|
20 finish
|
|
21 endif
|
|
22
|
|
23 " case is significant
|
|
24 syn case match
|
|
25
|
|
26 " HASTE keywords
|
|
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
|
|
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"
|
|
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]\+\>"
|
1668
|
56 syn match hasteError "\(\([[:alnum:]]\+\s*(\s\+\|)\s*,\)\)\s*\([[:alnum:]]\+\s*(\)"
|
1623
|
57
|
|
58 " Predifined Haste types
|
|
59 syn keyword hasteType bool
|
|
60
|
|
61 " Values for standard Haste types
|
|
62 " syn match hasteVector "\'[0L1HXWZU\-\?]\'"
|
|
63
|
|
64 syn match hasteVector "0b\"[01_]\+\""
|
|
65 syn match hasteVector "0x\"[0-9a-f_]\+\""
|
|
66 syn match hasteCharacter "'.'"
|
1668
|
67 " syn region hasteString start=+"+ end=+"+
|
1623
|
68 syn match hasteIncluded display contained "<[^>]*>"
|
|
69 syn match hasteIncluded display contained "<[^"]*>"
|
1668
|
70 syn region hasteInclude start="^\s*#include\>\s*" end="$" contains=hasteIncluded,hasteString
|
1623
|
71
|
|
72 " integer numbers
|
1668
|
73 syn match hasteNumber "\d\+\^[[:alnum:]]*[-+]\{0,1\}[[:alnum:]]*"
|
|
74 syn match hasteNumber "-\=\<\d\+\(\^[+\-]\=\d\+\)\>"
|
1623
|
75 syn match hasteNumber "-\=\<\d\+\>"
|
1668
|
76 " syn match hasteNumber "0*2#[01_]\+#\(\^[+\-]\=\d\+\)\="
|
|
77 " syn match hasteNumber "0*16#[0-9a-f_]\+#\(\^[+\-]\=\d\+\)\="
|
1623
|
78 " operators
|
1668
|
79 syn keyword hasteSeparators & , . \|
|
1623
|
80 syn keyword hasteExecution \|\| ; @
|
1668
|
81 syn keyword hasteOperator := ? ! :
|
1623
|
82 syn keyword hasteTypeConstr "[" << >> .. "]" ~
|
|
83 syn keyword hasteExprOp < <= >= > = # <> + - * == ##
|
|
84 syn keyword hasteMisc ( ) 0x 0b
|
|
85 "
|
|
86 syn match hasteSeparators "[&:\|,.]"
|
|
87 syn match hasteOperator ":="
|
1668
|
88 syn match hasteOperator ":"
|
1623
|
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 "##"
|
1668
|
106 " syn match hasteExprOp "#"
|
1623
|
107 syn match hasteExprOp "*"
|
|
108 syn match hasteExprOp "+"
|
|
109
|
|
110 syn region hasteComment start="/\*" end="\*/" contains=@Spell
|
|
111 syn region hasteComment start="{" end="}" contains=@Spell
|
|
112 syn match hasteComment "//.*" contains=@Spell
|
|
113
|
|
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
|
1668
|
129 "
|
1623
|
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
|
1668
|
140 " hi def link hastePreProc Preproc
|
|
141 " hi def link hastePreProcVar Special
|
1623
|
142
|
|
143 let b:current_syntax = "haste"
|
|
144
|
|
145 " vim: ts=8
|