Merged from the latest developing branch.
[MacVim.git] / runtime / syntax / icon.vim
blob1a73c43d8ff7ef041c26d1f685b5f2c68854da52
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
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
9 if version < 600
10   syntax clear
11 elseif exists("b:current_syntax")
12   finish
13 endif
15 syn keyword  iconFunction   abs acos any args asin atan bal
16 syn keyword  iconFunction   callout center char chdir close collect copy
17 syn keyword  iconFunction   cos cset delay delete detab display dtor
18 syn keyword  iconFunction   entab errorclear exit exp find flush function
19 syn keyword  iconFunction   get getch getche getenv iand icom image
20 syn keyword  iconFunction   insert integer ior ishift ixor kbhit key
21 syn keyword  iconFunction   left list loadfunc log many map match
22 syn keyword  iconFunction   member move name numeric open ord pop
23 syn keyword  iconFunction   pos proc pull push put read reads
24 syn keyword  iconFunction   real remove rename repl reverse right rtod
25 syn keyword  iconFunction   runerr save seek seq set sin sort
26 syn keyword  iconFunction   sortf sqrt stop string system tab table
27 syn keyword  iconFunction   tan trim type upto variable where write writes
29 " Keywords
30 syn match iconKeyword "&allocated"
31 syn match iconKeyword "&ascii"
32 syn match iconKeyword "&clock"
33 syn match iconKeyword "&collections"
34 syn match iconKeyword "&cset"
35 syn match iconKeyword "&current"
36 syn match iconKeyword "&date"
37 syn match iconKeyword "&dateline"
38 syn match iconKeyword "&digits"
39 syn match iconKeyword "&dump"
40 syn match iconKeyword "&e"
41 syn match iconKeyword "&error"
42 syn match iconKeyword "&errornumber"
43 syn match iconKeyword "&errortext"
44 syn match iconKeyword "&errorvalue"
45 syn match iconKeyword "&errout"
46 syn match iconKeyword "&fail"
47 syn match iconKeyword "&features"
48 syn match iconKeyword "&file"
49 syn match iconKeyword "&host"
50 syn match iconKeyword "&input"
51 syn match iconKeyword "&lcase"
52 syn match iconKeyword "&letters"
53 syn match iconKeyword "&level"
54 syn match iconKeyword "&line"
55 syn match iconKeyword "&main"
56 syn match iconKeyword "&null"
57 syn match iconKeyword "&output"
58 syn match iconKeyword "&phi"
59 syn match iconKeyword "&pi"
60 syn match iconKeyword "&pos"
61 syn match iconKeyword "&progname"
62 syn match iconKeyword "&random"
63 syn match iconKeyword "&regions"
64 syn match iconKeyword "&source"
65 syn match iconKeyword "&storage"
66 syn match iconKeyword "&subject"
67 syn match iconKeyword "&time"
68 syn match iconKeyword "&trace"
69 syn match iconKeyword "&ucase"
70 syn match iconKeyword "&version"
72 " Reserved words
73 syn keyword iconReserved break by case create default do
74 syn keyword iconReserved else end every fail if
75 syn keyword iconReserved initial link next not of
76 syn keyword iconReserved procedure repeat return suspend
77 syn keyword iconReserved then to until while
79 " Storage class reserved words
80 syn keyword     iconStorageClass        global static local record
82 syn keyword     iconTodo        contained TODO FIXME XXX BUG
84 " String and Character constants
85 " Highlight special characters (those which have a backslash) differently
86 syn match iconSpecial contained "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^c[a-zA-Z0-9]\|\\$"
87 syn region      iconString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconSpecial
88 syn region      iconCset        start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconSpecial
89 syn match       iconCharacter   "'[^\\]'"
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]'"
97 "when wanted, highlight trailing white space
98 if exists("icon_space_errors")
99   syn match     iconSpaceError  "\s*$"
100   syn match     iconSpaceError  " \+\t"me=e-1
101 endif
103 "catch errors caused by wrong parenthesis
104 syn cluster     iconParenGroup contains=iconParenError,iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
106 syn region      iconParen       transparent start='(' end=')' contains=ALLBUT,@iconParenGroup
107 syn match       iconParenError  ")"
108 syn match       iconInParen     contained "[{}]"
111 syn case ignore
113 "integer number, or floating point number without a dot
114 syn match       iconNumber              "\<\d\+\>"
116 "floating point number, with dot, optional exponent
117 syn match       iconFloat               "\<\d\+\.\d*\(e[-+]\=\d\+\)\=\>"
119 "floating point number, starting with a dot, optional exponent
120 syn match       iconFloat               "\.\d\+\(e[-+]\=\d\+\)\=\>"
122 "floating point number, without dot, with exponent
123 syn match       iconFloat               "\<\d\+e[-+]\=\d\+\>"
125 "radix number
126 syn match       iconRadix               "\<\d\{1,2}[rR][a-zA-Z0-9]\+\>"
129 " syn match iconIdentifier      "\<[a-z_][a-z0-9_]*\>"
131 syn case match
133 " Comment
134 syn match       iconComment     "#.*" contains=iconTodo,iconSpaceError
136 syn region      iconPreCondit start="^\s*$\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=iconComment,iconString,iconCharacter,iconNumber,iconCommentError,iconSpaceError
138 syn region      iconIncluded    contained start=+"+ skip=+\\\\\|\\"+ end=+"+
139 syn match       iconIncluded    contained "<[^>]*>"
140 syn match       iconInclude     "^\s*$\s*include\>\s*["<]" contains=iconIncluded
141 "syn match iconLineSkip "\\$"
143 syn cluster     iconPreProcGroup contains=iconPreCondit,iconIncluded,iconInclude,iconDefine,iconInParen,iconUserLabel
145 syn region      iconDefine      start="^\s*$\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@iconPreProcGroup
147 "wt:syn region  iconPreProc "start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" "end="$" contains=ALLBUT,@iconPreProcGroup
149 " Highlight User Labels
151 " syn cluster   iconMultiGroup contains=iconIncluded,iconSpecial,iconTodo,iconUserCont,iconUserLabel,iconBitField
153 if !exists("icon_minlines")
154   let icon_minlines = 15
155 endif
156 exec "syn sync ccomment iconComment minlines=" . icon_minlines
158 " Define the default highlighting.
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
162 if 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
170   " The default methods for highlighting.  Can be overridden later
172   " HiLink iconSpecialCharacter iconSpecial
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
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
206   "HiLink iconIdentifier        Identifier
208   delcommand HiLink
209 endif
211 let b:current_syntax = "icon"