blob: 6fcf40ca8be38cb0003d6ef2b038d8efbe0697ba [file] [log] [blame]
Andrea C from The App3b2c2742024-01-22 20:10:42 +01001" Vim syntax file
2" Language: ChucK
3" Maintainer: Andrea Callea
4" URL: https://github.com/gacallea/chuck.vim
5" Last Change: 2024 Jan 21 by Andrea Callea
6
7" Sources used for this syntax
8" https://chuck.cs.princeton.edu/doc/language/
9" https://chuck.cs.princeton.edu/doc/reference/
10
11" HISTORY:
12" 2024 Jan 21 - Initial revision
13
14" quit when a syntax file was already loaded
15if exists("b:current_syntax")
16 finish
17endif
18
19" https://chuck.cs.princeton.edu/doc/language/type.html
20syn keyword chuckPrimitiveType int float time dur void vec3 vec4
21syn keyword chuckComplexType complex polar
22syn keyword chuckReferenceType Object Event UGen array string
23syn keyword chuckBoolean true false maybe
24syn keyword chuckBoolean null NULL
25
26" https://chuck.cs.princeton.edu/doc/language/oper.html
27syn match chuckOperator "=>"
28syn match chuckOperator "@=>"
29
30syn match chuckOperator "=^"
31
32syn match chuckOperator "+"
33syn match chuckOperator "-"
34syn match chuckOperator "*"
35syn match chuckOperator "/"
36syn match chuckOperator "%"
37syn match chuckOperator "!"
38syn match chuckOperator "&"
39syn match chuckOperator "|"
40syn match chuckOperator "\^"
41
42syn match chuckOperator "+=>"
43syn match chuckOperator "-=>"
44syn match chuckOperator "*=>"
45syn match chuckOperator "/=>"
46syn match chuckOperator "%=>"
47syn match chuckOperator "!=>"
48syn match chuckOperator "&=>"
49syn match chuckOperator "|=>"
50syn match chuckOperator "\^=>"
51
52syn match chuckOperator "&&"
53syn match chuckOperator "||"
54syn match chuckOperator "=="
55syn match chuckOperator "!="
56syn match chuckOperator ">"
57syn match chuckOperator ">="
58syn match chuckOperator "<"
59syn match chuckOperator "<="
60
61syn match chuckOperator ">>"
62syn match chuckOperator "<<"
63
64syn match chuckOperator "++"
65syn match chuckOperator "--"
66syn match chuckOperator "<<<"
67syn match chuckOperator ">>>"
68
69syn keyword chuckOperator new
70
71" https://chuck.cs.princeton.edu/doc/language/ctrl.html
72syn keyword chuckConditional if else
73syn keyword chuckRepeat while do until for each
74
75" https://chuck.cs.princeton.edu/doc/language/time.html
76syn keyword chuckTimeAndDuration samp ms second minute hour day week
77syn keyword chuckTimeAndDuration now later
78
79" these may need some additional keywords I missed, for a future revision
80syn keyword chuckKeyword dac adc
81syn keyword chuckKeyword fun function
82syn keyword chuckKeyword return
83syn keyword chuckKeyword const
84syn match chuckKeyword "@"
85syn keyword chuckKeyword pi
86syn keyword chuckKeyword me
87syn keyword chuckKeyword repeat break continue
88syn keyword chuckKeyword class extends public private static pure this
89syn keyword chuckKeyword spork
90syn keyword chuckKeyword cherr chout
91
92" https://chuck.cs.princeton.edu/doc/reference/
93syn keyword chuckBaseClasses Shred Math Machine Std
94
95" https://chuck.cs.princeton.edu/doc/reference/
96syn keyword chuckBasicUGen Gain Impulse Step SndBuf SndBuf2
97syn keyword chuckBasicUGen ADSR Envelope Delay DelayL DelayA Echo
98syn keyword chuckBasicUGen Noise CNoise Osc SinOsc TriOsc SawOsc PulseOsc SqrOsc
99syn keyword chuckBasicUGen Phasor HalfRect FullRect
100syn keyword chuckBasicUGen Chugraph Chugen UGen_Multi UGen_Stereo Mix2 Pan2
101
102" https://chuck.cs.princeton.edu/doc/reference/
103syn keyword chuckFilterUGen FilterBasic LPF HPF BPF BRF BiQuad ResonZ
104syn keyword chuckFilterUGen OnePole OneZero TwoPole TwoZero PoleZero
105
106" https://chuck.cs.princeton.edu/doc/reference/
107syn keyword chuckSTKUGen JCRev NRev PRCRev
108syn keyword chuckSTKUGen Chorus Modulate PitShift SubNoise
109syn keyword chuckSTKUGen BLT Blit BlitSaw BlitSquare FilterStk
110syn keyword chuckSTKUGen WvIn WaveLoop WvOut WvOut2 StkInstrument
111syn keyword chuckSTKUGen BandedWG BlowBotl BlowHole
112syn keyword chuckSTKUGen Bowed Brass Clarinet Flute Mandolin
113syn keyword chuckSTKUGen ModalBar Moog Saxofony Shakers Sitar StifKarp
114syn keyword chuckSTKUGen VoicForm KrstlChr FM BeeThree FMVoices
115syn keyword chuckSTKUGen HevyMetl HnkyTonk FrencHrn PercFlut Rhodey TubeBell Wurley
116
117" https://chuck.cs.princeton.edu/doc/reference/
118syn keyword chuckAdvancedUGen LiSa LiSa2 LiSa6 LiSa8 LiSa10
119syn keyword chuckAdvancedUGen LiSa16 GenX Gen5 Gen7 Gen9 Gen10 Gen17
120syn keyword chuckAdvancedUGen CurveTable WarpTable Dyno
121
122" https://chuck.cs.princeton.edu/doc/reference/
123syn keyword chuckChugin ABSaturator AmbPan3 Bitcrusher Elliptic ExpDelay ExpEnv FIR
124syn keyword chuckChugin FoldbackSaturator GVerb KasFilter MagicSine Mesh2D
125syn keyword chuckChugin Multicomb Pan4 Pan8 Pan16 PitchTrack PowerADSR RegEx
126syn keyword chuckChugin Sigmund Spectacle WinFuncEnv WPDiodeLadder WPKorg35
127
128" https://chuck.cs.princeton.edu/doc/reference/
129syn keyword chuckUnitAnalyzer UAna UAnaBlob Windowing
130syn keyword chuckUnitAnalyzer FFT IFFT DCT IDCT
131syn keyword chuckUnitAnalyzer Centroid Flux RMS RollOff
132syn keyword chuckUnitAnalyzer Flip UnFlip XCorr
133syn keyword chuckUnitAnalyzer Chroma Kurtosis MFCC SFM ZeroX AutoCorr FeatureCollector
134
135" https://chuck.cs.princeton.edu/doc/reference/
136syn keyword chuckChAI MLP KNN KNN2 HMM SVM Word2Vec PCA Wekinator AI
137
138" https://chuck.cs.princeton.edu/doc/reference/
139syn keyword chuckInputOutput IO FileIO OscIn OscOut OscMsg
140syn keyword chuckInputOutput Hid HidMsg KBHit SerialIO
141syn keyword chuckInputOutput MidiIn MidiOut MidiMsg MidiFileIn
142
143" https://chuck.cs.princeton.edu/doc/reference/
144syn keyword chuckUtilities CKDoc StringTokenizer ConsoleInput
145
146" https://github.com/wilsaj/chuck.vim/blob/master/syntax/chuck.vim
147syn match chuckNumber /\%(\i\|\$\)\@<![-]\?\d\+/ display
148syn match chuckHex /\<0[xX]\x\+[lL]\=\>/ display
149syn match chuckFloat /\%(\i\|\$\)\@<![-]\?\%(\d*\.\d\+\|\d\+\.\)/ display
150
151" this may need fixing/improvements
152syn match chuckComment "//.*$"
153syn region chuckComment start="/\*" end="\*/"
154syn match chuckSpecialChar contained "\\n"
155syn match chuckSpecialChar contained "\\t"
156syn match chuckSpecialChar contained "\\a"
157syn match chuckSpecialChar contained /\\"/
158syn match chuckSpecialChar contained "\\0"
159syn region chuckString start=/"/ end=/"/ display contains=chuckSpecialChar
160
161hi def link chuckPrimitiveType Type
162hi def link chuckComplexType Type
163hi def link chuckReferenceType Type
164hi def link chuckBoolean Boolean
165hi def link chuckOperator Operator
166hi def link chuckConditional Conditional
167hi def link chuckRepeat Repeat
168hi def link chuckTimeAndDuration Keyword
169hi def link chuckKeyword Keyword
170hi def link chuckBaseClasses Special
171hi def link chuckBasicUGen Structure
172hi def link chuckFilterUGen Structure
173hi def link chuckSTKUGen Structure
174hi def link chuckAdvancedUGen Structure
175hi def link chuckChugin Structure
176hi def link chuckUnitAnalyzer Structure
177hi def link chuckChAI Structure
178hi def link chuckInputOutput Special
179hi def link chuckUtilities Special
180hi def link chuckNumber Number
181hi def link chuckHex Number
182hi def link chuckFloat Float
183hi def link chuckComment Comment
184hi def link chuckSpecialChar SpecialChar
185hi def link chuckString String
186
187let b:current_syntax = "chuck"