From 6f04c23646c7bbdcda1683b0b85e1f7df06c753a Mon Sep 17 00:00:00 2001 From: Philip Nelson Date: Fri, 12 Jan 2024 17:27:30 -0800 Subject: [PATCH] Add initial support for SuperCollider --- book/src/generated/lang-support.md | 1 + languages.toml | 11 +++ runtime/queries/supercollider/folds.scm | 7 ++ runtime/queries/supercollider/highlights.scm | 76 ++++++++++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 runtime/queries/supercollider/folds.scm create mode 100644 runtime/queries/supercollider/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ddd480536dc35..f5b1aa01f2649 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -157,6 +157,7 @@ | sshclientconfig | ✓ | | | | | starlark | ✓ | ✓ | | | | strace | ✓ | | | | +| supercollider | ✓ | | | | | svelte | ✓ | | ✓ | `svelteserver` | | sway | ✓ | ✓ | ✓ | `forc` | | swift | ✓ | | | `sourcekit-lsp` | diff --git a/languages.toml b/languages.toml index 11afea0cad297..17e6c145d5d71 100644 --- a/languages.toml +++ b/languages.toml @@ -3061,3 +3061,14 @@ indent = { tab-width = 4, unit = " " } name = "tact" source = { git = "https://github.com/tact-lang/tree-sitter-tact", rev = "ec57ab29c86d632639726631fb2bb178d23e1c91" } +[[language]] +name = "supercollider" +scope = "source.supercollider" +injection-regex = "supercollider" +file-types = ["scd", "sc", "quark"] +comment-token = "//" +indent = { tab-width = 4, unit = "\t" } + +[[grammar]] +name = "supercollider" +source = { git = "https://github.com/madskjeldgaard/tree-sitter-supercollider", rev = "3b35bd0fded4423c8fb30e9585c7bacbcd0e8095" } diff --git a/runtime/queries/supercollider/folds.scm b/runtime/queries/supercollider/folds.scm new file mode 100644 index 0000000000000..214247bc0fb1c --- /dev/null +++ b/runtime/queries/supercollider/folds.scm @@ -0,0 +1,7 @@ +[ +(function_call) +(code_block) +(function_block) +(control_structure) +] @fold + diff --git a/runtime/queries/supercollider/highlights.scm b/runtime/queries/supercollider/highlights.scm new file mode 100644 index 0000000000000..0128606de7474 --- /dev/null +++ b/runtime/queries/supercollider/highlights.scm @@ -0,0 +1,76 @@ +(line_comment) @comment.line +(block_comment) @comment.block + +(argument name: (identifier) @variable.parameter) + +(local_var name: (identifier) @variable) +(environment_var name:(identifier) @variable.builtin) +(builtin_var) @constant.builtin + +(function_definition name: (variable) @function) + +(named_argument name: (identifier) @variable.other.member) + +(method_call name: (method_name) @function.method) + +(class) @keyword.storage.type + +(number) @constant.numeric +(float) @constant.numeric.float + +(string) @string +(symbol) @string.special.symbol + +[ +"&&" +"||" +"&" +"|" +"^" +"==" +"!=" +"<" +"<=" +">" +">=" +"<<" +">>" +"+" +"-" +"*" +"/" +"%" +"=" +"|@|" +"@@" +"@|@" +] @operator + +[ +"arg" +"classvar" +"const" +"var" +] @keyword + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "|" +] @punctuation.bracket + +[ + ";" + "." + "," +] @punctuation.delimiter + +(control_structure) @keyword.control.conditional + +(escape_sequence) @string.special + +(duplicated_statement) @keyword.control.repeat