blob: 54495f8ba52e5e33c8ab7df4efc7967faeabec98 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: CUPL
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 cuplHeader name partno date revision rev designer company nextgroup=cuplHeaderContents
19syn keyword cuplHeader assembly assy location device nextgroup=cuplHeaderContents
20
21syn keyword cuplTodo contained TODO XXX FIXME
22
23" cuplHeaderContents uses default highlighting except for numbers
24syn match cuplHeaderContents ".\+;"me=e-1 contains=cuplNumber contained
25
Bram Moolenaar6c391a72021-09-09 21:55:11 +020026" String constants
Bram Moolenaar071d4272004-06-13 20:20:40 +000027syn region cuplString start=+'+ end=+'+
28syn region cuplString start=+"+ end=+"+
29
30syn keyword cuplStatement append condition
31syn keyword cuplStatement default else
32syn keyword cuplStatement field fld format function fuse
33syn keyword cuplStatement group if jump loc
34syn keyword cuplStatement macro min node out
35syn keyword cuplStatement pin pinnode present table
36syn keyword cuplStatement sequence sequenced sequencejk sequencers sequencet
37
38syn keyword cuplFunction log2 log8 log16 log
39
40" Valid integer number formats (decimal, binary, octal, hex)
41syn match cuplNumber "\<[-+]\=[0-9]\+\>"
42syn match cuplNumber "'d'[0-9]\+\>"
43syn match cuplNumber "'b'[01x]\+\>"
44syn match cuplNumber "'o'[0-7x]\+\>"
45syn match cuplNumber "'h'[0-9a-fx]\+\>"
46
47" operators
48syn match cuplLogicalOperator "[!#&$]"
49syn match cuplArithmeticOperator "[-+*/%]"
50syn match cuplArithmeticOperator "\*\*"
51syn match cuplAssignmentOperator ":\=="
52syn match cuplEqualityOperator ":"
53syn match cuplTruthTableOperator "=>"
54
55" Signal extensions
56syn match cuplExtension "\.[as][pr]\>"
57syn match cuplExtension "\.oe\>"
58syn match cuplExtension "\.oemux\>"
59syn match cuplExtension "\.[dlsrjk]\>"
60syn match cuplExtension "\.ck\>"
61syn match cuplExtension "\.dq\>"
62syn match cuplExtension "\.ckmux\>"
63syn match cuplExtension "\.tec\>"
64syn match cuplExtension "\.cnt\>"
65
66syn match cuplRangeOperator "\.\." contained
67
68" match ranges like memadr:[0000..1FFF]
69" and highlight both the numbers and the .. operator
70syn match cuplNumberRange "\<\x\+\.\.\x\+\>" contains=cuplRangeOperator
71
72" match vectors of type [name3..0] (decimal numbers only)
73" but assign them no special highlighting except for the .. operator
74syn match cuplBitVector "\<\a\+\d\+\.\.\d\+\>" contains=cuplRangeOperator
75
76" other special characters
77syn match cuplSpecialChar "[\[\](){},;]"
78
79" directives
80" (define these after cuplOperator so $xxx overrides $)
81syn match cuplDirective "\$msg"
82syn match cuplDirective "\$macro"
83syn match cuplDirective "\$mend"
84syn match cuplDirective "\$repeat"
85syn match cuplDirective "\$repend"
86syn match cuplDirective "\$define"
87syn match cuplDirective "\$include"
88
89" multi-line comments
90syn region cuplComment start=+/\*+ end=+\*/+ contains=cuplNumber,cuplTodo
91
92syn sync minlines=1
93
94" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020095" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000096
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020097" The default highlighting.
Bram Moolenaarf37506f2016-08-31 22:22:10 +020098hi def link cuplHeader cuplStatement
99hi def link cuplLogicalOperator cuplOperator
100hi def link cuplRangeOperator cuplOperator
101hi def link cuplArithmeticOperator cuplOperator
102hi def link cuplAssignmentOperator cuplOperator
103hi def link cuplEqualityOperator cuplOperator
104hi def link cuplTruthTableOperator cuplOperator
105hi def link cuplOperator cuplStatement
106hi def link cuplFunction cuplStatement
107hi def link cuplStatement Statement
108hi def link cuplNumberRange cuplNumber
109hi def link cuplNumber cuplString
110hi def link cuplString String
111hi def link cuplComment Comment
112hi def link cuplExtension cuplSpecial
113hi def link cuplSpecialChar cuplSpecial
114hi def link cuplSpecial Special
115hi def link cuplDirective PreProc
116hi def link cuplTodo Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117
Bram Moolenaar071d4272004-06-13 20:20:40 +0000118
119let b:current_syntax = "cupl"
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100120
121let &cpo = s:cpo_save
122unlet s:cpo_save
123
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124" vim:ts=8