3 " Maintained: Eduard Aylon <eduard.aylon@gmail.com>
4 " Last Change: 28/02/2006
7 " Adapted by Eduard Aylon <eduard.aylon@gmail.com> from the c.vim syntax file from Bram Moolenar <Bram@vim.org>
9 " NOTE: in order to obtain syntax highlighting in Chuck programs just follow the
10 " steps below or in case you don't have root privileges follow Graham Percival's tip :
11 " 1. copy this file into /usr/share/vim/vim62/syntax.
12 " 2. add the following line in /usr/share/vim/filetype.vim,
14 " au BufNewFile,BufRead *.ck setf ck
18 "Tip from Graham Percival:
19 " If you cannot write to /usr/share/ (lacking root privileges),
20 " enter these commands:
21 " $ echo "syntax on" >> ~/.vimrc
23 " $ mkdir ~/.vim/syntax
24 " $ cp ck.vim ~/.vim/syntax/
25 " $ echo "if exists(\"did_load_filetypes\")
28 " augroup filetypedetect
29 " au! BufNewFile,BufRead *.ck setf ck
30 " augroup END" >> ~/.vim/filetype.vim
35 " For version 5.x: Clear all syntax items
36 " For version 6.x: Quit when a syntax file was already loaded
39 elseif exists("b:current_syntax")
43 "catch errors caused by wrong parenthesis and brackets
44 " also accept <% for {, %> for }, <: for [ and :> for ] (C99)
45 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
46 if exists("c_no_bracket_error")
47 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString
48 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
49 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString
50 syn match cParenError display ")"
51 syn match cErrInParen display contained "[{}]\|<%\|%>"
53 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString
54 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
55 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString
56 syn match cParenError display "[\])]"
57 syn match cErrInParen display contained "[\]{}]\|<%\|%>"
58 syn region cBracket transparent start='\[\|<:' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString
59 " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
60 syn region cCppBracket transparent start='\[\|<:' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString
61 syn match cErrInBracket display contained "[);{}]\|<%\|%>"
66 if exists("c_no_cformat")
67 syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial
68 " cCppString: same as cString, but ends at end of line
69 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial
71 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
72 syn match cFormat display "%%" contained
73 syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat
74 " cCppString: same as cString, but ends at end of line
75 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat
79 if exists("c_comment_strings")
80 " A comment can contain cString, cCharacter and cNumber.
81 " But a "*/" inside a cString in a cComment DOES end the comment! So we
82 " need to use a special type of cString: cCommentString, which also ends on
83 " "*/", and sees a "*" at the start of the line as comment again.
84 " Unfortunately this doesn't very well work for // type of comments :-(
85 syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
86 syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
87 syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
88 syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError
89 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError
91 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError
92 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError
96 syn match ckNone "\w\+\.\w\+"
97 syn match ckNumber "\<0x\x\+[Ll]\=\>"
98 syn match ckNumber "\<\d\+[LljJ]\=\>"
99 syn match ckNumber "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
100 syn match ckNumber "\<\d\+\.\([eE][+-]\=\d\+\)\=[jJ]\=\>"
101 syn match ckNumber "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
105 syn keyword ckStatement new goto break return continue spork
106 syn keyword ckConditional if else switch
107 syn keyword ckLoop while for do until
108 syn keyword ckNow now
109 syn keyword ckType dur time Shred UGen Event Object
110 syn keyword cType int float string void
111 syn keyword ckAccess public protected private
112 syn keyword ckOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
113 syn match ckCast "\s*\$\s*\(int\|float\)\s"
114 syn keyword ckStructure class fun
115 syn keyword ckUgen gain noise impulse step phasor sinosc pulseosc triosc sqrosc sawosc halfrec fullrect zerox delayp sndbuf pan2
116 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
117 syn keyword ckBoolean true false
118 syn keyword ckShreds me machine
119 syn keyword ckInheritance subClass extends
120 syn keyword ckIO dac adc blackhole
121 syn keyword ckNetwork netin netout
122 syn keyword ckCommunication MidiIn MidiOut MidiMsg OSC_Recv OSC_Addr OSC_Send
123 syn keyword ckConstants pi
124 syn match ckOperator "\s*=\(>\|<\)\s*"
126 " The minimum and maximum operators in GNU C++
127 syn match cppMinMax "[<>]?"
129 " Default highlighting
130 if version >= 508 || !exists("did_cpp_syntax_inits")
132 let did_cpp_syntax_inits = 1
133 command -nargs=+ HiLink hi link <args>
135 command -nargs=+ HiLink hi def link <args>
138 HiLink ckCommunication Special
139 HiLink ckNetwork Special
140 HiLink cCommentL cComment
141 HiLink cCommentStart cComment
142 HiLink cComment Comment
143 HiLink cCppString cString
144 HiLink cString String
145 HiLink ckConditional Conditional
147 HiLink ckAccess ckStatement
150 HiLink ckStatement Statement
151 HiLink ckCast ckStatement
155 HiLink ckStructure Structure
156 HiLink ckOperator Operator
157 HiLink ckShreds ckStatement
158 HiLink ckInheritance ckStatement
159 HiLink ckBoolean Boolean
161 HiLink cParenError cError
162 HiLink cErrInBracket cError
163 HiLink cErrInParen cError
165 HiLink cCppParen cError
166 HiLink cBracket cError
167 HiLink cCppBracket cError
169 HiLink ckNumber Number
170 HiLink ckConstants Constant
175 let b:current_syntax = "ck"