1" 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" 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
158
159" The default methods for highlighting.  Can be overridden later
160
161" hi def link iconSpecialCharacter	iconSpecial
162
163hi def link iconOctalError		iconError
164hi def link iconParenError		iconError
165hi def link iconInParen		iconError
166hi def link iconCommentError	iconError
167hi def link iconSpaceError		iconError
168hi def link iconCommentError	iconError
169hi def link iconIncluded		iconString
170hi def link iconCommentString	iconString
171hi def link iconComment2String	iconString
172hi def link iconCommentSkip	iconComment
173
174hi def link iconUserLabel		Label
175hi def link iconCharacter		Character
176hi def link iconNumber			Number
177hi def link iconRadix			Number
178hi def link iconFloat			Float
179hi def link iconInclude		Include
180hi def link iconPreProc		PreProc
181hi def link iconDefine			Macro
182hi def link iconError			Error
183hi def link iconStatement		Statement
184hi def link iconPreCondit		PreCondit
185hi def link iconString			String
186hi def link iconCset			String
187hi def link iconComment		Comment
188hi def link iconSpecial		SpecialChar
189hi def link iconTodo			Todo
190hi def link iconStorageClass	StorageClass
191hi def link iconFunction		Statement
192hi def link iconReserved		Label
193hi def link iconKeyword		Operator
194
195"hi def link iconIdentifier	Identifier
196
197
198let b:current_syntax = "icon"
199
200