73 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
" File: groovy.vim
 | 
						|
" Author: Kenneth Benzie (Benie) <k.benzie83@gmail.com>
 | 
						|
" Description: Extended groovy syntax for Jenkins DSL.
 | 
						|
 | 
						|
" Highlight shell('') and shell('''''') blocks with the sh filetype.
 | 
						|
" unlet !b:current_syntax
 | 
						|
 | 
						|
" Highlight batchFile('') and batchFile('''''') blocks with the batch filetype.
 | 
						|
" syn include @groovyHighlightBatch syntax/batch.vim
 | 
						|
" syn region groovyHighlightBatch matchgroup=groovyString start="batchFile(\zs'\(''\)\=" end="\(''\)\='\ze)" contains=@groovyHighlightBatch
 | 
						|
 | 
						|
" keyword definitions
 | 
						|
" syn keyword groovyExternal native package
 | 
						|
" syn match groovyExternal "\<import\>\(\s\+static\>\)\?"
 | 
						|
" syn keyword groovyError goto const
 | 
						|
" syn keyword groovyConditional if else switch
 | 
						|
" syn keyword groovyRepeat while for do
 | 
						|
" syn keyword groovyBoolean true false
 | 
						|
" syn keyword groovyConstant null
 | 
						|
" syn keyword groovyTypedef this super
 | 
						|
" syn keyword groovyOperator new instanceof
 | 
						|
" syn keyword groovyType boolean char byte short int long float double void
 | 
						|
"       \ Integer Double Date Boolean Float String Array Vector List
 | 
						|
" syn keyword groovyStatement return
 | 
						|
" syn keyword groovyStorageClass static synchronized transient volatile final strictfp serializable
 | 
						|
" syn keyword groovyExceptions throw try catch finally
 | 
						|
" syn keyword groovyAssert assert
 | 
						|
" syn keyword groovyMethodDecl synchronized throws
 | 
						|
" syn keyword groovyClassDecl extends implements interface
 | 
						|
" " to differentiate the keyword class from MyClass.class we use a match here
 | 
						|
" syn match groovyTypedef "\.\s*\<class\>"ms=s+1
 | 
						|
" syn keyword groovyClassDecl enum
 | 
						|
" syn match groovyClassDecl "^class\>"
 | 
						|
" syn match groovyClassDecl "[^.]\s*\<class\>"ms=s+1
 | 
						|
" syn keyword groovyBranch break continue nextgroup=groovyUserLabelRef skipwhite
 | 
						|
" syn match groovyUserLabelRef "\k\+" contained
 | 
						|
" syn keyword groovyScopeDecl public protected private abstract
 | 
						|
 | 
						|
syn region groovyComment start='\/\*' end='\*\/' fold
 | 
						|
syn match groovyComment '\s*\/\/.*$'
 | 
						|
 | 
						|
syn match groovyDelimiter '[()\[\]]'
 | 
						|
syn region groovyBlock matchgroup=groovyDelimiter start='{' end='}' transparent fold
 | 
						|
 | 
						|
syn match groovyStructure '\w\+\ze\s*{'
 | 
						|
syn match groovyFunction '\w\+\ze\s*('
 | 
						|
 | 
						|
syn region groovyIdentifier start='${' end='}' oneline
 | 
						|
syn region groovyString start=+"+ end=+"+ oneline contains=groovyIdentifier
 | 
						|
syn region groovyString start=+'+ end=+'+ oneline contains=groovyIdentifier
 | 
						|
syn region groovyString start=+'''+ end=+'''+ fold contains=groovyIdentifier
 | 
						|
 | 
						|
syn include @groovyShellSyntax syntax/sh.vim
 | 
						|
unlet b:current_syntax
 | 
						|
syn region groovyShellSyntax matchgroup=groovyString start=+'''+ end=+'''+ contains=@groovyShellSyntax contained
 | 
						|
syn region groovyShell matchgroup=groovyFunction start='shell\s*\ze(' end='\ze)' fold contains=groovyShellSyntax,groovyDelimiter
 | 
						|
 | 
						|
syn include @groovyBatchSyntax syntax/dosbatch.vim
 | 
						|
unlet b:current_syntax
 | 
						|
syn region groovyBatchSyntax matchgroup=groovyString start=+'''+ end=+'''+ contains=@groovyBatchSyntax contained
 | 
						|
syn region groovyBatch matchgroup=groovyFunction start='batchFile\s*\ze(' end='\ze)' fold contains=groovyBatchSyntax,groovyDelimiter
 | 
						|
 | 
						|
hi default link groovyDelimiter Delimiter
 | 
						|
hi default link groovyBoolean Boolean
 | 
						|
hi default link groovyComment Comment
 | 
						|
hi default link groovyString String
 | 
						|
hi default link groovyStructure Structure
 | 
						|
hi default link groovyIdentifier Identifier
 | 
						|
hi default link groovyFunction Function
 | 
						|
hi default link groovyShellDelimiter groovyDelimiter
 | 
						|
 | 
						|
let b:current_syntax = 'groovy'
 |