799
|
1 " Vim syntax file
|
|
2 " Language: Groovy
|
2662
|
3 " Original Author: Alessio Pace <billy.corgan@tiscali.it>
|
|
4 " Maintainer: Tobias Rapp <yahuxo@gmx.de>
|
4339
|
5 " Version: 0.1.13
|
3281
|
6 " URL: http://www.vim.org/scripts/script.php?script_id=945
|
4339
|
7 " Last Change: 2013 Apr 24
|
799
|
8
|
2662
|
9 " THE ORIGINAL AUTHOR'S NOTES:
|
|
10 "
|
799
|
11 " This is my very first vim script, I hope to have
|
|
12 " done it the right way.
|
3281
|
13 "
|
799
|
14 " I must directly or indirectly thank the author of java.vim and ruby.vim:
|
|
15 " I copied from them most of the stuff :-)
|
|
16 "
|
|
17 " Relies on html.vim
|
|
18
|
|
19 " For version 5.x: Clear all syntax items
|
|
20 " For version 6.x: Quit when a syntax file was already loaded
|
|
21 "
|
2662
|
22 " HOWTO USE IT (INSTALL) when not part of the distribution:
|
799
|
23 "
|
|
24 " 1) copy the file in the (global or user's $HOME/.vim/syntax/) syntax folder
|
3281
|
25 "
|
799
|
26 " 2) add this line to recognize groovy files by filename extension:
|
|
27 "
|
|
28 " au BufNewFile,BufRead *.groovy setf groovy
|
|
29 " in the global vim filetype.vim file or inside $HOME/.vim/filetype.vim
|
|
30 "
|
|
31 " 3) add this part to recognize by content groovy script (no extension needed :-)
|
|
32 "
|
|
33 " if did_filetype()
|
|
34 " finish
|
|
35 " endif
|
|
36 " if getline(1) =~ '^#!.*[/\\]groovy\>'
|
|
37 " setf groovy
|
|
38 " endif
|
|
39 "
|
|
40 " in the global scripts.vim file or in $HOME/.vim/scripts.vim
|
3281
|
41 "
|
799
|
42 " 4) open/write a .groovy file or a groovy script :-)
|
|
43 "
|
|
44 " Let me know if you like it or send me patches, so that I can improve it
|
|
45 " when I have time
|
|
46
|
|
47 " Quit when a syntax file was already loaded
|
|
48 if !exists("main_syntax")
|
|
49 if version < 600
|
|
50 syntax clear
|
|
51 elseif exists("b:current_syntax")
|
|
52 finish
|
|
53 endif
|
|
54 " we define it here so that included files can test for it
|
|
55 let main_syntax='groovy'
|
|
56 endif
|
|
57
|
3281
|
58 let s:cpo_save = &cpo
|
|
59 set cpo&vim
|
|
60
|
799
|
61 " don't use standard HiLink, it will not work with included syntax files
|
|
62 if version < 508
|
|
63 command! -nargs=+ GroovyHiLink hi link <args>
|
|
64 else
|
|
65 command! -nargs=+ GroovyHiLink hi def link <args>
|
|
66 endif
|
|
67
|
|
68 " ##########################
|
|
69 " Java stuff taken from java.vim
|
|
70 " some characters that cannot be in a groovy program (outside a string)
|
|
71 " syn match groovyError "[\\@`]"
|
|
72 "syn match groovyError "<<<\|\.\.\|=>\|<>\|||=\|&&=\|[^-]->\|\*\/"
|
|
73 "syn match groovyOK "\.\.\."
|
|
74
|
|
75 " keyword definitions
|
|
76 syn keyword groovyExternal native package
|
4339
|
77 syn match groovyExternal "\<import\>\(\s\+static\>\)\?"
|
799
|
78 syn keyword groovyError goto const
|
|
79 syn keyword groovyConditional if else switch
|
|
80 syn keyword groovyRepeat while for do
|
|
81 syn keyword groovyBoolean true false
|
|
82 syn keyword groovyConstant null
|
|
83 syn keyword groovyTypedef this super
|
|
84 syn keyword groovyOperator new instanceof
|
|
85 syn keyword groovyType boolean char byte short int long float double
|
|
86 syn keyword groovyType void
|
|
87 syn keyword groovyType Integer Double Date Boolean Float String Array Vector List
|
|
88 syn keyword groovyStatement return
|
|
89 syn keyword groovyStorageClass static synchronized transient volatile final strictfp serializable
|
|
90 syn keyword groovyExceptions throw try catch finally
|
|
91 syn keyword groovyAssert assert
|
|
92 syn keyword groovyMethodDecl synchronized throws
|
|
93 syn keyword groovyClassDecl extends implements interface
|
|
94 " to differentiate the keyword class from MyClass.class we use a match here
|
|
95 syn match groovyTypedef "\.\s*\<class\>"ms=s+1
|
|
96 syn keyword groovyClassDecl enum
|
|
97 syn match groovyClassDecl "^class\>"
|
|
98 syn match groovyClassDecl "[^.]\s*\<class\>"ms=s+1
|
|
99 syn keyword groovyBranch break continue nextgroup=groovyUserLabelRef skipwhite
|
|
100 syn match groovyUserLabelRef "\k\+" contained
|
|
101 syn keyword groovyScopeDecl public protected private abstract
|
|
102
|
|
103
|
|
104 if exists("groovy_highlight_groovy_lang_ids") || exists("groovy_highlight_groovy_lang") || exists("groovy_highlight_all")
|
|
105 " groovy.lang.*
|
|
106 syn keyword groovyLangClass Closure MetaMethod GroovyObject
|
3281
|
107
|
799
|
108 syn match groovyJavaLangClass "\<System\>"
|
|
109 syn keyword groovyJavaLangClass Cloneable Comparable Runnable Serializable Boolean Byte Class Object
|
|
110 syn keyword groovyJavaLangClass Character CharSequence ClassLoader Compiler
|
3281
|
111 " syn keyword groovyJavaLangClass Integer Double Float Long
|
799
|
112 syn keyword groovyJavaLangClass InheritableThreadLocal Math Number Object Package Process
|
|
113 syn keyword groovyJavaLangClass Runtime RuntimePermission InheritableThreadLocal
|
|
114 syn keyword groovyJavaLangClass SecurityManager Short StrictMath StackTraceElement
|
|
115 syn keyword groovyJavaLangClass StringBuffer Thread ThreadGroup
|
|
116 syn keyword groovyJavaLangClass ThreadLocal Throwable Void ArithmeticException
|
|
117 syn keyword groovyJavaLangClass ArrayIndexOutOfBoundsException AssertionError
|
|
118 syn keyword groovyJavaLangClass ArrayStoreException ClassCastException
|
|
119 syn keyword groovyJavaLangClass ClassNotFoundException
|
|
120 syn keyword groovyJavaLangClass CloneNotSupportedException Exception
|
|
121 syn keyword groovyJavaLangClass IllegalAccessException
|
|
122 syn keyword groovyJavaLangClass IllegalArgumentException
|
|
123 syn keyword groovyJavaLangClass IllegalMonitorStateException
|
|
124 syn keyword groovyJavaLangClass IllegalStateException
|
|
125 syn keyword groovyJavaLangClass IllegalThreadStateException
|
|
126 syn keyword groovyJavaLangClass IndexOutOfBoundsException
|
|
127 syn keyword groovyJavaLangClass InstantiationException InterruptedException
|
|
128 syn keyword groovyJavaLangClass NegativeArraySizeException NoSuchFieldException
|
|
129 syn keyword groovyJavaLangClass NoSuchMethodException NullPointerException
|
|
130 syn keyword groovyJavaLangClass NumberFormatException RuntimeException
|
|
131 syn keyword groovyJavaLangClass SecurityException StringIndexOutOfBoundsException
|
|
132 syn keyword groovyJavaLangClass UnsupportedOperationException
|
|
133 syn keyword groovyJavaLangClass AbstractMethodError ClassCircularityError
|
|
134 syn keyword groovyJavaLangClass ClassFormatError Error ExceptionInInitializerError
|
|
135 syn keyword groovyJavaLangClass IllegalAccessError InstantiationError
|
|
136 syn keyword groovyJavaLangClass IncompatibleClassChangeError InternalError
|
|
137 syn keyword groovyJavaLangClass LinkageError NoClassDefFoundError
|
|
138 syn keyword groovyJavaLangClass NoSuchFieldError NoSuchMethodError
|
|
139 syn keyword groovyJavaLangClass OutOfMemoryError StackOverflowError
|
|
140 syn keyword groovyJavaLangClass ThreadDeath UnknownError UnsatisfiedLinkError
|
|
141 syn keyword groovyJavaLangClass UnsupportedClassVersionError VerifyError
|
|
142 syn keyword groovyJavaLangClass VirtualMachineError
|
|
143
|
|
144 syn keyword groovyJavaLangObject clone equals finalize getClass hashCode
|
|
145 syn keyword groovyJavaLangObject notify notifyAll toString wait
|
|
146
|
|
147 GroovyHiLink groovyLangClass groovyConstant
|
|
148 GroovyHiLink groovyJavaLangClass groovyExternal
|
|
149 GroovyHiLink groovyJavaLangObject groovyConstant
|
|
150 syn cluster groovyTop add=groovyJavaLangObject,groovyJavaLangClass,groovyLangClass
|
|
151 syn cluster groovyClasses add=groovyJavaLangClass,groovyLangClass
|
|
152 endif
|
|
153
|
|
154
|
|
155 " Groovy stuff
|
|
156 syn match groovyOperator "\.\."
|
|
157 syn match groovyOperator "<\{2,3}"
|
|
158 syn match groovyOperator ">\{2,3}"
|
|
159 syn match groovyOperator "->"
|
|
160 syn match groovyExternal '^#!.*[/\\]groovy\>'
|
|
161 syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>"
|
|
162
|
|
163 " Groovy JDK stuff
|
|
164 syn keyword groovyJDKBuiltin as def in
|
3281
|
165 syn keyword groovyJDKOperOverl div minus plus abs round power multiply
|
|
166 syn keyword groovyJDKMethods each call inject sort print println
|
799
|
167 syn keyword groovyJDKMethods getAt putAt size push pop toList getText writeLine eachLine readLines
|
3281
|
168 syn keyword groovyJDKMethods withReader withStream withWriter withPrintWriter write read leftShift
|
799
|
169 syn keyword groovyJDKMethods withWriterAppend readBytes splitEachLine
|
3281
|
170 syn keyword groovyJDKMethods newInputStream newOutputStream newPrintWriter newReader newWriter
|
|
171 syn keyword groovyJDKMethods compareTo next previous isCase
|
799
|
172 syn keyword groovyJDKMethods times step toInteger upto any collect dump every find findAll grep
|
3281
|
173 syn keyword groovyJDKMethods inspect invokeMethods join
|
799
|
174 syn keyword groovyJDKMethods getErr getIn getOut waitForOrKill
|
|
175 syn keyword groovyJDKMethods count tokenize asList flatten immutable intersect reverse reverseEach
|
3281
|
176 syn keyword groovyJDKMethods subMap append asWritable eachByte eachLine eachFile
|
799
|
177 syn cluster groovyTop add=groovyJDKBuiltin,groovyJDKOperOverl,groovyJDKMethods
|
|
178
|
|
179 " no useful I think, so I comment it..
|
|
180 "if filereadable(expand("<sfile>:p:h")."/groovyid.vim")
|
|
181 " source <sfile>:p:h/groovyid.vim
|
|
182 "endif
|
|
183
|
|
184 if exists("groovy_space_errors")
|
|
185 if !exists("groovy_no_trail_space_error")
|
|
186 syn match groovySpaceError "\s\+$"
|
|
187 endif
|
|
188 if !exists("groovy_no_tab_space_error")
|
|
189 syn match groovySpaceError " \+\t"me=e-1
|
|
190 endif
|
|
191 endif
|
|
192
|
|
193 " it is a better case construct than java.vim to match groovy syntax
|
|
194 syn region groovyLabelRegion transparent matchgroup=groovyLabel start="\<case\>" matchgroup=NONE end=":\|$" contains=groovyNumber,groovyString,groovyLangClass,groovyJavaLangClass
|
|
195 syn match groovyUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=groovyLabel
|
|
196 syn keyword groovyLabel default
|
|
197
|
|
198 if !exists("groovy_allow_cpp_keywords")
|
|
199 syn keyword groovyError auto delete extern friend inline redeclared
|
|
200 syn keyword groovyError register signed sizeof struct template typedef union
|
|
201 syn keyword groovyError unsigned operator
|
|
202 endif
|
|
203
|
|
204 " The following cluster contains all groovy groups except the contained ones
|
|
205 syn cluster groovyTop add=groovyExternal,groovyError,groovyError,groovyBranch,groovyLabelRegion,groovyLabel,groovyConditional,groovyRepeat,groovyBoolean,groovyConstant,groovyTypedef,groovyOperator,groovyType,groovyType,groovyStatement,groovyStorageClass,groovyAssert,groovyExceptions,groovyMethodDecl,groovyClassDecl,groovyClassDecl,groovyClassDecl,groovyScopeDecl,groovyError,groovyError2,groovyUserLabel,groovyLangObject
|
|
206
|
|
207
|
|
208 " Comments
|
|
209 syn keyword groovyTodo contained TODO FIXME XXX
|
|
210 if exists("groovy_comment_strings")
|
|
211 syn region groovyCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=groovySpecial,groovyCommentStar,groovySpecialChar,@Spell
|
|
212 syn region groovyComment2String contained start=+"+ end=+$\|"+ contains=groovySpecial,groovySpecialChar,@Spell
|
|
213 syn match groovyCommentCharacter contained "'\\[^']\{1,6\}'" contains=groovySpecialChar
|
|
214 syn match groovyCommentCharacter contained "'\\''" contains=groovySpecialChar
|
|
215 syn match groovyCommentCharacter contained "'[^\\]'"
|
|
216 syn cluster groovyCommentSpecial add=groovyCommentString,groovyCommentCharacter,groovyNumber
|
|
217 syn cluster groovyCommentSpecial2 add=groovyComment2String,groovyCommentCharacter,groovyNumber
|
|
218 endif
|
|
219 syn region groovyComment start="/\*" end="\*/" contains=@groovyCommentSpecial,groovyTodo,@Spell
|
|
220 syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1
|
|
221 syn match groovyCommentStar contained "^\s*\*$"
|
|
222 syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell
|
|
223 syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell
|
|
224 GroovyHiLink groovyCommentString groovyString
|
|
225 GroovyHiLink groovyComment2String groovyString
|
|
226 GroovyHiLink groovyCommentCharacter groovyCharacter
|
|
227
|
|
228 syn cluster groovyTop add=groovyComment,groovyLineComment
|
|
229
|
|
230 if !exists("groovy_ignore_groovydoc") && main_syntax != 'jsp'
|
|
231 syntax case ignore
|
|
232 " syntax coloring for groovydoc comments (HTML)
|
|
233 " syntax include @groovyHtml <sfile>:p:h/html.vim
|
|
234 syntax include @groovyHtml runtime! syntax/html.vim
|
|
235 unlet b:current_syntax
|
2034
|
236 syntax spell default " added by Bram
|
799
|
237 syn region groovyDocComment start="/\*\*" end="\*/" keepend contains=groovyCommentTitle,@groovyHtml,groovyDocTags,groovyTodo,@Spell
|
|
238 syn region groovyCommentTitle contained matchgroup=groovyDocComment start="/\*\*" matchgroup=groovyCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@groovyHtml,groovyCommentStar,groovyTodo,@Spell,groovyDocTags
|
|
239
|
|
240 syn region groovyDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}"
|
|
241 syn match groovyDocTags contained "@\(see\|param\|exception\|throws\|since\)\s\+\S\+" contains=groovyDocParam
|
|
242 syn match groovyDocParam contained "\s\S\+"
|
|
243 syn match groovyDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>"
|
|
244 syntax case match
|
|
245 endif
|
|
246
|
|
247 " match the special comment /**/
|
|
248 syn match groovyComment "/\*\*/"
|
|
249
|
|
250 " Strings and constants
|
|
251 syn match groovySpecialError contained "\\."
|
|
252 syn match groovySpecialCharError contained "[^']"
|
4229
|
253 syn match groovySpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\|\$\)"
|
|
254 syn match groovyRegexChar contained "\\."
|
799
|
255 syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
|
2662
|
256 syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell
|
|
257 syn region groovyString start=+"""+ end=+"""+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
|
|
258 syn region groovyString start=+'''+ end=+'''+ contains=groovySpecialChar,groovySpecialError,@Spell
|
4229
|
259 " regex string
|
|
260 syn region groovyString start='/[^/]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
|
799
|
261 " syn region groovyELExpr start=+${+ end=+}+ keepend contained
|
4229
|
262 syn match groovyELExpr /\${.\{-}}/ contained
|
|
263 syn match groovyELExpr /\$[a-zA-Z_][a-zA-Z0-9_.]*/ contained
|
799
|
264 GroovyHiLink groovyELExpr Identifier
|
|
265
|
|
266 " TODO: better matching. I am waiting to understand how it really works in groovy
|
|
267 " syn region groovyClosureParamsBraces start=+|+ end=+|+ contains=groovyClosureParams
|
|
268 " syn match groovyClosureParams "[ a-zA-Z0-9_*]\+" contained
|
|
269 " GroovyHiLink groovyClosureParams Identifier
|
|
270
|
|
271 " next line disabled, it can cause a crash for a long line
|
|
272 "syn match groovyStringError +"\([^"\\]\|\\.\)*$+
|
|
273
|
|
274 " disabled: in groovy strings or characters are written the same
|
|
275 " syn match groovyCharacter "'[^']*'" contains=groovySpecialChar,groovySpecialCharError
|
|
276 " syn match groovyCharacter "'\\''" contains=groovySpecialChar
|
|
277 " syn match groovyCharacter "'[^\\]'"
|
|
278 syn match groovyNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
|
279 syn match groovyNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
|
280 syn match groovyNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
|
281 syn match groovyNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
|
282
|
|
283 " unicode characters
|
|
284 syn match groovySpecial "\\u\d\{4\}"
|
|
285
|
|
286 syn cluster groovyTop add=groovyString,groovyCharacter,groovyNumber,groovySpecial,groovyStringError
|
|
287
|
|
288 if exists("groovy_highlight_functions")
|
|
289 if groovy_highlight_functions == "indent"
|
|
290 syn match groovyFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
|
291 syn region groovyFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
|
292 syn match groovyFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
|
293 syn region groovyFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
|
294 else
|
|
295 " This line catches method declarations at any indentation>0, but it assumes
|
|
296 " two things:
|
|
297 " 1. class names are always capitalized (ie: Button)
|
|
298 " 2. method names are never capitalized (except constructors, of course)
|
|
299 syn region groovyFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,groovyComment,groovyLineComment,@groovyClasses
|
|
300 endif
|
|
301 syn match groovyBraces "[{}]"
|
|
302 syn cluster groovyTop add=groovyFuncDef,groovyBraces
|
|
303 endif
|
|
304
|
|
305 if exists("groovy_highlight_debug")
|
|
306
|
|
307 " Strings and constants
|
|
308 syn match groovyDebugSpecial contained "\\\d\d\d\|\\."
|
|
309 syn region groovyDebugString contained start=+"+ end=+"+ contains=groovyDebugSpecial
|
|
310 syn match groovyDebugStringError +"\([^"\\]\|\\.\)*$+
|
|
311 syn match groovyDebugCharacter contained "'[^\\]'"
|
|
312 syn match groovyDebugSpecialCharacter contained "'\\.'"
|
|
313 syn match groovyDebugSpecialCharacter contained "'\\''"
|
|
314 syn match groovyDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
|
315 syn match groovyDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
|
316 syn match groovyDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
|
317 syn match groovyDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
|
318 syn keyword groovyDebugBoolean contained true false
|
|
319 syn keyword groovyDebugType contained null this super
|
|
320 syn region groovyDebugParen start=+(+ end=+)+ contained contains=groovyDebug.*,groovyDebugParen
|
|
321
|
|
322 " to make this work you must define the highlighting for these groups
|
|
323 syn match groovyDebug "\<System\.\(out\|err\)\.print\(ln\)*\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
|
324 syn match groovyDebug "\<p\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
|
325 syn match groovyDebug "[A-Za-z][a-zA-Z0-9_]*\.printStackTrace\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
|
326 syn match groovyDebug "\<trace[SL]\=\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
|
327
|
|
328 syn cluster groovyTop add=groovyDebug
|
|
329
|
|
330 if version >= 508 || !exists("did_c_syn_inits")
|
|
331 GroovyHiLink groovyDebug Debug
|
|
332 GroovyHiLink groovyDebugString DebugString
|
|
333 GroovyHiLink groovyDebugStringError groovyError
|
|
334 GroovyHiLink groovyDebugType DebugType
|
|
335 GroovyHiLink groovyDebugBoolean DebugBoolean
|
|
336 GroovyHiLink groovyDebugNumber Debug
|
|
337 GroovyHiLink groovyDebugSpecial DebugSpecial
|
|
338 GroovyHiLink groovyDebugSpecialCharacter DebugSpecial
|
|
339 GroovyHiLink groovyDebugCharacter DebugString
|
|
340 GroovyHiLink groovyDebugParen Debug
|
3281
|
341
|
799
|
342 GroovyHiLink DebugString String
|
|
343 GroovyHiLink DebugSpecial Special
|
|
344 GroovyHiLink DebugBoolean Boolean
|
|
345 GroovyHiLink DebugType Type
|
|
346 endif
|
|
347 endif
|
|
348
|
3281
|
349 " Match all Exception classes
|
799
|
350 syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>"
|
|
351
|
|
352
|
|
353 if !exists("groovy_minlines")
|
|
354 let groovy_minlines = 10
|
|
355 endif
|
|
356 exec "syn sync ccomment groovyComment minlines=" . groovy_minlines
|
|
357
|
|
358
|
3281
|
359 " ###################
|
799
|
360 " Groovy stuff
|
|
361 " syn match groovyOperator "|[ ,a-zA-Z0-9_*]\+|"
|
|
362
|
|
363 " All groovy valid tokens
|
|
364 " syn match groovyTokens ";\|,\|<=>\|<>\|:\|:=\|>\|>=\|=\|==\|<\|<=\|!=\|/\|/=\|\.\.|\.\.\.\|\~=\|\~=="
|
|
365 " syn match groovyTokens "\*=\|&\|&=\|\*\|->\|\~\|+\|-\|/\|?\|<<<\|>>>\|<<\|>>"
|
|
366
|
|
367 " Must put explicit these ones because groovy.vim mark them as errors otherwise
|
|
368 " syn match groovyTokens "<=>\|<>\|==\~"
|
|
369 "syn cluster groovyTop add=groovyTokens
|
|
370
|
|
371 " Mark these as operators
|
|
372
|
|
373 " Hightlight brackets
|
|
374 " syn match groovyBraces "[{}]"
|
|
375 " syn match groovyBraces "[\[\]]"
|
|
376 " syn match groovyBraces "[\|]"
|
|
377
|
|
378 if exists("groovy_mark_braces_in_parens_as_errors")
|
|
379 syn match groovyInParen contained "[{}]"
|
|
380 GroovyHiLink groovyInParen groovyError
|
|
381 syn cluster groovyTop add=groovyInParen
|
|
382 endif
|
|
383
|
|
384 " catch errors caused by wrong parenthesis
|
|
385 syn region groovyParenT transparent matchgroup=groovyParen start="(" end=")" contains=@groovyTop,groovyParenT1
|
|
386 syn region groovyParenT1 transparent matchgroup=groovyParen1 start="(" end=")" contains=@groovyTop,groovyParenT2 contained
|
|
387 syn region groovyParenT2 transparent matchgroup=groovyParen2 start="(" end=")" contains=@groovyTop,groovyParenT contained
|
|
388 syn match groovyParenError ")"
|
|
389 GroovyHiLink groovyParenError groovyError
|
|
390
|
|
391 " catch errors caused by wrong square parenthesis
|
|
392 syn region groovyParenT transparent matchgroup=groovyParen start="\[" end="\]" contains=@groovyTop,groovyParenT1
|
|
393 syn region groovyParenT1 transparent matchgroup=groovyParen1 start="\[" end="\]" contains=@groovyTop,groovyParenT2 contained
|
|
394 syn region groovyParenT2 transparent matchgroup=groovyParen2 start="\[" end="\]" contains=@groovyTop,groovyParenT contained
|
|
395 syn match groovyParenError "\]"
|
|
396
|
|
397 " ###############################
|
|
398 " java.vim default highlighting
|
|
399 if version >= 508 || !exists("did_groovy_syn_inits")
|
|
400 if version < 508
|
|
401 let did_groovy_syn_inits = 1
|
|
402 endif
|
|
403 GroovyHiLink groovyFuncDef Function
|
|
404 GroovyHiLink groovyBraces Function
|
|
405 GroovyHiLink groovyBranch Conditional
|
|
406 GroovyHiLink groovyUserLabelRef groovyUserLabel
|
|
407 GroovyHiLink groovyLabel Label
|
|
408 GroovyHiLink groovyUserLabel Label
|
|
409 GroovyHiLink groovyConditional Conditional
|
|
410 GroovyHiLink groovyRepeat Repeat
|
|
411 GroovyHiLink groovyExceptions Exception
|
|
412 GroovyHiLink groovyAssert Statement
|
|
413 GroovyHiLink groovyStorageClass StorageClass
|
|
414 GroovyHiLink groovyMethodDecl groovyStorageClass
|
|
415 GroovyHiLink groovyClassDecl groovyStorageClass
|
|
416 GroovyHiLink groovyScopeDecl groovyStorageClass
|
|
417 GroovyHiLink groovyBoolean Boolean
|
|
418 GroovyHiLink groovySpecial Special
|
|
419 GroovyHiLink groovySpecialError Error
|
|
420 GroovyHiLink groovySpecialCharError Error
|
|
421 GroovyHiLink groovyString String
|
4229
|
422 GroovyHiLink groovyRegexChar String
|
799
|
423 GroovyHiLink groovyCharacter Character
|
|
424 GroovyHiLink groovySpecialChar SpecialChar
|
|
425 GroovyHiLink groovyNumber Number
|
|
426 GroovyHiLink groovyError Error
|
|
427 GroovyHiLink groovyStringError Error
|
|
428 GroovyHiLink groovyStatement Statement
|
|
429 GroovyHiLink groovyOperator Operator
|
|
430 GroovyHiLink groovyComment Comment
|
|
431 GroovyHiLink groovyDocComment Comment
|
|
432 GroovyHiLink groovyLineComment Comment
|
|
433 GroovyHiLink groovyConstant Constant
|
|
434 GroovyHiLink groovyTypedef Typedef
|
|
435 GroovyHiLink groovyTodo Todo
|
3281
|
436
|
799
|
437 GroovyHiLink groovyCommentTitle SpecialComment
|
|
438 GroovyHiLink groovyDocTags Special
|
|
439 GroovyHiLink groovyDocParam Function
|
|
440 GroovyHiLink groovyCommentStar groovyComment
|
3281
|
441
|
799
|
442 GroovyHiLink groovyType Type
|
|
443 GroovyHiLink groovyExternal Include
|
3281
|
444
|
799
|
445 GroovyHiLink htmlComment Special
|
|
446 GroovyHiLink htmlCommentPart Special
|
|
447 GroovyHiLink groovySpaceError Error
|
|
448 GroovyHiLink groovyJDKBuiltin Special
|
|
449 GroovyHiLink groovyJDKOperOverl Operator
|
|
450 GroovyHiLink groovyJDKMethods Function
|
|
451 endif
|
|
452
|
|
453 delcommand GroovyHiLink
|
|
454
|
|
455
|
|
456 let b:current_syntax = "groovy"
|
|
457 if main_syntax == 'groovy'
|
|
458 unlet main_syntax
|
|
459 endif
|
|
460
|
|
461 let b:spell_options="contained"
|
|
462
|
3281
|
463 let &cpo = s:cpo_save
|
|
464 unlet s:cpo_save
|
|
465
|
799
|
466 " vim: ts=8
|