Start anew
[msysgit.git] / share / vim / vim58 / syntax / idl.vim
blob84cf08b59dd8dbe32d94ab48ca9b24fdf5ea89c6
1 " Vim syntax file
2 " Language:     IDL (Interface Description Language)
3 " Maintainer:   Jody Goldberg <jgoldberg@home.com>
4 " Last Change:  2001 May 09
6 " This is an experiment.  IDL's structure is simple enough to permit a full
7 " grammar based approach to rather than using a few heuristics.  The result
8 " is large and somewhat repetative but seems to work.
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
12 if version < 600
13   syntax clear
14 elseif exists("b:current_syntax")
15   finish
16 endif
18 " Misc basic
19 syn match       idlId           contained "[a-zA-Z][a-zA-Z0-9_]*"
20 syn match       idlSemiColon    contained ";"
21 syn match       idlCommaArg     contained ","                   skipempty skipwhite nextgroup=idlSimpDecl
22 syn region      idlArraySize1   contained start=:\[: end=:\]:   skipempty skipwhite nextgroup=idlArraySize1,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteral
23 syn match   idlSimpDecl  contained "[a-zA-Z][a-zA-Z0-9_]*"      skipempty skipwhite nextgroup=idlSemiColon,idlCommaArg,idlArraySize1
24 syn region  idlSting     contained start=+"+  skip=+\\\(\\\\\)*"+  end=+"+
25 syn match   idlLiteral   contained "[1-9]\d*\(\.\d*\)\="
26 syn match   idlLiteral   contained "\.\d\+"
27 syn keyword idlLiteral   contained TRUE FALSE
29 " Comments
30 syn keyword idlTodo contained   TODO FIXME XXX
31 syn region idlComment           start="/\*"  end="\*/" contains=idlTodo
32 syn match  idlComment           "//.*" contains=idlTodo
33 syn match  idlCommentError      "\*/"
35 " C style Preprocessor
36 syn region idlIncluded contained start=+"+  skip=+\\\(\\\\\)*"+  end=+"+
37 syn match  idlIncluded contained "<[^>]*>"
38 syn match  idlInclude           "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlString
39 syn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)"  skip="\\$"  end="$" contains=idlComment,idlCommentError
40 syn region idlDefine    start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral, idlString
42 " Constants
43 syn keyword idlConst    const   skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt
45 " Attribute
46 syn keyword idlROAttr   readonly        skipempty skipwhite nextgroup=idlAttr
47 syn keyword idlAttr     attribute       skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType
49 " Types
50 syn region  idlD4       contained start="<" end=">"     skipempty skipwhite nextgroup=idlSimpDecl       contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteral
51 syn keyword idlSeqType  contained sequence              skipempty skipwhite nextgroup=idlD4
52 syn keyword idlBaseType         contained       float double char boolean octet any     skipempty skipwhite nextgroup=idlSimpDecl
53 syn keyword idlBaseTypeInt      contained       short long              skipempty skipwhite nextgroup=idlSimpDecl
54 syn keyword idlBaseType         contained       unsigned                skipempty skipwhite nextgroup=idlBaseTypeInt
55 syn region  idlD1               contained       start="<" end=">"       skipempty skipwhite nextgroup=idlSimpDecl       contains=idlString,idlLiteral
56 syn keyword idlBaseType         contained       string  skipempty skipwhite nextgroup=idlD1,idlSimpDecl
57 syn match   idlBaseType         contained       "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*"       skipempty skipwhite nextgroup=idlSimpDecl
59 " Modules
60 syn region  idlModuleContent contained start="{" end="}"        skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModule
61 syn match   idlModuleName contained     "[a-zA-Z0-9_]\+"        skipempty skipwhite nextgroup=idlModuleContent,idlSemiColon
62 syn keyword idlModule                   module                  skipempty skipwhite nextgroup=idlModuleName
64 " Interfaces
65 syn region  idlInterfaceContent contained start="{" end="}"     skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlComment,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef
66 syn match   idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFrom
67 syn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContent
68 syn match idlInherit contained  ":"             skipempty skipwhite nextgroup=idlInheritFrom
69 syn match   idlInterfaceName contained  "[a-zA-Z0-9_]\+"        skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlSemiColon
70 syn keyword idlInterface                interface               skipempty skipwhite nextgroup=idlInterfaceName
73 " Raises
74 syn keyword idlRaises   contained raises        skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon
76 " Context
77 syn keyword idlContext  contained context       skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon
79 " Operation
80 syn match   idlParmList contained "," skipempty skipwhite nextgroup=idlOpParms
81 syn region  idlArraySize contained start="\[" end="\]"  skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral
82 syn match   idlParmName contained "[a-zA-Z0-9_]\+"      skipempty skipwhite nextgroup=idlParmList,idlArraySize
83 syn keyword idlParmInt  contained short long            skipempty skipwhite nextgroup=idlParmName
84 syn keyword idlParmType contained unsigned              skipempty skipwhite nextgroup=idlParmInt
85 syn region  idlD3       contained start="<" end=">"     skipempty skipwhite nextgroup=idlParmName       contains=idlString,idlLiteral
86 syn keyword idlParmType contained string                skipempty skipwhite nextgroup=idlD3,idlParmName
87 syn keyword idlParmType contained void float double char boolean octet any        skipempty skipwhite nextgroup=idlParmName
88 syn match   idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmName
89 syn keyword idlOpParms  contained in out inout          skipempty skipwhite nextgroup=idlParmType
91 syn region idlOpContents contained start="(" end=")"    skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon contains=idlOpParms
92 syn match   idlOpName   contained "[a-zA-Z0-9_]\+"      skipempty skipwhite nextgroup=idlOpContents
93 syn keyword idlOpInt    contained short long            skipempty skipwhite nextgroup=idlOpName
94 syn region  idlD2       contained start="<" end=">"     skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteral
95 syn keyword idlOp       contained unsigned              skipempty skipwhite nextgroup=idlOpInt
96 syn keyword idlOp       contained string                skipempty skipwhite nextgroup=idlD2,idlOpName
97 syn keyword idlOp       contained void float double char boolean octet any              skipempty skipwhite nextgroup=idlOpName
98 syn match   idlOp       contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*"     skipempty skipwhite nextgroup=idlOpName
99 syn keyword idlOp       contained void                  skipempty skipwhite nextgroup=idlOpName
100 syn keyword idlOneWayOp contained oneway                skipempty skipwhite nextgroup=idOp
102 " Enum
103 syn region  idlEnumContents contained start="{" end="}"         skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlId,idlComment
104 syn match   idlEnumName contained       "[a-zA-Z0-9_]\+"        skipempty skipwhite nextgroup=idlEnumContents
105 syn keyword idlEnum                     enum                    skipempty skipwhite nextgroup=idlEnumName
107 " Typedef
108 syn keyword idlTypedef                  typedef                 skipempty skipwhite nextgroup=idlBaseType, idlBaseTypeInt, idlSeqType
110 " Struct
111 syn region  idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl        contains=idlBaseType, idlBaseTypeInt, idlSeqType,idlComment, idlEnum, idlUnion
112 syn match   idlStructName contained     "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContent
113 syn keyword idlStruct                   struct           skipempty skipwhite nextgroup=idlStructName
115 " Exception
116 syn keyword idlException exception skipempty skipwhite nextgroup=idlStructName
118 " Union
119 syn match   idlColon contained ":"      skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeInt
120 syn region  idlCaseLabel contained start="" skip="::" end=":"me=e-1     skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlString
121 syn keyword idlCase             contained case                          skipempty skipwhite nextgroup=idlCaseLabel
122 syn keyword idlCase             contained default                       skipempty skipwhite nextgroup=idlColon
123 syn region  idlUnionContent     contained start="{" end="}"             skipempty skipwhite nextgroup=idlSemiColon,idlSimpDecl  contains=idlCase
124 syn region  idlSwitchType       contained start="(" end=")"             skipempty skipwhite nextgroup=idlUnionContent
125 syn keyword idlUnionSwitch      contained switch                        skipempty skipwhite nextgroup=idlSwitchType
126 syn match   idlUnionName        contained "[a-zA-Z0-9_]\+"              skipempty skipwhite nextgroup=idlUnionSwitch
127 syn keyword idlUnion            union                           skipempty skipwhite nextgroup=idlUnionName
129 syn sync lines=200
131 " Define the default highlighting.
132 " For version 5.7 and earlier: only when not done already
133 " For version 5.8 and later: only when an item doesn't have highlighting yet
134 if version >= 508 || !exists("did_idl_syntax_inits")
135   if version < 508
136     let did_idl_syntax_inits = 1
137     command -nargs=+ HiLink hi link <args>
138   else
139     command -nargs=+ HiLink hi def link <args>
140   endif
142   HiLink idlInclude             Include
143   HiLink idlPreProc             PreProc
144   HiLink idlPreCondit           PreCondit
145   HiLink idlDefine              Macro
146   HiLink idlIncluded            String
147   HiLink idlString              String
148   HiLink idlComment             Comment
149   HiLink idlTodo                Todo
150   HiLink idlLiteral             Number
152   HiLink idlModule              Keyword
153   HiLink idlInterface           Keyword
154   HiLink idlEnum                Keyword
155   HiLink idlStruct              Keyword
156   HiLink idlUnion               Keyword
157   HiLink idlTypedef             Keyword
158   HiLink idlException           Keyword
160   HiLink idlModuleName          Typedef
161   HiLink idlInterfaceName       Typedef
162   HiLink idlEnumName            Typedef
163   HiLink idlStructName          Typedef
164   HiLink idlUnionName           Typedef
166   HiLink idlBaseTypeInt         idlType
167   HiLink idlBaseType            idlType
168   HiLink idlSeqType             idlType
169   HiLink idlD1                  Paren
170   HiLink idlD2                  Paren
171   HiLink idlD3                  Paren
172   HiLink idlD4                  Paren
173   "HiLink idlArraySize          Paren
174   "HiLink idlArraySize1         Paren
175   HiLink idlModuleContent       Paren
176   HiLink idlUnionContent        Paren
177   HiLink idlStructContent       Paren
178   HiLink idlEnumContents        Paren
179   HiLink idlInterfaceContent    Paren
181   HiLink idlSimpDecl            Identifier
182   HiLink idlROAttr              StorageClass
183   HiLink idlAttr                Keyword
184   HiLink idlConst               StorageClass
186   HiLink idlOneWayOp            StorageClass
187   HiLink idlOp                  idlType
188   HiLink idlParmType            idlType
189   HiLink idlOpName              Function
190   HiLink idlOpParms             StorageClass
191   HiLink idlParmName            Identifier
192   HiLink idlInheritFrom         Identifier
194   HiLink idlId                  Constant
195   "HiLink idlCase               Keyword
196   HiLink idlCaseLabel           Constant
198   delcommand HiLink
199 endif
201 let b:current_syntax = "idl"
203 " vim: ts=8