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