xref: /vim-8.2.3635/runtime/syntax/uc.vim (revision 89bcfda6)
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
111command -nargs=+ HiLink hi def link <args>
112
113HiLink ucFuncDef			Conditional
114HiLink ucEventDef			Conditional
115HiLink ucBraces			Function
116HiLink ucBranch			Conditional
117HiLink ucLabel			Label
118HiLink ucUserLabel			Label
119HiLink ucConditional			Conditional
120HiLink ucRepeat			Repeat
121HiLink ucStorageClass			StorageClass
122HiLink ucMethodDecl			ucStorageClass
123HiLink ucClassDecl			ucStorageClass
124HiLink ucScopeDecl			ucStorageClass
125HiLink ucBoolean			Boolean
126HiLink ucSpecial			Special
127HiLink ucSpecialError			Error
128HiLink ucSpecialCharError		Error
129HiLink ucString			String
130HiLink ucCharacter			Character
131HiLink ucSpecialChar			SpecialChar
132HiLink ucNumber			Number
133HiLink ucError			Error
134HiLink ucStringError			Error
135HiLink ucStatement			Statement
136HiLink ucOperator			Operator
137HiLink ucOverLoaded			Operator
138HiLink ucComment			Comment
139HiLink ucDocComment			Comment
140HiLink ucLineComment			Comment
141HiLink ucConstant			ucBoolean
142HiLink ucTypedef			Typedef
143HiLink ucTodo				Todo
144
145HiLink ucCommentTitle			SpecialComment
146HiLink ucDocTags			Special
147HiLink ucDocParam			Function
148HiLink ucCommentStar			ucComment
149
150HiLink ucType				Type
151HiLink ucExternal			Include
152
153HiLink ucClassKeys			Conditional
154HiLink ucClassLabel			Conditional
155
156HiLink htmlComment			Special
157HiLink htmlCommentPart		Special
158
159delcommand HiLink
160
161let b:current_syntax = "uc"
162
163if main_syntax == 'uc'
164  unlet main_syntax
165endif
166
167" vim: ts=8
168