blob: 79585bebc6afee1f54dbd47b845ba3712c808acd [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: MS IDL (Microsoft dialect of Interface Description Language)
3" Maintainer: Vadim Zeitlin <vadim@wxwindows.org>
Bram Moolenaar5dc62522012-02-13 00:05:22 +01004" Last Change: 2012 Feb 12 by Thilo Six
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9 syntax clear
10elseif exists("b:current_syntax")
11 finish
12endif
13
Bram Moolenaar5dc62522012-02-13 00:05:22 +010014let s:cpo_save = &cpo
15set cpo&vim
16
Bram Moolenaar071d4272004-06-13 20:20:40 +000017" Misc basic
18syn match msidlId "[a-zA-Z][a-zA-Z0-9_]*"
19syn match msidlUUID "{\?[[:xdigit:]]\{8}-\([[:xdigit:]]\{4}-\)\{3}[[:xdigit:]]\{12}}\?"
20syn region msidlString start=/"/ skip=/\\\(\\\\\)*"/ end=/"/
21syn match msidlLiteral "\d\+\(\.\d*\)\="
22syn match msidlLiteral "\.\d\+"
23syn match msidlSpecial contained "[]\[{}:]"
24
25" Comments
26syn keyword msidlTodo contained TODO FIXME XXX
27syn region msidlComment start="/\*" end="\*/" contains=msidlTodo
28syn match msidlComment "//.*" contains=msidlTodo
29syn match msidlCommentError "\*/"
30
31" C style Preprocessor
32syn region msidlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
33syn match msidlIncluded contained "<[^>]*>"
34syn match msidlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=msidlIncluded,msidlString
35syn region msidlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=msidlComment,msidlCommentError
36syn region msidlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=msidlLiteral, msidlString
37
38" Attributes
39syn keyword msidlAttribute contained in out propget propput propputref retval
40syn keyword msidlAttribute contained aggregatable appobject binadable coclass control custom default defaultbind defaultcollelem defaultvalue defaultvtable dispinterface displaybind dual entry helpcontext helpfile helpstring helpstringdll hidden id immediatebind lcid library licensed nonbrowsable noncreatable nonextensible oleautomation optional object public readonly requestedit restricted source string uidefault usesgetlasterror vararg version
41syn match msidlAttribute /uuid(.*)/he=s+4 contains=msidlUUID
42syn match msidlAttribute /helpstring(.*)/he=s+10 contains=msidlString
43syn region msidlAttributes start="\[" end="]" keepend contains=msidlSpecial,msidlString,msidlAttribute,msidlComment,msidlCommentError
44
45" Keywords
46syn keyword msidlEnum enum
47syn keyword msidlImport import importlib
48syn keyword msidlStruct interface library coclass
49syn keyword msidlTypedef typedef
50
51" Types
52syn keyword msidlStandardType byte char double float hyper int long short void wchar_t
53syn keyword msidlStandardType BOOL BSTR HRESULT VARIANT VARIANT_BOOL
54syn region msidlSafeArray start="SAFEARRAY(" end=")" contains=msidlStandardType
55
56syn sync lines=50
57
58" Define the default highlighting.
59" For version 5.7 and earlier: only when not done already
60" For version 5.8 and later: only when an item doesn't have highlighting yet
61if version >= 508 || !exists("did_msidl_syntax_inits")
62 if version < 508
63 let did_msidl_syntax_inits = 1
64 command -nargs=+ HiLink hi link <args>
65 else
66 command -nargs=+ HiLink hi def link <args>
67 endif
68
69 HiLink msidlInclude Include
70 HiLink msidlPreProc PreProc
71 HiLink msidlPreCondit PreCondit
72 HiLink msidlDefine Macro
73 HiLink msidlIncluded String
74 HiLink msidlString String
75 HiLink msidlComment Comment
76 HiLink msidlTodo Todo
77 HiLink msidlSpecial SpecialChar
78 HiLink msidlLiteral Number
79 HiLink msidlUUID Number
80
81 HiLink msidlImport Include
82 HiLink msidlEnum StorageClass
83 HiLink msidlStruct Structure
84 HiLink msidlTypedef Typedef
85 HiLink msidlAttribute StorageClass
86
87 HiLink msidlStandardType Type
88 HiLink msidlSafeArray Type
89
90 delcommand HiLink
91endif
92
93let b:current_syntax = "msidl"
94
Bram Moolenaar5dc62522012-02-13 00:05:22 +010095let &cpo = s:cpo_save
96unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +000097" vi: set ts=8 sw=4: