319 lines · 18.6 KB · Text
RawDownload
" Vim syntax file" Language:    IDL (Interface Description Language)" Created By:  Jody Goldberg" Maintainer:  Michael Geddes <vim@frog.wheelycreek.net>" Last Change:  Thu Apr 13 2006  " This is an experiment.  IDL's structure is simple enough to permit a full" grammar based approach to rather than using a few heuristics.  The result" is large and somewhat repetative but seems to work. " There are some Microsoft extensions to idl files that are here.  Some of" them are disabled by defining idl_no_ms_extensions."" The more complex of the extensions are disabled by defining idl_no_extensions."" History:" 2.0: Michael's new version" 2.1: Support for Vim 7 spell (Anduin Withers)"       if exists("b:current_syntax")  finishendif if exists("idlsyntax_showerror")  syn match idlError +\S+ skipwhite skipempty nextgroup=idlErrorendif syn region idlCppQuote start='\<cpp_quote\s*(' end=')' contains=idlString " Misc basicsyn match   idlId          contained "[a-zA-Z][a-zA-Z0-9_]*" skipwhite skipempty nextgroup=idlEnumComma,idlEnumNumbersyn match   idlEnumComma   contained ","syn match   idlEnumNumber  contained "=" skipwhite skipempty nextgroup=idlString,idlLiteralsyn match   idlSemiColon   contained ";"syn match   idlCommaArg    contained ","                      skipempty skipwhite nextgroup=idlSimpDeclsyn region  idlArraySize1  contained start=:\[: end=:\]:      skipempty skipwhite nextgroup=idlArraySize1,idlError,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteralsyn match   idlSimpDecl    contained "[a-zA-Z][a-zA-Z0-9_]*"  skipempty skipwhite nextgroup=idlError,idlSemiColon,idlCommaArg,idlArraySize1syn region  idlString      contained start=+"+  skip=+\\\(\\\\\)*"+  end=+"+ contains=@Spellsyn match   idlLiteral     contained "[1-9]\d*\(\.\d*\)\="syn match   idlLiteral     contained "0"syn match   idlLiteral     contained "\.\d\+"syn match   idlLiteral     contained "0x[0-9A-Fa-f]\+"syn match   idlLiteral     contained "0[0-7]\+"syn keyword idlLiteral     contained TRUE FALSE " Commentssyn keyword idlTodo        contained TODO FIXME XXXsyn region idlComment      start="/\*"  end="\*/" contains=idlTodo,@Spellsyn match  idlComment      "//.*" contains=idlTodo,@Spellsyn match  idlCommentError "\*/" " C style Preprocessorsyn region idlIncluded    contained start=+"+  skip=+\\\(\\\\\)*"+  end=+"+syn match  idlIncluded    contained "<[^>]*>"syn match  idlInclude     "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlStringsyn region idlPreCondit   start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)"  skip="\\$"  end="$" contains=idlComment,idlCommentErrorsyn region idlDefine      start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral,idlString " Constantssyn keyword idlConst    const                             skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt " Attributesyn keyword idlROAttr   readonly                          skipempty skipwhite nextgroup=idlAttrsyn keyword idlAttr     attribute                         skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType " Typessyn region  idlD4          contained start="<" end=">"    skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteralsyn keyword idlSeqType     contained sequence             skipempty skipwhite nextgroup=idlD4syn keyword idlBaseType    contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDeclsyn keyword idlBaseTypeInt contained short long           skipempty skipwhite nextgroup=idlSimpDeclsyn keyword idlBaseType    contained unsigned             skipempty skipwhite nextgroup=idlBaseTypeIntsyn region  idlD1          contained start="<" end=">"    skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteralsyn keyword idlBaseType    contained string               skipempty skipwhite nextgroup=idlD1,idlSimpDeclsyn match   idlBaseType    contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*"  skipempty skipwhite nextgroup=idlSimpDecl " Modulessyn region  idlModuleContent contained start="{" end="}"  skipempty skipwhite nextgroup=idlError,idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModulesyn match   idlModuleName  contained "[a-zA-Z0-9_]\+"     skipempty skipwhite nextgroup=idlModuleContent,idlError,idlSemiColonsyn keyword idlModule      module                         skipempty skipwhite nextgroup=idlModuleName " Interfacessyn cluster idlCommentable contains=idlCommentsyn cluster idlContentCluster contains=idlUnion,idlStruct,idlEnum,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlInterfaceSections syn region  idlInterfaceContent contained start="{" end="}"   skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentablesyn match   idlInheritFrom2 contained ","                     skipempty skipwhite nextgroup=idlInheritFromsyn match   idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContentsyn match   idlInherit contained ":"                            skipempty skipwhite nextgroup=idlInheritFromsyn match   idlInterfaceName contained "[a-zA-Z0-9_]\+"       skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlError,idlSemiColonsyn keyword idlInterface     interface dispinterface          skipempty skipwhite nextgroup=idlInterfaceNamesyn keyword idlInterfaceSections contained properties methods skipempty skipwhite nextgroup=idlSectionColon,idlErrorsyn match   idlSectionColon contained ":"  syn match   idlLibraryName  contained  "[a-zA-Z0-9_]\+"       skipempty skipwhite nextgroup=idlLibraryContent,idlError,idlSemiColonsyn keyword idlLibrary      library                           skipempty skipwhite nextgroup=idlLibraryNamesyn region  idlLibraryContent contained start="{" end="}"     skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlCommentable,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlImportlib,idlCoclass,idlTypedef,idlInterface syn keyword idlImportlib contained importlib                  skipempty skipwhite nextgroup=idlStringArgsyn region idlStringArg contained start="(" end=")"           contains=idlString nextgroup=idlError,idlSemiColon,idlErrorBrace,idlErrorSquareBracket syn keyword idlCoclass coclass contained                      skipempty skipwhite nextgroup=idlCoclassNamesyn match   idlCoclassName "[a-zA-Z0-9_]\+" contained         skipempty skipwhite nextgroup=idlCoclassDefinition,idlError,idlSemiColon syn region idlCoclassDefinition contained start="{" end="}"   contains=idlCoclassAttributes,idlInterface,idlErrorBracket,idlErrorSquareBracket skipempty skipwhite nextgroup=idlError,idlSemiColonsyn region idlCoclassAttributes contained start=+\[+ end=+]+  skipempty skipwhite nextgroup=idlInterface contains=idlErrorBracket,idlErrorBrace,idlCoclassAttributesyn keyword idlCoclassAttribute contained default source"syn keyword idlInterface       interface                      skipempty skipwhite nextgroup=idlInterfaceStubName syn match idlImportString       +"\f\+"+                      skipempty skipwhite nextgroup=idlError,idlSemiColonsyn keyword idlImport           import                        skipempty skipwhite nextgroup=idlImportString syn region  idlAttributes start="\[" end="\]"                 contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace,idlCommentsyn keyword idlAttribute contained propput propget propputref id helpstring object uuid pointer_defaultif !exists('idl_no_ms_extensions')syn keyword idlAttribute contained nonextensible dual version aggregatable restricted hidden noncreatable oleautomationendifsyn region idlAttributeParam contained start="(" end=")"      contains=idlString,idlUuid,idlLiteral,idlErrorBrace,idlErrorSquareBracket" skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteralsyn match idlErrorBrace contained "}"syn match idlErrorBracket contained ")"syn match idlErrorSquareBracket contained "\]" syn match idlUuid         contained +[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}+ " Raisessyn keyword idlRaises     contained raises               skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon " Contextsyn keyword idlContext    contained context              skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon " Operationsyn match   idlParmList   contained ","                  skipempty skipwhite nextgroup=idlOpParmssyn region  idlArraySize  contained start="\[" end="\]"  skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteralsyn match   idlParmName   contained "[a-zA-Z0-9_]\+"     skipempty skipwhite nextgroup=idlParmList,idlArraySizesyn keyword idlParmInt    contained short long           skipempty skipwhite nextgroup=idlParmNamesyn keyword idlParmType   contained unsigned             skipempty skipwhite nextgroup=idlParmIntsyn region  idlD3         contained start="<" end=">"    skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteralsyn keyword idlParmType   contained string               skipempty skipwhite nextgroup=idlD3,idlParmNamesyn keyword idlParmType   contained void float double char boolean octet any    skipempty skipwhite nextgroup=idlParmNamesyn match   idlParmType   contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmNamesyn keyword idlOpParms    contained in out inout         skipempty skipwhite nextgroup=idlParmType if !exists('idl_no_ms_extensions')syn keyword idlOpParms    contained retval optional      skipempty skipwhite nextgroup=idlParmType  syn match idlOpParms contained +\<\(iid_is\|defaultvalue\)\s*([^)]*)+ skipempty skipwhite nextgroup=idlParamType   syn keyword idlVariantType  contained BSTR VARIANT VARIANT_BOOL long short unsigned double CURRENCY DATE  syn region idlSafeArray contained matchgroup=idlVariantType start=+SAFEARRAY(\s*+ end=+)+ contains=idlVariantTypeendif syn region  idlOpContents contained start="(" end=")"    skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon contains=idlOpParms,idlSafeArray,idlVariantType,@idlCommentablesyn match   idlOpName   contained "[a-zA-Z0-9_]\+"       skipempty skipwhite nextgroup=idlOpContentssyn keyword idlOpInt    contained short long             skipempty skipwhite nextgroup=idlOpNamesyn region  idlD2       contained start="<" end=">"      skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteralsyn keyword idlOp       contained unsigned               skipempty skipwhite nextgroup=idlOpIntsyn keyword idlOp       contained string                 skipempty skipwhite nextgroup=idlD2,idlOpNamesyn keyword idlOp       contained void float double char boolean octet any  skipempty skipwhite nextgroup=idlOpNamesyn match   idlOp       contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpNamesyn keyword idlOp       contained void                   skipempty skipwhite nextgroup=idlOpNamesyn keyword idlOneWayOp contained oneway                 skipempty skipwhite nextgroup=idOp " Enumsyn region  idlEnumContents contained start="{" end="}"  skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlId,idlAttributes,@idlCommentablesyn match   idlEnumName contained "[a-zA-Z0-9_]\+"       skipempty skipwhite nextgroup=idlEnumContentssyn keyword idlEnum     enum                             skipempty skipwhite nextgroup=idlEnumName,idlEnumContents " Typedefsyn keyword idlTypedef typedef                          skipempty skipwhite nextgroup=idlTypedefOtherTypeQualifier,idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError if !exists('idl_no_extensions')  syn keyword idlTypedefOtherTypeQualifier contained struct enum interface nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError skipwhite   syn region  idlDefAttributes        contained start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace skipempty skipwhite nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlError   syn keyword idlDefBaseType      contained float double char boolean octet any  skipempty skipwhite nextgroup=idlTypedefDecl,idlError  syn keyword idlDefBaseTypeInt   contained short long                           skipempty skipwhite nextgroup=idlTypedefDecl,idlError  syn match idlDefOtherType       contained +\<\k\+\>+ skipempty                 nextgroup=idlTypedefDecl,idlError  " syn keyword idlDefSeqType     contained sequence                             skipempty skipwhite nextgroup=idlD4   " Enum typedef  syn keyword idlDefEnum          contained enum skipempty                       skipwhite nextgroup=idlDefEnumName,idlDefEnumContents  syn match   idlDefEnumName      contained "[a-zA-Z0-9_]\+"                     skipempty skipwhite nextgroup=idlDefEnumContents,idlTypedefDecl  syn region  idlDefEnumContents  contained start="{" end="}"                    skipempty skipwhite nextgroup=idlError,idlTypedefDecl contains=idlId,idlAttributes   syn match   idlTypedefDecl      contained "[a-zA-Z0-9_]\+"                     skipempty skipwhite nextgroup=idlError,idlSemiColonendif " Structsyn region  idlStructContent   contained start="{" end="}"   skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlBaseType,idlBaseTypeInt,idlSeqType,@idlCommentable,idlEnum,idlUnionsyn match   idlStructName      contained "[a-zA-Z0-9_]\+"    skipempty skipwhite nextgroup=idlStructContentsyn keyword idlStruct          struct                        skipempty skipwhite nextgroup=idlStructName " Exceptionsyn keyword idlException       exception                     skipempty skipwhite nextgroup=idlStructName " Unionsyn match   idlColon            contained ":"                skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeIntsyn region  idlCaseLabel        contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlStringsyn keyword idlCase             contained case               skipempty skipwhite nextgroup=idlCaseLabelsyn keyword idlCase             contained default            skipempty skipwhite nextgroup=idlColonsyn region  idlUnionContent     contained start="{" end="}"  skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlCasesyn region  idlSwitchType       contained start="(" end=")"  skipempty skipwhite nextgroup=idlUnionContentsyn keyword idlUnionSwitch      contained switch             skipempty skipwhite nextgroup=idlSwitchTypesyn match   idlUnionName        contained "[a-zA-Z0-9_]\+"   skipempty skipwhite nextgroup=idlUnionSwitchsyn keyword idlUnion            union                        skipempty skipwhite nextgroup=idlUnionName if !exists('idl_no_extensions')  syn sync match  idlInterfaceSync grouphere idlInterfaceContent "\<\(disp\)\=interface\>\s\+\k\+\s*:\s*\k\+\_s*{" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable  syn sync maxlines=1000 minlines=100else  syn sync lines=200endif" syn sync fromstart if !exists("did_idl_syntax_inits")  let did_idl_syntax_inits = 1  " The default methods for highlighting.  Can be overridden later  command -nargs=+ HiLink hi def link <args>   HiLink idlInclude             Include  HiLink idlPreProc             PreProc  HiLink idlPreCondit           PreCondit  HiLink idlDefine              Macro  HiLink idlIncluded            String  HiLink idlString              String  HiLink idlComment             Comment  HiLink idlTodo                Todo  HiLink idlLiteral             Number  HiLink idlUuid                Number  HiLink idlType                Type  HiLink idlVariantType         idlType   HiLink idlModule              Keyword  HiLink idlInterface           Keyword  HiLink idlEnum                Keyword  HiLink idlStruct              Keyword  HiLink idlUnion               Keyword  HiLink idlTypedef             Keyword  HiLink idlException           Keyword  HiLink idlTypedefOtherTypeQualifier keyword   HiLink idlModuleName          Typedef  HiLink idlInterfaceName       Typedef  HiLink idlEnumName            Typedef  HiLink idlStructName          Typedef  HiLink idlUnionName           Typedef   HiLink idlBaseTypeInt         idlType  HiLink idlBaseType            idlType  HiLink idlSeqType             idlType  HiLink idlD1                  Paren  HiLink idlD2                  Paren  HiLink idlD3                  Paren  HiLink idlD4                  Paren  "HiLink idlArraySize          Paren  "HiLink idlArraySize1         Paren  HiLink idlModuleContent       Paren  HiLink idlUnionContent        Paren  HiLink idlStructContent       Paren  HiLink idlEnumContents        Paren  HiLink idlInterfaceContent    Paren   HiLink idlSimpDecl            Identifier  HiLink idlROAttr              StorageClass  HiLink idlAttr                Keyword  HiLink idlConst               StorageClass   HiLink idlOneWayOp            StorageClass  HiLink idlOp                  idlType  HiLink idlParmType            idlType  HiLink idlOpName              Function  HiLink idlOpParms             SpecialComment  HiLink idlParmName            Identifier  HiLink idlInheritFrom         Identifier  HiLink idlAttribute           SpecialComment   HiLink idlId                  Constant  "HiLink idlCase               Keyword  HiLink idlCaseLabel           Constant   HiLink idlErrorBracket        Error  HiLink idlErrorBrace          Error  HiLink idlErrorSquareBracket  Error   HiLink idlImport              Keyword  HiLink idlImportString        idlString  HiLink idlCoclassAttribute    StorageClass  HiLink idlLibrary             Keyword  HiLink idlImportlib           Keyword  HiLink idlCoclass             Keyword  HiLink idlLibraryName         Typedef  HiLink idlCoclassName         Typedef  " hi idlLibraryContent guifg=red  HiLink idlTypedefDecl         Typedef  HiLink idlDefEnum             Keyword  HiLink idlDefv1Enum           Keyword  HiLink idlDefEnumName         Typedef  HiLink idlDefEnumContents     Paren  HiLink idlDefBaseTypeInt      idlType  HiLink idlDefBaseType         idlType  HiLink idlDefSeqType          idlType  HiLink idlInterfaceSections   Label   if exists("idlsyntax_showerror")    if exists("idlsyntax_showerror_soft")      hi default idlError guibg=#d0ffd0    else      HiLink idlError Error    endif  endif  delcommand HiLinkendif let b:current_syntax = "idl" " vim: sw=2 et