diff options
-rw-r--r-- | vim/syntax/vala.vim | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/vim/syntax/vala.vim b/vim/syntax/vala.vim index c8de41e..3700fb6 100644 --- a/vim/syntax/vala.vim +++ b/vim/syntax/vala.vim @@ -3,7 +3,8 @@ " Maintainers: Emmanuele Bassi <ebassi@gnome.org> " Hans Vercammen <hveso3@gmail.com> " pancake <pancake@nopcode.org> -" Last Change: 2009-10-28 +" Sebastian Reichel <sre@ring0.de> +" Last Change: 2012-02-19 " Filenames: *.vala *.vapi " " REFERENCES: @@ -18,7 +19,7 @@ " to have shebang support if exists("b:current_syntax") - finish + finish endif let s:vala_cpo_save = &cpo @@ -54,33 +55,33 @@ syn keyword valaTodo contained TODO FIXME XXX NOTE " valadoc Comments (ported from javadoc comments in java.vim) " TODO: need to verify valadoc syntax if !exists("vala_ignore_valadoc") - syn cluster valaDocCommentGroup contains=valaDocTags,valaDocSeeTag - syn region valaDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" - syn match valaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=valaDocParam - syn match valaDocParam contained "\s\S\+" - syn match valaDocTags contained "@\(author\|brief\|version\|return\|deprecated\)\>" - syn region valaDocSeeTag contained matchgroup=valaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=valaDocSeeTagParam - syn match valaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\(\k\|\.\)*\(#\k\+\((\_[^)]\+)\)\=\)\=@ extend + syn cluster valaDocCommentGroup contains=valaDocTags,valaDocSeeTag + syn region valaDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" + syn match valaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=valaDocParam + syn match valaDocParam contained "\s\S\+" + syn match valaDocTags contained "@\(author\|brief\|version\|return\|deprecated\)\>" + syn region valaDocSeeTag contained matchgroup=valaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=valaDocSeeTagParam + syn match valaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\(\k\|\.\)*\(#\k\+\((\_[^)]\+)\)\=\)\=@ extend endif " Comment Strings (ported from c.vim) if exists("vala_comment_strings") - syn match valaCommentSkip contained "^\s*\*\($\|\s\+\)" - syn region valaCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=valaSpecialChar,valaCommentSkip - syn region valaComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=valaSpecialChar - syn cluster valaCommentStringGroup contains=valaCommentString,valaCharacter,valaNumber - - syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaComment2String,valaCharacter,valaNumber,valaSpaceError,@Spell - syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,@valaCommentStringGroup,valaCommentStartError,valaSpaceError,@Spell extend fold - if !exists("vala_ignore_valadoc") - syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,@valaCommentStringGroup,valaCommentStartError,valaSpaceError,@Spell - endif + syn match valaCommentSkip contained "^\s*\*\($\|\s\+\)" + syn region valaCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=valaSpecialChar,valaCommentSkip + syn region valaComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=valaSpecialChar + syn cluster valaCommentStringGroup contains=valaCommentString,valaCharacter,valaNumber + + syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaComment2String,valaCharacter,valaNumber,valaSpaceError,@Spell + syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,@valaCommentStringGroup,valaCommentStartError,valaSpaceError,@Spell extend fold + if !exists("vala_ignore_valadoc") + syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,@valaCommentStringGroup,valaCommentStartError,valaSpaceError,@Spell + endif else - syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaSpaceError,@Spell - syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,valaCommentStartError,valaSpaceError,@Spell - if !exists("vala_ignore_valadoc") - syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,valaCommentStartError,valaSpaceError,@Spell - endif + syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaSpaceError,@Spell + syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,valaCommentStartError,valaSpaceError,@Spell + if !exists("vala_ignore_valadoc") + syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,valaCommentStartError,valaSpaceError,@Spell + endif endif syn region valaPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 @@ -88,9 +89,9 @@ syn match valaPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>" " Comment if 0 blocks (ported from c.vim) if !exists("vala_no_if0") - syn region valaCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=valaCppOut2 fold - syn region valaCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=valaSpaceError,valaCppSkip - syn region valaCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=valaSpaceError,valaCppSkip + syn region valaCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=valaCppOut2 fold + syn region valaCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=valaSpaceError,valaCppSkip + syn region valaCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=valaSpaceError,valaCppSkip endif " match comment errors @@ -124,19 +125,19 @@ syn match valaNumber display "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" " when wanted, highlight trailing white space if exists("vala_space_errors") - if !exists("vala_no_trail_space_error") - syn match valaSpaceError display excludenl "\s\+$" - endif - if !exists("vala_no_tab_space_error") - syn match valaSpaceError display " \+\t"me=e-1 - endif + if !exists("vala_no_trail_space_error") + syn match valaSpaceError display excludenl "\s\+$" + endif + if !exists("vala_no_tab_space_error") + syn match valaSpaceError display " \+\t"me=e-1 + endif endif " when wanted, set minimum lines for comment syntax syncing if exists("vala_minlines") - let b:vala_minlines = vala_minlines + let b:vala_minlines = vala_minlines else - let b:vala_minlines = 50 + let b:vala_minlines = 50 endif exec "syn sync ccomment valaComment minlines=" . b:vala_minlines @@ -186,9 +187,9 @@ hi def link valaUnicodeSpecifier SpecialChar hi def link valaPreCondit PreCondit if !exists("vala_no_if0") - hi def link valaCppSkip valaCppOut - hi def link valaCppOut2 valaCppOut - hi def link valaCppOut Comment + hi def link valaCppSkip valaCppOut + hi def link valaCppOut2 valaCppOut + hi def link valaCppOut Comment endif let b:current_syntax = "vala" @@ -196,4 +197,4 @@ let b:current_syntax = "vala" let &cpo = s:vala_cpo_save unlet s:vala_cpo_save -" vim: ts=4 +" vim: ts=8 |