groovy.vim 22 KB

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