Difference between revisions of "Ck.vim"

From CSWiki
Jump to: navigation, search
 
(now with +=>, ^=>, #(1,1), etc)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
" Vim syntax file
+
Last modified 30/10-07 by [[User:Gasten | Gasten]] for Chuck version 1.2.1.1. Please modify if it misses anything.
" Language: CHUCK
 
" Adapted by Eduard Aylon <eduard.aylon@gmail.com> from the c.vim syntax file from Bram Moolenar <Bram@vim.org>
 
  
" NOTE: in order to obtain syntax highlighting in Chuck programs just follow the
+
Vim-magic for automatic 1-space indenting on every line: :%s/^/\ /g
"      steps below or in case you don't have root privileges follow Graham Percival's tip :
 
" 1. copy this file into /usr/share/vim/vim62/syntax.
 
" 2. add the following line in /usr/share/vim/filetype.vim,
 
"     
 
" au BufNewFile,BufRead *.ck          setf ck
 
"
 
  
 
+
" Vim syntax file
"Tip from Graham Percival:
+
" Language: CHUCK
" If you cannot write to /usr/share/ (lacking root privileges),
+
  " Adapted by Eduard Aylon <eduard.aylon@gmail.com> from the c.vim syntax file from Bram Moolenar <Bram@vim.org>
    "   enter these commands:
+
    "    $ echo "syntax on" >> ~/.vimrc
+
" NOTE: in order to obtain syntax highlighting in Chuck programs just follow the
    "     $ mkdir ~/.vim
+
"       steps below or in case you don't have root privileges follow Graham Percival's tip :
    "    $ mkdir ~/.vim/syntax
+
" 1. copy this file into /usr/share/vim/vim62/syntax.
    "     $ cp ck.vim ~/.vim/syntax/
+
" 2. add the following line in /usr/share/vim/filetype.vim,
    "     $ echo "if exists(\"did_load_filetypes\")
+
"      
    "           finish
+
" au BufNewFile,BufRead *.ck         setf ck
    "        endif
+
"
    "        augroup filetypedetect
+
    "          au! BufNewFile,BufRead *.ck setf ck
+
    "         augroup END" >> ~/.vim/filetype.vim
+
"Tip from Graham Percival:
 
+
" If you cannot write to /usr/share/  (lacking root privileges),
 
+
    "  enter these commands:
 
+
    "    $ echo "syntax on" >> ~/.vimrc
 
+
    "     $ mkdir ~/.vim
" For version 5.x: Clear all syntax items
+
    "     $ mkdir ~/.vim/syntax
" For version 6.x: Quit when a syntax file was already loaded
+
    "     $ cp ck.vim ~/.vim/syntax/
if version < 600
+
    "    $ echo "if exists(\"did_load_filetypes\")
  syntax clear
+
    "          finish
elseif exists("b:current_syntax")
+
    "        endif
  finish
+
    "        augroup filetypedetect
endif
+
    "          au! BufNewFile,BufRead *.ck setf ck
 
+
    "          augroup END" >> ~/.vim/filetype.vim
"catch errors caused by wrong parenthesis and brackets
+
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
+
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
+
" For version 5.x: Clear all syntax items
  " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+
" For version 6.x: Quit when a syntax file was already loaded
  syn region    cCppParen      transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString
+
if version < 600
  syn match    cParenError    display ")"
+
  syntax clear
  syn match    cErrInParen    display contained "[{}]\|<%\|%>"
+
elseif exists("b:current_syntax")
else
+
  finish
  syn region    cParen          transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString
+
endif
  " 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
+
"catch errors caused by wrong parenthesis and brackets
  syn match    cParenError    display "[\])]"
+
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
  syn match    cErrInParen     display contained "[\]{}]\|<%\|%>"
+
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
  syn region    cBracket        transparent start='\[\|<:' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString
+
if exists("c_no_bracket_error")
  " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
+
  syn region    cParen          transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString
  syn region    cCppBracket    transparent start='\[\|<:' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString
+
  " cCppParen: same as cParen but ends at end-of-line; used in cDefine
  syn match    cErrInBracket  display contained "[);{}]\|<%\|%>"
+
  syn region    cCppParen      transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString
endif
+
  syn match    cParenError    display ")"
 
+
  syn match    cErrInParen     display contained "[{}]\|<%\|%>"
 
+
else
 
+
  syn region    cParen          transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString
if exists("c_no_cformat")
+
  " cCppParen: same as cParen but ends at end-of-line; used in cDefine
  syn region    cString        start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial
+
  syn region    cCppParen      transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString
  " cCppString: same as cString, but ends at end of line
+
  syn match    cParenError    display "[\])]"
  syn region    cCppString      start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial
+
  syn match    cErrInParen    display contained "[\]{}]\|<%\|%>"
else
+
  syn region    cBracket        transparent start='\[\|<:' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString
  syn match    cFormat        display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
+
  " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
  syn match    cFormat        display "%%" contained
+
  syn region    cCppBracket    transparent start='\[\|<:' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString
  syn region    cString         start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat
+
  syn match    cErrInBracket  display contained "[);{}]\|<%\|%>"
  " cCppString: same as cString, but ends at end of line
+
endif
  syn region    cCppString      start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat
+
endif
+
 
+
 
+
if exists("c_no_cformat")
if exists("c_comment_strings")
+
  syn region    cString        start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial
  " A comment can contain cString, cCharacter and cNumber.
+
  " cCppString: same as cString, but ends at end of line
  " But a "*/" inside a cString in a cComment DOES end the comment! So we
+
  syn region    cCppString      start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial
  " need to use a special type of cString: cCommentString, which also ends on
+
else
  " "*/", and sees a "*" at the start of the line as comment again.
+
  syn match    cFormat         display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
  " Unfortunately this doesn't very well work for // type of comments :-(
+
  syn match    cFormat        display "%%" contained
  syntax match  cCommentSkip   contained "^\s*\*\($\|\s\+\)"
+
  syn region    cString        start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat
  syntax region cCommentString  contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
+
  " cCppString: same as cString, but ends at end of line
  syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
+
  syn region    cCppString      start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat
  syntax region cCommentL      start="//" skip="\\$" end="$" keepend  contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError
+
endif
  syntax region cComment        matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError
+
else
+
   
  syn region   cCommentL      start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError
+
if exists("c_comment_strings")
  syn region    cComment        matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError
+
  " A comment can contain cString, cCharacter and cNumber.
endif
+
  " 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.
syn match ckNone                "\w\+\.\w\+"
+
  " Unfortunately this doesn't very well work for // type of comments :-(
syn match  ckNumber      "\<0x\x\+[Ll]\=\>"
+
  syntax match  cCommentSkip    contained "^\s*\*\($\|\s\+\)"
syn match  ckNumber      "\<\d\+[LljJ]\=\>"
+
  syntax region cCommentString  contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
syn match  ckNumber      "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
+
  syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
syn match  ckNumber      "\<\d\+\.\([eE][+-]\=\d\+\)\=[jJ]\=\>"
+
  syntax region cCommentL      start="\(//\|<--\)" skip="(//\|<--\)$" end="$" keepend  contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError
syn match  ckNumber      "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
+
  syntax region cComment        matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError
 
+
else
 
+
  syn region    cCommentL      start="\(//\|<--\)" skip="\(//\|<--\)$" end="$" keepend contains=@cCommentGroup,cSpaceError
" CHUCK extentions
+
  syn region    cComment        matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError
syn keyword ckStatement         new goto break return continue spork  
+
endif
syn keyword ckConditional      if else switch
+
syn keyword ckLoop while for do until
+
syn keyword ckNow              now  
+
syn match ckNone                "\w\+\.\w\+"
syn keyword ckType              dur time Shred UGen Event Object  
+
syn match  ckNumber      "\<0x\x\+[Ll]\=\>"
syn keyword cType              int float string void
+
syn match  ckNumber      "\<\d\+[LljJ]\=\>"
syn keyword ckAccess public protected private
+
syn match  ckNumber      "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
syn keyword ckOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
+
syn match  ckNumber      "\<\d\+\.\([eE][+-]\=\d\+\)\=[jJ]\=\>"
syn match ckCast               "\s*\$\s*\(int\|float\)\s"
+
syn match  ckNumber      "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
syn keyword ckStructure         class fun  
+
syn keyword ckUgen gain noise impulse step phasor sinosc pulseosc triosc sqrosc sawosc halfrec fullrect zerox delayp sndbuf pan2      
+
syn keyword ckSDK              bandedWG blowbotl BlowHole Bowed Brass Clarinet Flute Mandolin ModalBar Moog Saxofony Shakers Sitar StifKarp VoicForm FM BeeThree FMVoices HevyMetl PercFlut Rhodey TubeBell Wurley Delay DelayA DelayL Echo Envelope ADSR biquad Filter OnePole TwoPole OneZero TwoZero PoleZero JCRev NRev PRCRev Chorus Modulate PitShift SubNoise WvIn WvOut WaveLoop
+
" CHUCK extentions
syn keyword ckBoolean true false
+
syn keyword ckStatement         new goto break return continue spork  
syn keyword ckShreds            me machine
+
syn keyword ckConditional      if else switch
syn keyword ckInheritance      subClass extends  
+
syn keyword ckLoop while for do until
syn keyword ckIO                dac adc blackhole  
+
syn keyword ckNow              now  
syn keyword ckNetwork          netin netout
+
syn keyword ckType              dur time complex polar Shred UGen Event Object
syn keyword ckCommunication    MidiIn MidiOut MidiMsg OSC_Recv OSC_Addr OSC_Send
+
syn keyword cType              int float string void
syn keyword ckConstants pi
+
syn match  ckComplexPolar      "\(%\|#\)\ze(" " \ze means end the match here
syn match  ckOperator          "\s*=\(>\|<\)\s*"           
+
syn keyword ckAccess public protected private
 
+
syn keyword ckOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
" The minimum and maximum operators in GNU C++
+
syn match   ckCast             "\s*\$\s*\(int\|float\|polar\|complex\)\ze\(\s\|,\)"
syn match cppMinMax "[<>]?"
+
syn keyword ckStructure         class fun  
 
+
syn keyword ckUgen Gain Noise Impulse Step Phasor SinOsc PulseOsc TriOsc SqrOsc SawOsc Halfrec Fullrect Zerox Delayp SndBuf Pan2      
" Default highlighting
+
syn keyword ckSDK              bandedWG blowbotl BlowHole Bowed Brass Clarinet Flute Mandolin ModalBar Moog Saxofony Shakers Sitar StifKarp VoicForm FM BeeThree FMVoices HevyMetl PercFlut Rhodey TubeBell Wurley Delay DelayA DelayL Echo Envelope ADSR BiQuad Filter FilterBasic OnePole TwoPole OneZero TwoZero PoleZero LPF HPF BPF BRF JCRev NRev PRCRev ResonZ Chorus Modulate PitShift SubNoise WvIn WvOut WaveLoop
if version >= 508 || !exists("did_cpp_syntax_inits")
+
syn keyword ckUAna              UAna UAnaBlob Windowing FFT IFFT DCT IDCT Centroid Flux RMS RollOff
  if version < 508
+
syn keyword ckBoolean true false
    let did_cpp_syntax_inits = 1
+
syn keyword ckShreds            me machine
    command -nargs=+ HiLink hi link <args>
+
syn keyword ckInheritance      subClass extends  
  else
+
syn keyword ckIO                dac adc blackhole  
    command -nargs=+ HiLink hi def link <args>
+
syn keyword ckNetwork          NetIn NetOut
  endif
+
syn keyword ckCommunication    MidiIn MidiOut MidiMsg OSC_Recv OSC_Addr OSC_Send
 
+
syn keyword ckConstants pi
  HiLink ckCommunication        Special
+
syn match  ckOperator          "\s*\(+\|-\|/\|*\|\s*\)=\(>\|<\|\^\)\s*"           
  HiLink ckNetwork              Special
+
  HiLink cCommentL cComment
+
" The minimum and maximum operators in GNU C++
  HiLink cCommentStart cComment
+
syn match cppMinMax "[<>]?"
  HiLink cComment Comment
+
  HiLink cCppString            cString
+
" Default highlighting
  HiLink cString String
+
if version >= 508 || !exists("did_cpp_syntax_inits")
  HiLink ckConditional          Conditional
+
  if version < 508
  HiLink ckLoop Repeat
+
    let did_cpp_syntax_inits = 1
  HiLink ckAccess ckStatement
+
    command -nargs=+ HiLink hi link <args>
  HiLink ckUgen                ckType
+
  else
  HiLink ckSDK                  ckType
+
    command -nargs=+ HiLink hi def link <args>
  HiLink ckStatement Statement
+
  endif
  HiLink ckCast ckStatement
+
  HiLink ckNow Special
+
  HiLink ckCommunication        Special
  HiLink ckType         Type
+
  HiLink ckNetwork              Special
  HiLink cType         Type
+
  HiLink cCommentL cComment
  HiLink ckStructure Structure
+
  HiLink cCommentStart cComment
  HiLink ckOperator Operator
+
  HiLink cComment Comment
  HiLink ckShreds ckStatement
+
  HiLink cCppString            cString
  HiLink ckInheritance ckStatement
+
  HiLink cString String
  HiLink ckBoolean Boolean
+
  HiLink ckConditional          Conditional
  HiLink ckIO Include
+
  HiLink ckLoop Repeat
  HiLink cParenError cError
+
  HiLink ckAccess ckStatement
  HiLink cErrInBracket cError
+
  HiLink ckUgen                ckType
  HiLink cErrInParen cError
+
  HiLink ckSDK                  ckType
  HiLink cParen cError
+
  HiLink ckUAna                ckType
  HiLink cCppParen cError
+
  HiLink ckStatement Statement
  HiLink cBracket   cError
+
  HiLink ckCast ckStatement
  HiLink cCppBracket   cError
+
  HiLink ckComplexPolar        CkStatement
  HiLink cError Error
+
  HiLink ckNow Special
  HiLink ckNumber Number
+
  HiLink ckType         Type
  HiLink ckConstants Constant
+
  HiLink cType         Type
 
+
  HiLink ckStructure Structure
  delcommand HiLink
+
  HiLink ckOperator Operator
endif
+
  HiLink ckShreds ckStatement
 
+
  HiLink ckInheritance ckStatement
let b:current_syntax = "ck"
+
  HiLink ckBoolean Boolean
 
+
  HiLink ckIO Include
" vim: ts=8
+
  HiLink cParenError cError
 +
  HiLink cErrInBracket cError
 +
  HiLink cErrInParen cError
 +
  HiLink cParen cError
 +
  HiLink cCppParen cError
 +
  HiLink cBracket   cError
 +
  HiLink cCppBracket   cError
 +
  HiLink cError Error
 +
  HiLink ckNumber Number
 +
  HiLink ckConstants Constant
 +
 
 +
  delcommand HiLink
 +
endif
 +
 +
let b:current_syntax = "ck"
 +
 +
" vim: ts=8 nowrap

Latest revision as of 10:56, 30 October 2007

Last modified 30/10-07 by Gasten for Chuck version 1.2.1.1. Please modify if it misses anything.

Vim-magic for automatic 1-space indenting on every line: :%s/^/\ /g

" Vim syntax file
" Language:	CHUCK
" Adapted by Eduard Aylon <eduard.aylon@gmail.com> from the c.vim syntax file from Bram Moolenar <Bram@vim.org>

" NOTE: in order to obtain syntax highlighting in Chuck programs just follow the
"       steps below or in case you don't have root privileges follow Graham Percival's tip : 
"	1. copy this file into /usr/share/vim/vim62/syntax.
"	2. add the following line in /usr/share/vim/filetype.vim, 
"       
"		au BufNewFile,BufRead *.ck          setf ck
"		


"Tip from Graham Percival:
" If you cannot write to /usr/share/  (lacking root privileges),
    "   enter these commands:
    "     $ echo "syntax on" >> ~/.vimrc
    "     $ mkdir ~/.vim
    "     $ mkdir ~/.vim/syntax
    "     $ cp ck.vim ~/.vim/syntax/
    "     $ echo "if exists(\"did_load_filetypes\")
    "           finish
    "         endif
    "         augroup filetypedetect
    "          au! BufNewFile,BufRead *.ck setf ck
    "          augroup END" >> ~/.vim/filetype.vim




" 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

"catch errors caused by wrong parenthesis and brackets
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
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
  " 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
  syn match     cParenError     display ")"
  syn match     cErrInParen     display contained "[{}]\|<%\|%>"
else
  syn region    cParen          transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString
  " 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
  syn match     cParenError     display "[\])]"
  syn match     cErrInParen     display contained "[\]{}]\|<%\|%>"
  syn region    cBracket        transparent start='\[\|<:' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString
  " 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
  syn match     cErrInBracket   display contained "[);{}]\|<%\|%>"
endif



if exists("c_no_cformat")
  syn region    cString         start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial
  " cCppString: same as cString, but ends at end of line
  syn region    cCppString      start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial
else
  syn match     cFormat         display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
  syn match     cFormat         display "%%" contained
  syn region    cString         start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat
  " cCppString: same as cString, but ends at end of line
  syn region    cCppString      start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat
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\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
  syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
  syntax region cCommentL       start="\(//\|<--\)" skip="(//\|<--\)$" end="$" keepend  contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError
  syntax region cComment        matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError
else
  syn region    cCommentL       start="\(//\|<--\)" skip="\(//\|<--\)$" end="$" keepend contains=@cCommentGroup,cSpaceError
  syn region    cComment        matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError
endif


syn match ckNone                "\w\+\.\w\+"
syn match   ckNumber      "\<0x\x\+[Ll]\=\>"
syn match   ckNumber      "\<\d\+[LljJ]\=\>"
syn match   ckNumber      "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
syn match   ckNumber      "\<\d\+\.\([eE][+-]\=\d\+\)\=[jJ]\=\>"
syn match   ckNumber      "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"


" CHUCK extentions
syn keyword ckStatement	        new goto break return continue spork 
syn keyword ckConditional       if else switch
syn keyword ckLoop		while for do until
syn keyword ckNow               now 
syn keyword ckType              dur time complex polar Shred UGen Event Object
syn keyword cType               int float string void
syn match   ckComplexPolar      "\(%\|#\)\ze(" " \ze means end the match here
syn keyword ckAccess		public protected private
syn keyword ckOperator		and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
syn match   ckCast              "\s*\$\s*\(int\|float\|polar\|complex\)\ze\(\s\|,\)"
syn keyword ckStructure	        class fun 
syn keyword ckUgen		Gain Noise Impulse Step Phasor SinOsc PulseOsc TriOsc SqrOsc SawOsc Halfrec Fullrect Zerox Delayp SndBuf Pan2      
syn keyword ckSDK               bandedWG blowbotl BlowHole Bowed Brass Clarinet Flute Mandolin ModalBar Moog Saxofony Shakers Sitar StifKarp VoicForm FM BeeThree FMVoices HevyMetl PercFlut Rhodey TubeBell Wurley Delay DelayA DelayL Echo Envelope ADSR BiQuad Filter FilterBasic OnePole TwoPole OneZero TwoZero PoleZero LPF HPF BPF BRF JCRev NRev PRCRev ResonZ Chorus Modulate PitShift SubNoise WvIn WvOut WaveLoop
syn keyword ckUAna              UAna UAnaBlob Windowing FFT IFFT DCT IDCT Centroid Flux RMS RollOff
syn keyword ckBoolean		true false
syn keyword ckShreds            me machine
syn keyword ckInheritance       subClass extends 
syn keyword ckIO                dac adc blackhole 
syn keyword ckNetwork           NetIn NetOut
syn keyword ckCommunication     MidiIn MidiOut MidiMsg OSC_Recv OSC_Addr OSC_Send
syn keyword ckConstants 	pi
syn match   ckOperator          "\s*\(+\|-\|/\|*\|\s*\)=\(>\|<\|\^\)\s*"          

" The minimum and maximum operators in GNU C++
syn match cppMinMax "[<>]?"

" Default highlighting
if version >= 508 || !exists("did_cpp_syntax_inits")
  if version < 508
    let did_cpp_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink ckCommunication        Special
  HiLink ckNetwork              Special
  HiLink cCommentL		cComment
  HiLink cCommentStart		cComment
  HiLink cComment 		Comment
  HiLink cCppString             cString
  HiLink cString		String
  HiLink ckConditional          Conditional
  HiLink ckLoop			Repeat
  HiLink ckAccess		ckStatement
  HiLink ckUgen                 ckType
  HiLink ckSDK                  ckType
  HiLink ckUAna                 ckType
  HiLink ckStatement		Statement
  HiLink ckCast 		ckStatement
  HiLink ckComplexPolar         CkStatement
  HiLink ckNow			Special
  HiLink ckType		        Type
  HiLink cType		        Type
  HiLink ckStructure		Structure
  HiLink ckOperator		Operator	
  HiLink ckShreds		ckStatement
  HiLink ckInheritance		ckStatement
  HiLink ckBoolean		Boolean
  HiLink ckIO			Include
  HiLink cParenError		cError
  HiLink cErrInBracket		cError
  HiLink cErrInParen		cError
  HiLink cParen			cError
  HiLink cCppParen		cError
  HiLink cBracket	  	cError
  HiLink cCppBracket	  	cError
  HiLink cError			Error
  HiLink ckNumber		Number
  HiLink ckConstants		Constant
  
  delcommand HiLink
endif

let b:current_syntax = "ck"

" vim: ts=8 nowrap