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