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