1" Vim syntax file 2" Language: UnrealScript 3" Maintainer: Mark Ferrell <[email protected]> 4" URL: ftp://ftp.chaoticdreams.org/pub/ut/vim/uc.vim 5" Credits: Based on the java.vim syntax file by Claudio Fleiner 6" Last change: 2003 May 31 7 8" Please check :help uc.vim for comments on some of the options available. 9 10" quit when a syntax file was already loaded 11if exists("b:current_syntax") 12 finish 13endif 14 15" some characters that cannot be in a UnrealScript program (outside a string) 16syn match ucError "[\\@`]" 17syn match ucError "<<<\|\.\.\|=>\|<>\|||=\|&&=\|[^-]->\|\*\/" 18 19" we define it here so that included files can test for it 20if !exists("main_syntax") 21 let main_syntax='uc' 22endif 23 24syntax case ignore 25 26" keyword definitions 27syn keyword ucBranch break continue 28syn keyword ucConditional if else switch 29syn keyword ucRepeat while for do foreach 30syn keyword ucBoolean true false 31syn keyword ucConstant null 32syn keyword ucOperator new instanceof 33syn keyword ucType boolean char byte short int long float double 34syn keyword ucType void Pawn sound state auto exec function ipaddr 35syn keyword ucType ELightType actor ammo defaultproperties bool 36syn keyword ucType native noexport var out vector name local string 37syn keyword ucType event 38syn keyword ucStatement return 39syn keyword ucStorageClass static synchronized transient volatile final 40syn keyword ucMethodDecl synchronized throws 41 42" UnrealScript defines classes in sorta fscked up fashion 43syn match ucClassDecl "^[Cc]lass[\s$]*\S*[\s$]*expands[\s$]*\S*;" contains=ucSpecial,ucSpecialChar,ucClassKeys 44syn keyword ucClassKeys class expands extends 45syn match ucExternal "^\#exec.*" contains=ucCommentString,ucNumber 46syn keyword ucScopeDecl public protected private abstract 47 48" UnrealScript Functions 49syn match ucFuncDef "^.*function\s*[\(]*" contains=ucType,ucStorageClass 50syn match ucEventDef "^.*event\s*[\(]*" contains=ucType,ucStorageClass 51syn match ucClassLabel "[a-zA-Z0-9]*\'[a-zA-Z0-9]*\'" contains=ucCharacter 52 53syn region ucLabelRegion transparent matchgroup=ucLabel start="\<case\>" matchgroup=NONE end=":" contains=ucNumber 54syn match ucUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=ucLabel 55syn keyword ucLabel default 56 57" The following cluster contains all java groups except the contained ones 58syn cluster ucTop contains=ucExternal,ucError,ucError,ucBranch,ucLabelRegion,ucLabel,ucConditional,ucRepeat,ucBoolean,ucConstant,ucTypedef,ucOperator,ucType,ucType,ucStatement,ucStorageClass,ucMethodDecl,ucClassDecl,ucClassDecl,ucClassDecl,ucScopeDecl,ucError,ucError2,ucUserLabel,ucClassLabel 59 60" Comments 61syn keyword ucTodo contained TODO FIXME XXX 62syn region ucCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=ucSpecial,ucCommentStar,ucSpecialChar 63syn region ucComment2String contained start=+"+ end=+$\|"+ contains=ucSpecial,ucSpecialChar 64syn match ucCommentCharacter contained "'\\[^']\{1,6\}'" contains=ucSpecialChar 65syn match ucCommentCharacter contained "'\\''" contains=ucSpecialChar 66syn match ucCommentCharacter contained "'[^\\]'" 67syn region ucComment start="/\*" end="\*/" contains=ucCommentString,ucCommentCharacter,ucNumber,ucTodo 68syn match ucCommentStar contained "^\s*\*[^/]"me=e-1 69syn match ucCommentStar contained "^\s*\*$" 70syn match ucLineComment "//.*" contains=ucComment2String,ucCommentCharacter,ucNumber,ucTodo 71hi link ucCommentString ucString 72hi link ucComment2String ucString 73hi link ucCommentCharacter ucCharacter 74 75syn cluster ucTop add=ucComment,ucLineComment 76 77" match the special comment /**/ 78syn match ucComment "/\*\*/" 79 80" Strings and constants 81syn match ucSpecialError contained "\\." 82"syn match ucSpecialCharError contained "[^']" 83syn match ucSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)" 84syn region ucString start=+"+ end=+"+ contains=ucSpecialChar,ucSpecialError 85syn match ucStringError +"\([^"\\]\|\\.\)*$+ 86syn match ucCharacter "'[^']*'" contains=ucSpecialChar,ucSpecialCharError 87syn match ucCharacter "'\\''" contains=ucSpecialChar 88syn match ucCharacter "'[^\\]'" 89syn match ucNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" 90syn match ucNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" 91syn match ucNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" 92syn match ucNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" 93 94" unicode characters 95syn match ucSpecial "\\u\d\{4\}" 96 97syn cluster ucTop add=ucString,ucCharacter,ucNumber,ucSpecial,ucStringError 98 99" catch errors caused by wrong parenthesis 100syn region ucParen transparent start="(" end=")" contains=@ucTop,ucParen 101syn match ucParenError ")" 102hi link ucParenError ucError 103 104if !exists("uc_minlines") 105 let uc_minlines = 10 106endif 107exec "syn sync ccomment ucComment minlines=" . uc_minlines 108 109" Define the default highlighting. 110" Only when an item doesn't have highlighting yet 111 112hi def link ucFuncDef Conditional 113hi def link ucEventDef Conditional 114hi def link ucBraces Function 115hi def link ucBranch Conditional 116hi def link ucLabel Label 117hi def link ucUserLabel Label 118hi def link ucConditional Conditional 119hi def link ucRepeat Repeat 120hi def link ucStorageClass StorageClass 121hi def link ucMethodDecl ucStorageClass 122hi def link ucClassDecl ucStorageClass 123hi def link ucScopeDecl ucStorageClass 124hi def link ucBoolean Boolean 125hi def link ucSpecial Special 126hi def link ucSpecialError Error 127hi def link ucSpecialCharError Error 128hi def link ucString String 129hi def link ucCharacter Character 130hi def link ucSpecialChar SpecialChar 131hi def link ucNumber Number 132hi def link ucError Error 133hi def link ucStringError Error 134hi def link ucStatement Statement 135hi def link ucOperator Operator 136hi def link ucOverLoaded Operator 137hi def link ucComment Comment 138hi def link ucDocComment Comment 139hi def link ucLineComment Comment 140hi def link ucConstant ucBoolean 141hi def link ucTypedef Typedef 142hi def link ucTodo Todo 143 144hi def link ucCommentTitle SpecialComment 145hi def link ucDocTags Special 146hi def link ucDocParam Function 147hi def link ucCommentStar ucComment 148 149hi def link ucType Type 150hi def link ucExternal Include 151 152hi def link ucClassKeys Conditional 153hi def link ucClassLabel Conditional 154 155hi def link htmlComment Special 156hi def link htmlCommentPart Special 157 158 159let b:current_syntax = "uc" 160 161if main_syntax == 'uc' 162 unlet main_syntax 163endif 164 165" vim: ts=8 166