-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathsupercollider.vim
141 lines (124 loc) · 5.02 KB
/
supercollider.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
" Copyright 2007 Alex Norman
" This file is part of SCVIM.
"
" SCVIM is free software: you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation, either version 3 of the License, or
" (at your option) any later version.
"
" SCVIM is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with SCVIM. If not, see <http://www.gnu.org/licenses/>.
"
" Vim syntax file
" Language: supercollider
" Maintainer: Stephen Lumenta <[email protected]>
" Version: 0.2
" Last change: 2012-03-31
"
" Maintainer: David Granström <[email protected]>
" Version: 0.3
" Modified: 2018-01-06
scriptencoding utf-8
if exists('b:current_syntax')
finish
endif
let b:current_syntax = 'supercollider'
syn clear
" source generated syntax file
let classes = luaeval('require("scnvim.path").get_asset "syntax"')
if filereadable(classes)
execute "source " . classes
endif
syn match scAoperator "{"
syn match scAoperator "}"
"syn match scVariable "\%(var.*\)\@<=\(\l\w*\)" "lowercase followed by wordchar
syn match scGlobvariable "\~\l\w*" "~ followed by lowercase followed by wordchar
syn match scVar "\s*var\s"
syn match scVar "\s*classvar\s"
syn match scVar "\s*const\s"
syn match scArg "\s*arg\s"
" symbols, strings, numbers
syn match scSymbol "\v(\w|\\)@<!\'.{-}(\\)@<!\'" "\{-} is a non greedy version of *
syn match scSymbol "\v\$@<!\\\w\w*"
syn match scSymbol "\\\\"
syn match scSymbol "\w\+:"
syn region scString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match scChar "\$\\\?."
syn match scInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>" display
syn match scInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display
syn match scInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>" display
syn match scInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>" display
syn match scFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display
syn match scFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display
syn match scInfinity "\W\@<=inf\W\@="
" keywords
syn match scControl "\<\%(break\|rescue\|return\)\>[?!]\@!"
syn match scKeyword "\<\%(super\|this\|new\|yield\)\>[?!]\@!"
syn match scBoolean "\<\%(true\|false\)\>[?!]\@!"
syn match scControl "\<\%(case\|begin\|do\|forBy\|loop\|if\|while\|else\)\>[?!]\@!"
" scsynth
syn match scArate "\v\.@<=ar(\w)@!"
syn match scKrate "\v\.@<=kr(\w)@!"
" operators
syn keyword scUnaryoperator neg reciprocal abs floor ceil frac sign squared cubed sqrt exp midicps cpsmidi midiratio ratiomidi dbamp ampdb octcps cpsoct log log2 log10 sin cos tan asin acos atan sinh cosh tanh distort softclip isPositive isNegative isStrictlyPositive
syn keyword scBinaryoperator min max round trunc atan2 hypot hypotApx ring1 ring2 ring3 ring4 sumsqr difsqr sqrsum sqrdif absdif thresh amclip scaleneg clip2 wrap2 fold2 excess + - * _
syn match scBinaryoperator "+"
syn match scBinaryoperator "-"
syn match scBinaryoperator "*"
syn match scBinaryoperator "/"
syn match scBinaryoperator "%"
syn match scBinaryoperator "\*\*"
syn match scBinaryoperator "<"
syn match scBinaryoperator "<="
syn match scBinaryoperator ">"
syn match scBinaryoperator "<>"
syn match scBinaryoperator ">="
syn match scBinaryoperator "="
syn match scBinaryoperator "=="
syn match scBinaryoperator "==="
syn match scBinaryoperator "!="
syn match scBinaryoperator "!=="
syn match scBinaryoperator "&"
syn match scBinaryoperator "|"
syn match scBinaryoperator "<!"
syn match scBinaryoperator "?"
syn match scBinaryoperator "??"
syn match scBinaryoperator "!?"
syn match scBinaryoperator "!"
syn match scBinaryoperator "#"
syn match scBinaryoperator "\.\."
syn match scBinaryoperator "\.\.\."
syn match scBinaryoperator "`"
syn match scBinaryoperator ":"
" comments
syn keyword scCommentTodo TODO FIXME XXX TBD contained
syn match scLineComment "\/\/.*" contains=@Spell,scCommentTodo
syn region scComment start="/\*" end="\*/" contains=@Spell,scCommentTodo
"""""""""""""""""""""""""""""""""""""""""
" linkage
hi def link scObject Identifier
hi def link scBinaryoperator Special
hi def link scUnaryoperator Special
hi def link scAoperator Statement
hi def link scArate Statement
hi def link scKrate Statement
hi def link scSymbol Constant
hi def link scString String
hi def link scChar String
hi def link scInteger Number
hi def link scInfinity Number
hi def link scFloat Float
hi def link scGlobVariable Define
hi def link scComment Comment
hi def link scLineComment Comment
hi def link scCommentTodo Todo
hi def link scVar Type
hi def link scArg Type
hi def link scControl Statement
hi def link scKeyword Keyword
hi def link scBoolean Boolean