Added support for SuperCollider (#3371)

This commit is contained in:
Michael Schmidt 2022-03-21 15:12:00 +01:00 committed by GitHub
parent dfef9b61ea
commit 1b1d6731ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 460 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -1302,6 +1302,11 @@
"title": "Stylus",
"owner": "vkbansal"
},
"supercollider": {
"title": "SuperCollider",
"alias": "sclang",
"owner": "RunDevelopment"
},
"swift": {
"title": "Swift",
"owner": "chrischares"

View File

@ -0,0 +1,36 @@
Prism.languages.supercollider = {
'comment': {
pattern: /\/\/.*|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//,
greedy: true
},
'string': {
pattern: /(^|[^\\])"(?:[^"\\]|\\[\s\S])*"/,
lookbehind: true,
greedy: true
},
'char': {
pattern: /\$(?:[^\\\r\n]|\\.)/,
greedy: true
},
'symbol': {
pattern: /(^|[^\\])'(?:[^'\\]|\\[\s\S])*'|\\\w+/,
lookbehind: true,
greedy: true
},
'keyword': /\b(?:_|arg|classvar|const|nil|var|while)\b/,
'boolean': /\b(?:false|true)\b/,
'label': {
pattern: /\b[a-z_]\w*(?=\s*:)/,
alias: 'property'
},
'number': /\b(?:inf|pi|0x[0-9a-fA-F]+|\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(?:pi)?|\d+r[0-9a-zA-Z]+(?:\.[0-9a-zA-Z]+)?|\d+[sb]{1,4}\d*)\b/,
'class-name': /\b[A-Z]\w*\b/,
'operator': /\.{2,3}|#(?![[{])|&&|[!=]==?|\+>>|\+{1,3}|-[->]|=>|>>|\?\?|@\|?@|\|(?:@|[!=]=)?\||!\?|<[!=>]|\*{1,2}|<{2,3}\*?|[-!%&/<>?@|=`]/,
'punctuation': /[{}()[\].:,;]|#[[{]/
};
Prism.languages.sclang = Prism.languages.supercollider;

1
components/prism-supercollider.min.js vendored Normal file
View File

@ -0,0 +1 @@
Prism.languages.supercollider={comment:{pattern:/\/\/.*|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//,greedy:!0},string:{pattern:/(^|[^\\])"(?:[^"\\]|\\[\s\S])*"/,lookbehind:!0,greedy:!0},char:{pattern:/\$(?:[^\\\r\n]|\\.)/,greedy:!0},symbol:{pattern:/(^|[^\\])'(?:[^'\\]|\\[\s\S])*'|\\\w+/,lookbehind:!0,greedy:!0},keyword:/\b(?:_|arg|classvar|const|nil|var|while)\b/,boolean:/\b(?:false|true)\b/,label:{pattern:/\b[a-z_]\w*(?=\s*:)/,alias:"property"},number:/\b(?:inf|pi|0x[0-9a-fA-F]+|\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(?:pi)?|\d+r[0-9a-zA-Z]+(?:\.[0-9a-zA-Z]+)?|\d+[sb]{1,4}\d*)\b/,"class-name":/\b[A-Z]\w*\b/,operator:/\.{2,3}|#(?![[{])|&&|[!=]==?|\+>>|\+{1,3}|-[->]|=>|>>|\?\?|@\|?@|\|(?:@|[!=]=)?\||!\?|<[!=>]|\*{1,2}|<{2,3}\*?|[-!%&/<>?@|=`]/,punctuation:/[{}()[\].:,;]|#[[{]/},Prism.languages.sclang=Prism.languages.supercollider;

View File

@ -0,0 +1,11 @@
<h2>Full Example</h2>
<pre><code>// Source: https://supercollider.github.io/
// modulate a sine frequency and a noise amplitude with another sine
// whose frequency depends on the horizontal mouse pointer position
{
var x = SinOsc.ar(MouseX.kr(1, 100));
SinOsc.ar(300 * x + 800, 0, 0.1)
+
PinkNoise.ar(0.1 * x + 0.1)
}.play;
</code></pre>

View File

@ -242,6 +242,7 @@
"sol": "solidity",
"sln": "solution-file",
"rq": "sparql",
"sclang": "supercollider",
"t4": "t4-cs",
"trickle": "tremor",
"troy": "tremor",

File diff suppressed because one or more lines are too long

View File

@ -228,6 +228,8 @@
"sqf": "SQF: Status Quo Function (Arma 3)",
"sql": "SQL",
"iecst": "Structured Text (IEC 61131-3)",
"supercollider": "SuperCollider",
"sclang": "SuperCollider",
"systemd": "Systemd configuration file",
"t4-templating": "T4 templating",
"t4-cs": "T4 Text Templates (C#)",

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
true
false
----------------------------------------------------
[
["boolean", "true"],
["boolean", "false"]
]

View File

@ -0,0 +1,29 @@
$A
$B
$C
$.
$$
$\t // tab (horizontal tab)
$\f // form feed
$\v // vertical tab
$\n // newline (linefeed)
$\r // return
$\\ // backslash`
----------------------------------------------------
[
["char", "$A"],
["char", "$B"],
["char", "$C"],
["char", "$."],
["char", "$$"],
["char", "$\\t"], ["comment", "// tab (horizontal tab)"],
["char", "$\\f"], ["comment", "// form feed"],
["char", "$\\v"], ["comment", "// vertical tab"],
["char", "$\\n"], ["comment", "// newline (linefeed)"],
["char", "$\\r"], ["comment", "// return"],
["char", "$\\\\"], ["comment", "// backslash`"]
]

View File

@ -0,0 +1,13 @@
Foo
SynthDef
Set[]
List[]
----------------------------------------------------
[
["class-name", "Foo"],
["class-name", "SynthDef"],
["class-name", "Set"], ["punctuation", "["], ["punctuation", "]"],
["class-name", "List"], ["punctuation", "["], ["punctuation", "]"]
]

View File

@ -0,0 +1,19 @@
// single line comment
/*
multi
line
comment
*/
/* Unlike C, you can have /* nested */ comments */
----------------------------------------------------
[
["comment", "// single line comment"],
["comment", "/*\r\n multi\r\n line\r\n comment\r\n*/"],
["comment", "/* Unlike C, you can have /* nested */ comments */"]
]

View File

@ -0,0 +1,19 @@
_
arg
classvar
const
nil
var
while
----------------------------------------------------
[
["keyword", "_"],
["keyword", "arg"],
["keyword", "classvar"],
["keyword", "const"],
["keyword", "nil"],
["keyword", "var"],
["keyword", "while"]
]

View File

@ -0,0 +1,16 @@
foo(a: 5, bar: 7)
----------------------------------------------------
[
"foo",
["punctuation", "("],
["label", "a"],
["punctuation", ":"],
["number", "5"],
["punctuation", ","],
["label", "bar"],
["punctuation", ":"],
["number", "7"],
["punctuation", ")"]
]

View File

@ -0,0 +1,145 @@
-13
666
2112
96
0xa // 10
-0xd // -13
0x29A // 666
0x840 // 2112
0x60 // 96
0.39
98.6
1.0
-0.5
1.2e4
1E-4
pi
2pi
0.5pi
-0.25pi
inf // and beyond!
-inf
16rF // 15
16ra9 // 169
36rZIGZAG // 2147341480
2r01101011
12r4a.abc // wrong
12r4a.ABC // works
12r4A.ABC // better
2s == 2.1 // scale degree two, sharp
2b == 1.9 // scale degree two, flat
2ss == 2.2 // scale degree two, double sharp
2bb == 1.8 // scale degree two, double flat
2ssss == 2.4
2bbbb == 1.6
-2s == -1.9
-2b == -2.1
-2ss == -1.8
-2bb == -2.2
2b50 == 1.95 // scale degree two, fifty cents flat
2s204 == 2.204 // scale degree two, 204 cents sharp
----------------------------------------------------
[
["operator", "-"], ["number", "13"],
["number", "666"],
["number", "2112"],
["number", "96"],
["number", "0xa"], ["comment", "// 10"],
["operator", "-"], ["number", "0xd"], ["comment", "// -13"],
["number", "0x29A"], ["comment", "// 666"],
["number", "0x840"], ["comment", "// 2112"],
["number", "0x60"], ["comment", "// 96"],
["number", "0.39"],
["number", "98.6"],
["number", "1.0"],
["operator", "-"], ["number", "0.5"],
["number", "1.2e4"],
["number", "1E-4"],
["number", "pi"],
["number", "2pi"],
["number", "0.5pi"],
["operator", "-"], ["number", "0.25pi"],
["number", "inf"], ["comment", "// and beyond!"],
["operator", "-"], ["number", "inf"],
["number", "16rF"], ["comment", "// 15"],
["number", "16ra9"], ["comment", "// 169"],
["number", "36rZIGZAG"], ["comment", "// 2147341480"],
["number", "2r01101011"],
["number", "12r4a.abc"], ["comment", "// wrong"],
["number", "12r4a.ABC"], ["comment", "// works"],
["number", "12r4A.ABC"], ["comment", "// better"],
["number", "2s"],
["operator", "=="],
["number", "2.1"],
["comment", "// scale degree two, sharp"],
["number", "2b"],
["operator", "=="],
["number", "1.9"],
["comment", "// scale degree two, flat"],
["number", "2ss"],
["operator", "=="],
["number", "2.2"],
["comment", "// scale degree two, double sharp"],
["number", "2bb"],
["operator", "=="],
["number", "1.8"],
["comment", "// scale degree two, double flat"],
["number", "2ssss"],
["operator", "=="],
["number", "2.4"],
["number", "2bbbb"],
["operator", "=="],
["number", "1.6"],
["operator", "-"],
["number", "2s"],
["operator", "=="],
["operator", "-"],
["number", "1.9"],
["operator", "-"],
["number", "2b"],
["operator", "=="],
["operator", "-"],
["number", "2.1"],
["operator", "-"],
["number", "2ss"],
["operator", "=="],
["operator", "-"],
["number", "1.8"],
["operator", "-"],
["number", "2bb"],
["operator", "=="],
["operator", "-"],
["number", "2.2"],
["number", "2b50"],
["operator", "=="],
["number", "1.95"],
["comment", "// scale degree two, fifty cents flat"],
["number", "2s204"],
["operator", "=="],
["number", "2.204"],
["comment", "// scale degree two, 204 cents sharp"]
]

View File

@ -0,0 +1,82 @@
+ - * / % **
& | << >> +>>
< <= > => == != === !==
|==| |!=|
&& ||
++ +++ @ @@ @|@ |@|
& | - --
<< <<* <<< <<<*
? ?? !?
! -> <! <>
.. ...
#
=
`
----------------------------------------------------
[
["operator", "+"],
["operator", "-"],
["operator", "*"],
["operator", "/"],
["operator", "%"],
["operator", "**"],
["operator", "&"],
["operator", "|"],
["operator", "<<"],
["operator", ">>"],
["operator", "+>>"],
["operator", "<"],
["operator", "<="],
["operator", ">"],
["operator", "=>"],
["operator", "=="],
["operator", "!="],
["operator", "==="],
["operator", "!=="],
["operator", "|==|"],
["operator", "|!=|"],
["operator", "&&"],
["operator", "||"],
["operator", "++"],
["operator", "+++"],
["operator", "@"],
["operator", "@@"],
["operator", "@|@"],
["operator", "|@|"],
["operator", "&"],
["operator", "|"],
["operator", "-"],
["operator", "--"],
["operator", "<<"],
["operator", "<<*"],
["operator", "<<<"],
["operator", "<<<*"],
["operator", "?"],
["operator", "??"],
["operator", "!?"],
["operator", "!"],
["operator", "->"],
["operator", "<!"],
["operator", "<>"],
["operator", ".."], ["operator", "..."],
["operator", "#"],
["operator", "="],
["operator", "`"]
]

View File

@ -0,0 +1,25 @@
( ) [ ] { }
, ; . :
#[ ] #{ }
----------------------------------------------------
[
["punctuation", "("],
["punctuation", ")"],
["punctuation", "["],
["punctuation", "]"],
["punctuation", "{"],
["punctuation", "}"],
["punctuation", ","],
["punctuation", ";"],
["punctuation", "."],
["punctuation", ":"],
["punctuation", "#["],
["punctuation", "]"],
["punctuation", "#{"],
["punctuation", "}"]
]

View File

@ -0,0 +1,17 @@
""
"foo"
"\""
"
f
o
o
"
----------------------------------------------------
[
["string", "\"\""],
["string", "\"foo\""],
["string", "\"\\\"\""],
["string", "\"\r\nf\r\no\r\no\r\n\""]
]

View File

@ -0,0 +1,27 @@
\x
\aiff
\Big_Swifty_And_Assoc
'x'
'aiff'
'BigSwiftyAndAssoc'
'nowhere here'
'somewhere there'
'.+o*o+.'
'\'symbol_within_a_symbol\''
----------------------------------------------------
[
["symbol", "\\x"],
["symbol", "\\aiff"],
["symbol", "\\Big_Swifty_And_Assoc"],
["symbol", "'x'"],
["symbol", "'aiff'"],
["symbol", "'BigSwiftyAndAssoc'"],
["symbol", "'nowhere here'"],
["symbol", "'somewhere there'"],
["symbol", "'.+o*o+.'"],
["symbol", "'\\'symbol_within_a_symbol\\''"]
]