xref: /vim-8.2.3635/runtime/syntax/icon.vim (revision 89bcfda6)
1" Vim syntax file
2" Language:	Icon
3" Maintainer:	Wendell Turner <[email protected]>
4" URL:		ftp://ftp.halcyon.com/pub/users/wturner/icon.vim
5" Last Change:	2003 May 11
6
7" quit when a syntax file was already loaded
8if exists("b:current_syntax")
9  finish
10endif
11
12syn keyword  iconFunction   abs acos any args asin atan bal
13syn keyword  iconFunction   callout center char chdir close collect copy
14syn keyword  iconFunction   cos cset delay delete detab display dtor
15syn keyword  iconFunction   entab errorclear exit exp find flush function
16syn keyword  iconFunction   get getch getche getenv iand icom image
17syn keyword  iconFunction   insert integer ior ishift ixor kbhit key
18syn keyword  iconFunction   left list loadfunc log many map match
19syn keyword  iconFunction   member move name numeric open ord pop
20syn keyword  iconFunction   pos proc pull push put read reads
21syn keyword  iconFunction   real remove rename repl reverse right rtod
22syn keyword  iconFunction   runerr save seek seq set sin sort
23syn keyword  iconFunction   sortf sqrt stop string system tab table
24syn keyword  iconFunction   tan trim type upto variable where write writes
25
26" Keywords
27syn match iconKeyword "&allocated"
28syn match iconKeyword "&ascii"
29syn match iconKeyword "&clock"
30syn match iconKeyword "&collections"
31syn match iconKeyword "&cset"
32syn match iconKeyword "&current"
33syn match iconKeyword "&date"
34syn match iconKeyword "&dateline"
35syn match iconKeyword "&digits"
36syn match iconKeyword "&dump"
37syn match iconKeyword "&e"
38syn match iconKeyword "&error"
39syn match iconKeyword "&errornumber"
40syn match iconKeyword "&errortext"
41syn match iconKeyword "&errorvalue"
42syn match iconKeyword "&errout"
43syn match iconKeyword "&fail"
44syn match iconKeyword "&features"
45syn match iconKeyword "&file"
46syn match iconKeyword "&host"
47syn match iconKeyword "&input"
48syn match iconKeyword "&lcase"
49syn match iconKeyword "&letters"
50syn match iconKeyword "&level"
51syn match iconKeyword "&line"
52syn match iconKeyword "&main"
53syn match iconKeyword "&null"
54syn match iconKeyword "&output"
55syn match iconKeyword "&phi"
56syn match iconKeyword "&pi"
57syn match iconKeyword "&pos"
58syn match iconKeyword "&progname"
59syn match iconKeyword "&random"
60syn match iconKeyword "&regions"
61syn match iconKeyword "&source"
62syn match iconKeyword "&storage"
63syn match iconKeyword "&subject"
64syn match iconKeyword "&time"
65syn match iconKeyword "&trace"
66syn match iconKeyword "&ucase"
67syn match iconKeyword "&version"
68
69" Reserved words
70syn keyword iconReserved break by case create default do
71syn keyword iconReserved else end every fail if
72syn keyword iconReserved initial link next not of
73syn keyword iconReserved procedure repeat return suspend
74syn keyword iconReserved then to until while
75
76" Storage class reserved words
77syn keyword	iconStorageClass	global static local record
78
79syn keyword	iconTodo	contained TODO FIXME XXX BUG
80
81" String and Character constants
82" Highlight special characters (those which have a backslash) differently
83syn match iconSpecial contained "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^c[a-zA-Z0-9]\|\\$"
84syn region	iconString	start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconSpecial
85syn region	iconCset	start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconSpecial
86syn match	iconCharacter	"'[^\\]'"
87
88" not sure about these
89"syn match	iconSpecialCharacter "'\\[bdeflnrtv]'"
90"syn match	iconSpecialCharacter "'\\\o\{3\}'"
91"syn match	iconSpecialCharacter "'\\x\x\{2}'"
92"syn match	iconSpecialCharacter "'\\^c\[a-zA-Z0-9]'"
93
94"when wanted, highlight trailing white space
95if exists("icon_space_errors")
96  syn match	iconSpaceError	"\s*$"
97  syn match	iconSpaceError	" \+\t"me=e-1
98endif
99
100"catch errors caused by wrong parenthesis
101syn cluster	iconParenGroup contains=iconParenError,iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
102
103syn region	iconParen	transparent start='(' end=')' contains=ALLBUT,@iconParenGroup
104syn match	iconParenError	")"
105syn match	iconInParen	contained "[{}]"
106
107
108syn case ignore
109
110"integer number, or floating point number without a dot
111syn match	iconNumber		"\<\d\+\>"
112
113"floating point number, with dot, optional exponent
114syn match	iconFloat		"\<\d\+\.\d*\(e[-+]\=\d\+\)\=\>"
115
116"floating point number, starting with a dot, optional exponent
117syn match	iconFloat		"\.\d\+\(e[-+]\=\d\+\)\=\>"
118
119"floating point number, without dot, with exponent
120syn match	iconFloat		"\<\d\+e[-+]\=\d\+\>"
121
122"radix number
123syn match	iconRadix		"\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
124
125
126" syn match iconIdentifier	"\<[a-z_][a-z0-9_]*\>"
127
128syn case match
129
130" Comment
131syn match	iconComment	"#.*" contains=iconTodo,iconSpaceError
132
133syn region	iconPreCondit start="^\s*$\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=iconComment,iconString,iconCharacter,iconNumber,iconCommentError,iconSpaceError
134
135syn region	iconIncluded	contained start=+"+ skip=+\\\\\|\\"+ end=+"+
136syn match	iconIncluded	contained "<[^>]*>"
137syn match	iconInclude	"^\s*$\s*include\>\s*["<]" contains=iconIncluded
138"syn match iconLineSkip	"\\$"
139
140syn cluster	iconPreProcGroup contains=iconPreCondit,iconIncluded,iconInclude,iconDefine,iconInParen,iconUserLabel
141
142syn region	iconDefine	start="^\s*$\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@iconPreProcGroup
143
144"wt:syn region	iconPreProc "start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" "end="$" contains=ALLBUT,@iconPreProcGroup
145
146" Highlight User Labels
147
148" syn cluster	iconMultiGroup contains=iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
149
150if !exists("icon_minlines")
151  let icon_minlines = 15
152endif
153exec "syn sync ccomment iconComment minlines=" . icon_minlines
154
155" Define the default highlighting.
156
157" Only when an item doesn't have highlighting
158command -nargs=+ HiLink hi def link <args>
159
160" The default methods for highlighting.  Can be overridden later
161
162" HiLink iconSpecialCharacter	iconSpecial
163
164HiLink iconOctalError		iconError
165HiLink iconParenError		iconError
166HiLink iconInParen		iconError
167HiLink iconCommentError	iconError
168HiLink iconSpaceError		iconError
169HiLink iconCommentError	iconError
170HiLink iconIncluded		iconString
171HiLink iconCommentString	iconString
172HiLink iconComment2String	iconString
173HiLink iconCommentSkip	iconComment
174
175HiLink iconUserLabel		Label
176HiLink iconCharacter		Character
177HiLink iconNumber			Number
178HiLink iconRadix			Number
179HiLink iconFloat			Float
180HiLink iconInclude		Include
181HiLink iconPreProc		PreProc
182HiLink iconDefine			Macro
183HiLink iconError			Error
184HiLink iconStatement		Statement
185HiLink iconPreCondit		PreCondit
186HiLink iconString			String
187HiLink iconCset			String
188HiLink iconComment		Comment
189HiLink iconSpecial		SpecialChar
190HiLink iconTodo			Todo
191HiLink iconStorageClass	StorageClass
192HiLink iconFunction		Statement
193HiLink iconReserved		Label
194HiLink iconKeyword		Operator
195
196"HiLink iconIdentifier	Identifier
197
198delcommand HiLink
199
200let b:current_syntax = "icon"
201
202