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