7
|
1 " Vim syntax file
|
20
|
2 " Language: IDL (Interface Description Language)
|
|
3 " Created By: Jody Goldberg <jody@gnome.org>
|
|
4 " Maintainer: Michael Geddes <michaelrgeddes@optushome.com.au>
|
|
5 " Last Change: 2004 Jul 20
|
7
|
6
|
|
7 " This is an experiment. IDL's structure is simple enough to permit a full
|
|
8 " grammar based approach to rather than using a few heuristics. The result
|
|
9 " is large and somewhat repetative but seems to work.
|
|
10
|
20
|
11 " There are some Microsoft extensions to idl files that are here. Some of
|
|
12 " them are disabled by defining idl_no_ms_extensions.
|
|
13 "
|
|
14 " The more complex of the extensions are disabled by defining idl_no_extensions.
|
|
15 "
|
|
16
|
|
17 if exists("b:current_syntax")
|
7
|
18 finish
|
|
19 endif
|
|
20
|
20
|
21 if exists("idlsyntax_showerror")
|
|
22 syn match idlError +\S+ skipwhite skipempty nextgroup=idlError
|
|
23 endif
|
|
24
|
|
25 syn region idlCppQuote start='\<cpp_quote\s*(' end=')' contains=idlString
|
|
26
|
7
|
27 " Misc basic
|
20
|
28 syn match idlId contained "[a-zA-Z][a-zA-Z0-9_]*" skipwhite skipempty nextgroup=idlEnumComma,idlEnumNumber
|
|
29 syn match idlEnumComma contained ","
|
|
30 syn match idlEnumNumber contained "=" skipwhite skipempty nextgroup=idlString,idlLiteral
|
|
31 syn match idlSemiColon contained ";"
|
|
32 syn match idlCommaArg contained "," skipempty skipwhite nextgroup=idlSimpDecl
|
|
33 syn region idlArraySize1 contained start=:\[: end=:\]: skipempty skipwhite nextgroup=idlArraySize1,idlError,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteral
|
|
34 syn match idlSimpDecl contained "[a-zA-Z][a-zA-Z0-9_]*" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlCommaArg,idlArraySize1
|
|
35 syn region idlString contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
|
|
36 syn match idlLiteral contained "[1-9]\d*\(\.\d*\)\="
|
|
37 syn match idlLiteral contained "0"
|
|
38 syn match idlLiteral contained "\.\d\+"
|
|
39 syn match idlLiteral contained "0x[0-9A-Fa-f]\+"
|
|
40 syn match idlLiteral contained "0[0-7]\+"
|
|
41 syn keyword idlLiteral contained TRUE FALSE
|
7
|
42
|
|
43 " Comments
|
20
|
44 syn keyword idlTodo contained TODO FIXME XXX
|
|
45 syn region idlComment start="/\*" end="\*/" contains=idlTodo
|
|
46 syn match idlComment "//.*" contains=idlTodo
|
|
47 syn match idlCommentError "\*/"
|
7
|
48
|
|
49 " C style Preprocessor
|
20
|
50 syn region idlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
|
|
51 syn match idlIncluded contained "<[^>]*>"
|
|
52 syn match idlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlString
|
|
53 syn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=idlComment,idlCommentError
|
|
54 syn region idlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral,idlString
|
7
|
55
|
|
56 " Constants
|
20
|
57 syn keyword idlConst const skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt
|
7
|
58
|
|
59 " Attribute
|
20
|
60 syn keyword idlROAttr readonly skipempty skipwhite nextgroup=idlAttr
|
|
61 syn keyword idlAttr attribute skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType
|
7
|
62
|
|
63 " Types
|
20
|
64 syn region idlD4 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteral
|
|
65 syn keyword idlSeqType contained sequence skipempty skipwhite nextgroup=idlD4
|
|
66 syn keyword idlBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDecl
|
|
67 syn keyword idlBaseTypeInt contained short long skipempty skipwhite nextgroup=idlSimpDecl
|
|
68 syn keyword idlBaseType contained unsigned skipempty skipwhite nextgroup=idlBaseTypeInt
|
|
69 syn region idlD1 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteral
|
|
70 syn keyword idlBaseType contained string skipempty skipwhite nextgroup=idlD1,idlSimpDecl
|
|
71 syn match idlBaseType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlSimpDecl
|
7
|
72
|
|
73 " Modules
|
20
|
74 syn region idlModuleContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModule
|
|
75 syn match idlModuleName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlModuleContent,idlError,idlSemiColon
|
|
76 syn keyword idlModule module skipempty skipwhite nextgroup=idlModuleName
|
7
|
77
|
|
78 " Interfaces
|
20
|
79 syn cluster idlCommentable contains=idlComment
|
|
80 syn cluster idlContentCluster contains=idlUnion,idlStruct,idlEnum,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlInterfaceSections
|
|
81
|
|
82 syn region idlInterfaceContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable
|
|
83 syn match idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFrom
|
|
84 syn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContent
|
|
85 syn match idlInherit contained ":" skipempty skipwhite nextgroup=idlInheritFrom
|
|
86 syn match idlInterfaceName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlError,idlSemiColon
|
|
87 syn keyword idlInterface interface dispinterface skipempty skipwhite nextgroup=idlInterfaceName
|
|
88 syn keyword idlInterfaceSections contained properties methods skipempty skipwhite nextgroup=idlSectionColon,idlError
|
|
89 syn match idlSectionColon contained ":"
|
7
|
90
|
|
91
|
20
|
92 syn match idlLibraryName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlLibraryContent,idlError,idlSemiColon
|
|
93 syn keyword idlLibrary library skipempty skipwhite nextgroup=idlLibraryName
|
|
94 syn region idlLibraryContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlCommentable,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlImportlib,idlCoclass,idlTypedef,idlInterface
|
|
95
|
|
96 syn keyword idlImportlib contained importlib skipempty skipwhite nextgroup=idlStringArg
|
|
97 syn region idlStringArg contained start="(" end=")" contains=idlString nextgroup=idlError,idlSemiColon,idlErrorBrace,idlErrorSquareBracket
|
|
98
|
|
99 syn keyword idlCoclass coclass contained skipempty skipwhite nextgroup=idlCoclassName
|
|
100 syn match idlCoclassName "[a-zA-Z0-9_]\+" contained skipempty skipwhite nextgroup=idlCoclassDefinition,idlError,idlSemiColon
|
|
101
|
|
102 syn region idlCoclassDefinition contained start="{" end="}" contains=idlCoclassAttributes,idlInterface,idlErrorBracket,idlErrorSquareBracket skipempty skipwhite nextgroup=idlError,idlSemiColon
|
|
103 syn region idlCoclassAttributes contained start=+\[+ end=+]+ skipempty skipwhite nextgroup=idlInterface contains=idlErrorBracket,idlErrorBrace,idlCoclassAttribute
|
|
104 syn keyword idlCoclassAttribute contained default source
|
|
105 "syn keyword idlInterface interface skipempty skipwhite nextgroup=idlInterfaceStubName
|
|
106
|
|
107 syn match idlImportString +"\f\+"+ skipempty skipwhite nextgroup=idlError,idlSemiColon
|
|
108 syn keyword idlImport import skipempty skipwhite nextgroup=idlImportString
|
|
109
|
|
110 syn region idlAttributes start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace,idlComment
|
|
111 syn keyword idlAttribute contained propput propget propputref id helpstring object uuid pointer_default
|
|
112 if !exists('idl_no_ms_extensions')
|
|
113 syn keyword idlAttribute contained nonextensible dual version aggregatable restricted hidden noncreatable oleautomation
|
|
114 endif
|
|
115 syn region idlAttributeParam contained start="(" end=")" contains=idlString,idlUuid,idlLiteral,idlErrorBrace,idlErrorSquareBracket
|
|
116 " skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral
|
|
117 syn match idlErrorBrace contained "}"
|
|
118 syn match idlErrorBracket contained ")"
|
|
119 syn match idlErrorSquareBracket contained "\]"
|
|
120
|
|
121 syn match idlUuid contained +[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}+
|
|
122
|
7
|
123 " Raises
|
20
|
124 syn keyword idlRaises contained raises skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon
|
7
|
125
|
|
126 " Context
|
20
|
127 syn keyword idlContext contained context skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon
|
7
|
128
|
|
129 " Operation
|
20
|
130 syn match idlParmList contained "," skipempty skipwhite nextgroup=idlOpParms
|
|
131 syn region idlArraySize contained start="\[" end="\]" skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral
|
|
132 syn match idlParmName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlParmList,idlArraySize
|
|
133 syn keyword idlParmInt contained short long skipempty skipwhite nextgroup=idlParmName
|
|
134 syn keyword idlParmType contained unsigned skipempty skipwhite nextgroup=idlParmInt
|
|
135 syn region idlD3 contained start="<" end=">" skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteral
|
|
136 syn keyword idlParmType contained string skipempty skipwhite nextgroup=idlD3,idlParmName
|
|
137 syn keyword idlParmType contained void float double char boolean octet any skipempty skipwhite nextgroup=idlParmName
|
|
138 syn match idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmName
|
|
139 syn keyword idlOpParms contained in out inout skipempty skipwhite nextgroup=idlParmType
|
|
140
|
|
141 if !exists('idl_no_ms_extensions')
|
|
142 syn keyword idlOpParms contained retval optional skipempty skipwhite nextgroup=idlParmType
|
|
143 syn match idlOpParms contained +\<\(iid_is\|defaultvalue\)\s*([^)]*)+ skipempty skipwhite nextgroup=idlParamType
|
7
|
144
|
20
|
145 syn keyword idlVariantType contained BSTR VARIANT VARIANT_BOOL long short unsigned double CURRENCY DATE
|
|
146 syn region idlSafeArray contained matchgroup=idlVariantType start=+SAFEARRAY(\s*+ end=+)+ contains=idlVariantType
|
|
147 endif
|
|
148
|
|
149 syn region idlOpContents contained start="(" end=")" skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon contains=idlOpParms,idlSafeArray,idlVariantType,@idlCommentable
|
|
150 syn match idlOpName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlOpContents
|
|
151 syn keyword idlOpInt contained short long skipempty skipwhite nextgroup=idlOpName
|
|
152 syn region idlD2 contained start="<" end=">" skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteral
|
|
153 syn keyword idlOp contained unsigned skipempty skipwhite nextgroup=idlOpInt
|
|
154 syn keyword idlOp contained string skipempty skipwhite nextgroup=idlD2,idlOpName
|
|
155 syn keyword idlOp contained void float double char boolean octet any skipempty skipwhite nextgroup=idlOpName
|
|
156 syn match idlOp contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpName
|
|
157 syn keyword idlOp contained void skipempty skipwhite nextgroup=idlOpName
|
|
158 syn keyword idlOneWayOp contained oneway skipempty skipwhite nextgroup=idOp
|
7
|
159
|
|
160 " Enum
|
20
|
161 syn region idlEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlId,idlAttributes,@idlCommentable
|
|
162 syn match idlEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlEnumContents
|
|
163 syn keyword idlEnum enum skipempty skipwhite nextgroup=idlEnumName,idlEnumContents
|
7
|
164
|
|
165 " Typedef
|
20
|
166 syn keyword idlTypedef typedef skipempty skipwhite nextgroup=idlTypedefOtherTypeQualifier,idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError
|
|
167
|
|
168 if !exists('idl_no_extensions')
|
|
169 syn keyword idlTypedefOtherTypeQualifier contained struct enum interface nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError skipwhite
|
|
170
|
|
171 syn region idlDefAttributes contained start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace skipempty skipwhite nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlError
|
|
172
|
|
173 syn keyword idlDefBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlTypedefDecl,idlError
|
|
174 syn keyword idlDefBaseTypeInt contained short long skipempty skipwhite nextgroup=idlTypedefDecl,idlError
|
|
175 syn match idlDefOtherType contained +\<\k\+\>+ skipempty nextgroup=idlTypedefDecl,idlError
|
|
176 " syn keyword idlDefSeqType contained sequence skipempty skipwhite nextgroup=idlD4
|
|
177
|
|
178 " Enum typedef
|
|
179 syn keyword idlDefEnum contained enum skipempty skipwhite nextgroup=idlDefEnumName,idlDefEnumContents
|
|
180 syn match idlDefEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlDefEnumContents,idlTypedefDecl
|
|
181 syn region idlDefEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlTypedefDecl contains=idlId,idlAttributes
|
|
182
|
|
183 syn match idlTypedefDecl contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlError,idlSemiColon
|
|
184 endif
|
7
|
185
|
|
186 " Struct
|
20
|
187 syn region idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlBaseType,idlBaseTypeInt,idlSeqType,@idlCommentable,idlEnum,idlUnion
|
|
188 syn match idlStructName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContent
|
|
189 syn keyword idlStruct struct skipempty skipwhite nextgroup=idlStructName
|
7
|
190
|
|
191 " Exception
|
20
|
192 syn keyword idlException exception skipempty skipwhite nextgroup=idlStructName
|
7
|
193
|
|
194 " Union
|
20
|
195 syn match idlColon contained ":" skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeInt
|
|
196 syn region idlCaseLabel contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlString
|
|
197 syn keyword idlCase contained case skipempty skipwhite nextgroup=idlCaseLabel
|
|
198 syn keyword idlCase contained default skipempty skipwhite nextgroup=idlColon
|
|
199 syn region idlUnionContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlCase
|
|
200 syn region idlSwitchType contained start="(" end=")" skipempty skipwhite nextgroup=idlUnionContent
|
|
201 syn keyword idlUnionSwitch contained switch skipempty skipwhite nextgroup=idlSwitchType
|
|
202 syn match idlUnionName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlUnionSwitch
|
|
203 syn keyword idlUnion union skipempty skipwhite nextgroup=idlUnionName
|
7
|
204
|
20
|
205 if !exists('idl_no_extensions')
|
|
206 syn sync match idlInterfaceSync grouphere idlInterfaceContent "\<\(disp\)\=interface\>\s\+\k\+\s*:\s*\k\+\_s*{" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable
|
|
207 syn sync maxlines=1000 minlines=100
|
|
208 else
|
|
209 syn sync lines=200
|
|
210 endif
|
|
211 " syn sync fromstart
|
|
212
|
|
213 if !exists("did_idl_syntax_inits")
|
|
214 let did_idl_syntax_inits = 1
|
|
215 " The default methods for highlighting. Can be overridden later
|
|
216 command -nargs=+ HiLink hi def link <args>
|
7
|
217
|
20
|
218 HiLink idlInclude Include
|
|
219 HiLink idlPreProc PreProc
|
|
220 HiLink idlPreCondit PreCondit
|
|
221 HiLink idlDefine Macro
|
|
222 HiLink idlIncluded String
|
|
223 HiLink idlString String
|
|
224 HiLink idlComment Comment
|
|
225 HiLink idlTodo Todo
|
|
226 HiLink idlLiteral Number
|
|
227 HiLink idlUuid Number
|
|
228 HiLink idlType Type
|
|
229 HiLink idlVariantType idlType
|
7
|
230
|
20
|
231 HiLink idlModule Keyword
|
|
232 HiLink idlInterface Keyword
|
|
233 HiLink idlEnum Keyword
|
|
234 HiLink idlStruct Keyword
|
|
235 HiLink idlUnion Keyword
|
|
236 HiLink idlTypedef Keyword
|
|
237 HiLink idlException Keyword
|
|
238 HiLink idlTypedefOtherTypeQualifier keyword
|
|
239
|
|
240 HiLink idlModuleName Typedef
|
|
241 HiLink idlInterfaceName Typedef
|
|
242 HiLink idlEnumName Typedef
|
|
243 HiLink idlStructName Typedef
|
|
244 HiLink idlUnionName Typedef
|
7
|
245
|
20
|
246 HiLink idlBaseTypeInt idlType
|
|
247 HiLink idlBaseType idlType
|
|
248 HiLink idlSeqType idlType
|
|
249 HiLink idlD1 Paren
|
|
250 HiLink idlD2 Paren
|
|
251 HiLink idlD3 Paren
|
|
252 HiLink idlD4 Paren
|
|
253 "HiLink idlArraySize Paren
|
|
254 "HiLink idlArraySize1 Paren
|
|
255 HiLink idlModuleContent Paren
|
|
256 HiLink idlUnionContent Paren
|
|
257 HiLink idlStructContent Paren
|
|
258 HiLink idlEnumContents Paren
|
|
259 HiLink idlInterfaceContent Paren
|
7
|
260
|
20
|
261 HiLink idlSimpDecl Identifier
|
|
262 HiLink idlROAttr StorageClass
|
|
263 HiLink idlAttr Keyword
|
|
264 HiLink idlConst StorageClass
|
|
265
|
|
266 HiLink idlOneWayOp StorageClass
|
|
267 HiLink idlOp idlType
|
|
268 HiLink idlParmType idlType
|
|
269 HiLink idlOpName Function
|
|
270 HiLink idlOpParms SpecialComment
|
|
271 HiLink idlParmName Identifier
|
|
272 HiLink idlInheritFrom Identifier
|
|
273 HiLink idlAttribute SpecialComment
|
7
|
274
|
20
|
275 HiLink idlId Constant
|
|
276 "HiLink idlCase Keyword
|
|
277 HiLink idlCaseLabel Constant
|
|
278
|
|
279 HiLink idlErrorBracket Error
|
|
280 HiLink idlErrorBrace Error
|
|
281 HiLink idlErrorSquareBracket Error
|
7
|
282
|
20
|
283 HiLink idlImport Keyword
|
|
284 HiLink idlImportString idlString
|
|
285 HiLink idlCoclassAttribute StorageClass
|
|
286 HiLink idlLibrary Keyword
|
|
287 HiLink idlImportlib Keyword
|
|
288 HiLink idlCoclass Keyword
|
|
289 HiLink idlLibraryName Typedef
|
|
290 HiLink idlCoclassName Typedef
|
|
291 " hi idlLibraryContent guifg=red
|
|
292 HiLink idlTypedefDecl Typedef
|
|
293 HiLink idlDefEnum Keyword
|
|
294 HiLink idlDefv1Enum Keyword
|
|
295 HiLink idlDefEnumName Typedef
|
|
296 HiLink idlDefEnumContents Paren
|
|
297 HiLink idlDefBaseTypeInt idlType
|
|
298 HiLink idlDefBaseType idlType
|
|
299 HiLink idlDefSeqType idlType
|
|
300 HiLink idlInterfaceSections Label
|
7
|
301
|
20
|
302 if exists("idlsyntax_showerror")
|
|
303 if exists("idlsyntax_showerror_soft")
|
|
304 hi default idlError guibg=#d0ffd0
|
|
305 else
|
|
306 HiLink idlError Error
|
|
307 endif
|
|
308 endif
|
7
|
309 delcommand HiLink
|
|
310 endif
|
|
311
|
|
312 let b:current_syntax = "idl"
|
|
313
|
20
|
314 " vim: sw=2 et
|