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