" Vim syntax file " Language: MPC " Maintainer: Jonathan Sprinkle, PhD " Last Change: 31 October 2005 " Based heavily on the c.vim file provided "as is" " 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") finish endif " A bunch of useful MPC keywords syn keyword cConditional specific else conditional syn keyword cScopeKeywords workspace exclude project Source_Files Header_Files Define_Custom optional feature syn keyword cAssignment exename sharedname staticname dllout libout install pch_header pch_source postbuild recurse version macros libpaths includes libs lit_libs pure_libs after custom_only dynamicflags staticflags requires avoids automatic dependent command commandflags inputext keyword libpath output_option pch_postrule postcommand pre_extension source_pre_extension inline_pre_extension header_pre_extension template_pre_extension resource_pre_extension documentation_pre_extension pre_filename source_pre_filename inline_pre_filename header_pre_filename template_pre_filename resource_pre_filename documentation_pre_filename source_outputext inline_outputext header_outputext template_outputext resource_outputext documentation_outputext generic_outputext project_name project_file guid configurations flag_overrides custom_types fornotlast forlast fornotfirst forfirst forcount syn keyword cTodo contained TODO FIXME XXX " cCommentGroup allows adding matches for special things in comments syn cluster cCommentGroup contains=cTodo " String and Character constants " Highlight special characters (those which have a backslash) differently syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" if !exists("c_no_utf") syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)" endif if exists("c_no_cformat") syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell else syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell endif syn match cCharacter "L\='[^\\]'" "catch errors caused by wrong parenthesis and brackets " also accept <% for {, %> for }, <: for [ and :> for ] (C99) " But avoid matching <::. syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cCommentSkip,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom if exists("c_no_bracket_error") syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "[{}]\|<%\|%>" else syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "[\]{}]\|<%\|%>" syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell " cCppBracket: same as cParen but ends at end-of-line; used in cDefine syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell syn match cErrInBracket display contained "[);{}]\|<%\|%>" endif if exists("c_comment_strings") " A comment can contain cString, cCharacter and cNumber. " But a "*/" inside a cString in a cComment DOES end the comment! So we " need to use a special type of cString: cCommentString, which also ends on " "*/", and sees a "*" at the start of the line as comment again. " Unfortunately this doesn't very well work for // type of comments :-( syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)" syntax region cCommentString contained start=+L\=\\\@= 508 || !exists("did_c_syn_inits") if version < 508 let did_c_syn_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif HiLink cFormat cSpecial HiLink cCppString cString HiLink cCommentL cComment HiLink cCommentStart cComment HiLink cLabel Label HiLink cUserLabel Label HiLink cConditional Conditional HiLink cRepeat Repeat HiLink cCharacter Character HiLink cSpecialCharacter cSpecial HiLink cNumber Number HiLink cOctal Number HiLink cOctalZero PreProc " link this to Error if you want HiLink cFloat Float HiLink cOctalError cError HiLink cParenError cError HiLink cErrInParen cError HiLink cErrInBracket cError HiLink cCommentError cError HiLink cCommentStartError cError HiLink cSpaceError cError HiLink cSpecialError cError HiLink cOperator Operator HiLink cStructure Structure HiLink cStorageClass StorageClass HiLink cInclude Include HiLink cPreProc PreProc HiLink cDefine Macro HiLink cIncluded cString HiLink cError Error HiLink cStatement Statement HiLink cPreCondit PreCondit HiLink cType Type HiLink cConstant Constant HiLink cCommentString cString HiLink cComment2String cString HiLink cCommentSkip cComment HiLink cString String HiLink cComment Comment HiLink cSpecial SpecialChar HiLink cTodo Todo HiLink cCppSkip cCppOut HiLink cCppOut2 cCppOut HiLink cCppOut Comment " added by Jonathan Sprinkle HiLink cScopeKeywords cType HiLink cAssignment cStatement delcommand HiLink endif let b:current_syntax = "c" " vim: ts=8