Skip to content

Commit

Permalink
Added support for SuperCollider (#3371)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored Mar 21, 2022
1 parent dfef9b6 commit 1b1d673
Show file tree
Hide file tree
Showing 20 changed files with 460 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,11 @@
"title": "Stylus",
"owner": "vkbansal"
},
"supercollider": {
"title": "SuperCollider",
"alias": "sclang",
"owner": "RunDevelopment"
},
"swift": {
"title": "Swift",
"owner": "chrischares"
Expand Down
36 changes: 36 additions & 0 deletions components/prism-supercollider.js
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions components/prism-supercollider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions examples/prism-supercollider.html
Original file line number Diff line number Diff line change
@@ -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>
1 change: 1 addition & 0 deletions plugins/autoloader/prism-autoloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
"sol": "solidity",
"sln": "solution-file",
"rq": "sparql",
"sclang": "supercollider",
"t4": "t4-cs",
"trickle": "tremor",
"troy": "tremor",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -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#)",
Expand Down
Loading

0 comments on commit 1b1d673

Please sign in to comment.