diff options
Diffstat (limited to 'runtime/syntax/sqr.vim')
-rw-r--r-- | runtime/syntax/sqr.vim | 121 |
1 files changed, 45 insertions, 76 deletions
diff --git a/runtime/syntax/sqr.vim b/runtime/syntax/sqr.vim index 8c9e7b49e..7e7344357 100644 --- a/runtime/syntax/sqr.vim +++ b/runtime/syntax/sqr.vim @@ -16,19 +16,12 @@ " http://lanzarotta.tripod.com/vim.html " jefflanzarotta at yahoo dot com -" For version 5.x, clear all syntax items. -" For version 6.x, quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +" quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,-,#,$,{,} -else - set iskeyword=@,48-57,_,-,#,$,{,} -endif +setlocal iskeyword=@,48-57,_,-,#,$,{,} syn case ignore @@ -220,75 +213,51 @@ syn match sqrNumber /-\=\<\d*\.\=[0-9_]\>/ syn keyword sqrTodo TODO FIXME XXX DEBUG NOTE ### syn match sqrTodo /???/ -if version >= 600 - " See also the sqrString section above for handling of ! characters - " inside of strings. (Those patterns override the ones below.) - syn match sqrComment /!\@<!!\([^!=].*\|$\)/ contains=sqrTodo - " the ! can't be preceded by another !, - " and must be followed by at least one - " character other than ! or =, or immediately - " by the end-of-line - syn match sqrComment /^!=.*/ contains=sqrTodo - syn match sqrComment /^!!.*/ contains=sqrTodo - syn match sqrError /^\s\+\zs!=.*/ - " it's an error to have "!=" preceded by - " just whitespace on the line ("!=" - " preceded by non-whitespace is treated - " as neither a comment nor an error, since - " it is often correct, i.e. - " if #count != 7 - syn match sqrError /.\+\zs!!.*/ - " a "!!" anywhere but at the beginning of - " the line is always an error -else "For versions before 6.0, same idea as above but we are limited - "to simple patterns only. Also, the sqrString patterns above - "don't seem to take precedence in v5 as they do in v6, so - "we split the last rule to ignore comments found inside of - "string literals. - syn match sqrComment /!\([^!=].*\|$\)/ contains=sqrTodo - syn match sqrComment /^!=.*/ contains=sqrTodo - syn match sqrComment /^!!.*/ contains=sqrTodo - syn match sqrError /^\s\+!=.*/ - syn match sqrError /^[^'!]\+!!/ - " flag !! on lines that don't have ! or ' - syn match sqrError /^\([^!']*'[^']*'[^!']*\)\+!!/ - " flag !! found after matched ' ' chars - " (that aren't also commented) -endif +" See also the sqrString section above for handling of ! characters +" inside of strings. (Those patterns override the ones below.) +syn match sqrComment /!\@<!!\([^!=].*\|$\)/ contains=sqrTodo +" the ! can't be preceded by another !, +" and must be followed by at least one +" character other than ! or =, or immediately +" by the end-of-line +syn match sqrComment /^!=.*/ contains=sqrTodo +syn match sqrComment /^!!.*/ contains=sqrTodo +syn match sqrError /^\s\+\zs!=.*/ +" it's an error to have "!=" preceded by +" just whitespace on the line ("!=" +" preceded by non-whitespace is treated +" as neither a comment nor an error, since +" it is often correct, i.e. +" if #count != 7 +syn match sqrError /.\+\zs!!.*/ +" a "!!" anywhere but at the beginning of +" the line is always an error " Define the default highlighting. -" For version 5.7 and earlier, only when not done already. -" For version 5.8 and later, only when an item doesn't have highlighting yet. -if version >= 508 || !exists("did_sqr_syn_inits") - if version < 508 - let did_sqr_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sqrSection Statement - HiLink sqrParagraph Statement - HiLink sqrReserved Statement - HiLink sqrParameter Statement - HiLink sqrPreProc PreProc - HiLink sqrSubstVar PreProc - HiLink sqrCommand Statement - HiLink sqrParam Type - HiLink sqrFunction Special - - HiLink sqrString String - HiLink sqrStrOpen Todo - HiLink sqrNumber Number - HiLink sqrVariable Identifier - - HiLink sqrComment Comment - HiLink sqrTodo Todo - HiLink sqrError Error - - delcommand HiLink -endif +" Only when an item doesn't have highlighting yet. +command -nargs=+ HiLink hi def link <args> + +HiLink sqrSection Statement +HiLink sqrParagraph Statement +HiLink sqrReserved Statement +HiLink sqrParameter Statement +HiLink sqrPreProc PreProc +HiLink sqrSubstVar PreProc +HiLink sqrCommand Statement +HiLink sqrParam Type +HiLink sqrFunction Special + +HiLink sqrString String +HiLink sqrStrOpen Todo +HiLink sqrNumber Number +HiLink sqrVariable Identifier + +HiLink sqrComment Comment +HiLink sqrTodo Todo +HiLink sqrError Error + +delcommand HiLink let b:current_syntax = "sqr" |