neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

chuck.vim (6861B)


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