7
|
1 " Vim syntax file
|
|
2 " Language: ABEL
|
3237
|
3 " Maintainer: John Cook <johncook3@gmail.com>
|
|
4 " Last Change: 2011 Dec 27
|
7
|
5
|
|
6 " For version 5.x: Clear all syntax items
|
|
7 " For version 6.x: Quit when a syntax file was already loaded
|
|
8 if version < 600
|
|
9 syntax clear
|
|
10 elseif exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
3237
|
14 let s:cpo_save = &cpo
|
|
15 set cpo&vim
|
|
16
|
7
|
17 " this language is oblivious to case
|
|
18 syn case ignore
|
|
19
|
|
20 " A bunch of keywords
|
|
21 syn keyword abelHeader module title device options
|
|
22 syn keyword abelSection declarations equations test_vectors end
|
|
23 syn keyword abelDeclaration state truth_table state_diagram property
|
|
24 syn keyword abelType pin node attribute constant macro library
|
|
25
|
|
26 syn keyword abelTypeId com reg neg pos buffer dc reg_d reg_t contained
|
|
27 syn keyword abelTypeId reg_sr reg_jk reg_g retain xor invert contained
|
|
28
|
|
29 syn keyword abelStatement when then else if with endwith case endcase
|
|
30 syn keyword abelStatement fuses expr trace
|
|
31
|
|
32 " option to omit obsolete statements
|
|
33 if exists("abel_obsolete_ok")
|
|
34 syn keyword abelStatement enable flag in
|
|
35 else
|
|
36 syn keyword abelError enable flag in
|
|
37 endif
|
|
38
|
|
39 " directives
|
|
40 syn match abelDirective "@alternate"
|
|
41 syn match abelDirective "@standard"
|
|
42 syn match abelDirective "@const"
|
|
43 syn match abelDirective "@dcset"
|
|
44 syn match abelDirective "@include"
|
|
45 syn match abelDirective "@page"
|
|
46 syn match abelDirective "@radix"
|
|
47 syn match abelDirective "@repeat"
|
|
48 syn match abelDirective "@irp"
|
|
49 syn match abelDirective "@expr"
|
|
50 syn match abelDirective "@if"
|
|
51 syn match abelDirective "@ifb"
|
|
52 syn match abelDirective "@ifnb"
|
|
53 syn match abelDirective "@ifdef"
|
|
54 syn match abelDirective "@ifndef"
|
|
55 syn match abelDirective "@ifiden"
|
|
56 syn match abelDirective "@ifniden"
|
|
57
|
|
58 syn keyword abelTodo contained TODO XXX FIXME
|
|
59
|
|
60 " wrap up type identifiers to differentiate them from normal strings
|
|
61 syn region abelSpecifier start='istype' end=';' contains=abelTypeIdChar,abelTypeId,abelTypeIdEnd keepend
|
|
62 syn match abelTypeIdChar "[,']" contained
|
|
63 syn match abelTypeIdEnd ";" contained
|
|
64
|
|
65 " string contstants and special characters within them
|
|
66 syn match abelSpecial contained "\\['\\]"
|
|
67 syn region abelString start=+'+ skip=+\\"+ end=+'+ contains=abelSpecial
|
|
68
|
|
69 " valid integer number formats (decimal, binary, octal, hex)
|
|
70 syn match abelNumber "\<[-+]\=[0-9]\+\>"
|
|
71 syn match abelNumber "\^d[0-9]\+\>"
|
|
72 syn match abelNumber "\^b[01]\+\>"
|
|
73 syn match abelNumber "\^o[0-7]\+\>"
|
|
74 syn match abelNumber "\^h[0-9a-f]\+\>"
|
|
75
|
|
76 " special characters
|
|
77 " (define these after abelOperator so ?= overrides ?)
|
|
78 syn match abelSpecialChar "[\[\](){},;:?]"
|
|
79
|
|
80 " operators
|
|
81 syn match abelLogicalOperator "[!#&$]"
|
|
82 syn match abelRangeOperator "\.\."
|
|
83 syn match abelAlternateOperator "[/*+]"
|
|
84 syn match abelAlternateOperator ":[+*]:"
|
|
85 syn match abelArithmeticOperator "[-%]"
|
|
86 syn match abelArithmeticOperator "<<"
|
|
87 syn match abelArithmeticOperator ">>"
|
|
88 syn match abelRelationalOperator "[<>!=]="
|
|
89 syn match abelRelationalOperator "[<>]"
|
|
90 syn match abelAssignmentOperator "[:?]\=="
|
|
91 syn match abelAssignmentOperator "?:="
|
|
92 syn match abelTruthTableOperator "->"
|
|
93
|
|
94 " signal extensions
|
|
95 syn match abelExtension "\.aclr\>"
|
|
96 syn match abelExtension "\.aset\>"
|
|
97 syn match abelExtension "\.clk\>"
|
|
98 syn match abelExtension "\.clr\>"
|
|
99 syn match abelExtension "\.com\>"
|
|
100 syn match abelExtension "\.fb\>"
|
|
101 syn match abelExtension "\.[co]e\>"
|
|
102 syn match abelExtension "\.l[eh]\>"
|
|
103 syn match abelExtension "\.fc\>"
|
|
104 syn match abelExtension "\.pin\>"
|
|
105 syn match abelExtension "\.set\>"
|
|
106 syn match abelExtension "\.[djksrtq]\>"
|
|
107 syn match abelExtension "\.pr\>"
|
|
108 syn match abelExtension "\.re\>"
|
|
109 syn match abelExtension "\.a[pr]\>"
|
|
110 syn match abelExtension "\.s[pr]\>"
|
|
111
|
|
112 " special constants
|
|
113 syn match abelConstant "\.[ckudfpxz]\."
|
|
114 syn match abelConstant "\.sv[2-9]\."
|
|
115
|
|
116 " one-line comments
|
|
117 syn region abelComment start=+"+ end=+"\|$+ contains=abelNumber,abelTodo
|
|
118 " option to prevent C++ style comments
|
|
119 if !exists("abel_cpp_comments_illegal")
|
|
120 syn region abelComment start=+//+ end=+$+ contains=abelNumber,abelTodo
|
|
121 endif
|
|
122
|
|
123 syn sync minlines=1
|
|
124
|
|
125 " Define the default highlighting.
|
|
126 " For version 5.7 and earlier: only when not done already
|
|
127 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
128 if version >= 508 || !exists("did_abel_syn_inits")
|
|
129 if version < 508
|
|
130 let did_abel_syn_inits = 1
|
|
131 command -nargs=+ HiLink hi link <args>
|
|
132 else
|
|
133 command -nargs=+ HiLink hi def link <args>
|
|
134 endif
|
|
135
|
|
136 " The default highlighting.
|
|
137 HiLink abelHeader abelStatement
|
|
138 HiLink abelSection abelStatement
|
|
139 HiLink abelDeclaration abelStatement
|
|
140 HiLink abelLogicalOperator abelOperator
|
|
141 HiLink abelRangeOperator abelOperator
|
|
142 HiLink abelAlternateOperator abelOperator
|
|
143 HiLink abelArithmeticOperator abelOperator
|
|
144 HiLink abelRelationalOperator abelOperator
|
|
145 HiLink abelAssignmentOperator abelOperator
|
|
146 HiLink abelTruthTableOperator abelOperator
|
|
147 HiLink abelSpecifier abelStatement
|
|
148 HiLink abelOperator abelStatement
|
|
149 HiLink abelStatement Statement
|
|
150 HiLink abelIdentifier Identifier
|
|
151 HiLink abelTypeId abelType
|
|
152 HiLink abelTypeIdChar abelType
|
|
153 HiLink abelType Type
|
|
154 HiLink abelNumber abelString
|
|
155 HiLink abelString String
|
|
156 HiLink abelConstant Constant
|
|
157 HiLink abelComment Comment
|
|
158 HiLink abelExtension abelSpecial
|
|
159 HiLink abelSpecialChar abelSpecial
|
|
160 HiLink abelTypeIdEnd abelSpecial
|
|
161 HiLink abelSpecial Special
|
|
162 HiLink abelDirective PreProc
|
|
163 HiLink abelTodo Todo
|
|
164 HiLink abelError Error
|
|
165
|
|
166 delcommand HiLink
|
|
167 endif
|
|
168
|
|
169 let b:current_syntax = "abel"
|
3237
|
170
|
|
171 let &cpo = s:cpo_save
|
|
172 unlet s:cpo_save
|
|
173
|
7
|
174 " vim:ts=8
|