52 lines
2.5 KiB
VimL
52 lines
2.5 KiB
VimL
" Language: C
|
||
" Description: Additional C syntax file.
|
||
" Author: Kenneth Benzie (Benie) <k.benzie83@gmail.com>
|
||
" Last Modified: September 04, 2016
|
||
|
||
" Match delimiter expressions: (expr) {expr} : ;
|
||
" ^ ^ ^ ^ ^ ^
|
||
syn match cDelimiter '[()\[\]:;]'
|
||
" Match single character operators, ordering within the [] is important
|
||
syn match cOperator '[\*=\.\^\~+\-,&|!%?]'
|
||
" Match single character operators if they are surrounded by white space: / < >
|
||
" ^ ^ ^
|
||
syn match cOperator '\(\s\zs\/\s\ze\|\s\zs<\s\ze\|\s\zs>\s\ze\)'
|
||
" Match multi character operators
|
||
syn match cOperator '\(+=\|-=\|\*=\|/=\|%=\|\ˆ=\|&=\||=\|<<\|>>\|>>=\)'
|
||
syn match cOperator '\(<<=\|==\|!=\|<=\|>=\|&&\|||\|++\|--\|->\*\|->\)'
|
||
" Match : in ternary operator as cOperator
|
||
syn region cOperatorTernary matchgroup=cOperator start='?' end=':' transparent
|
||
" TODO: Match operator/ operator< operator>
|
||
" Match function expressions: expr()
|
||
" ^^^^
|
||
syn match cFunction '\w[A-Za-z0-9_]*\ze\s*('
|
||
" Match label expressions: expr:
|
||
" ^^^^
|
||
syn match cLabel '^\s*\w[A-Za-z0-9_]\+\ze::\@!' contains=cppAccess
|
||
|
||
" Match Doxygen comments
|
||
let g:c_doxygen = get(g:, 'c_doxygen', 1)
|
||
if exists('g:c_doxygen') && g:c_doxygen
|
||
syn region cDoxygenMarkdownMono oneline start='`' end='`'
|
||
syn match cDoxygenUrl /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
|
||
syn region cDoxygenComment oneline start='\/\/\/' end='$' contains=cDoxygenMarkdownMono,cDoxygenUrl,@Spell
|
||
syn region cDoxygen oneline matchgroup=cComment start='\/\/\/\s*[\\@]brief\s\+' end='$' contains=cDoxygenMarkdownMono,@Spell
|
||
syn region cDoxygen oneline matchgroup=cComment start='\/\/\/\s*[\\@]tparam\s\+' end='\(\s.*$\|$\)'
|
||
syn region cDoxygen oneline matchgroup=cComment start='\/\/\/\s*[\\@]param\(\[\(\|in\|out\|in,out\)\]\)\=\s\+' end='\(\s.*$\|$\)'
|
||
syn match cDoxygenTodo 'todo' contained
|
||
syn region cComment oneline start='\/\/\/\s*[\\@]\zetodo\s\+' end='$' contains=cDoxygenTodo,@Spell
|
||
hi default link cDoxygenMarkdownMono SpecialComment
|
||
hi default link cDoxygenUrl Underlined
|
||
hi default link cDoxygenComment cComment
|
||
hi default link cDoxygen SpecialComment
|
||
hi default link cDoxygenTodo Todo
|
||
endif
|
||
|
||
|
||
" Match curly braces with cDelimiter highlight group
|
||
syn region cBlock matchgroup=cDelimiter start="{" end="}" transparent fold
|
||
|
||
" Define additional highlight groups
|
||
hi default link cDelimiter Delimiter
|
||
hi default link cFunction Function
|