diff options
| author | Mads Kjeldgaard <mail@madskjeldgaard.dk> | 2021-02-02 18:58:07 +0100 |
|---|---|---|
| committer | Thomas Vigouroux <tomvig38@gmail.com> | 2021-02-10 22:21:17 +0100 |
| commit | 1f7db485231b79f5f95b6464b70bdc55c63f84ff (patch) | |
| tree | a1e3e18cbff740be1f2ba702ee91e1d2732c94a1 /queries/supercollider | |
| parent | Add supercollider parser to list of parsers (diff) | |
| download | nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.tar nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.tar.gz nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.tar.bz2 nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.tar.lz nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.tar.xz nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.tar.zst nvim-treesitter-1f7db485231b79f5f95b6464b70bdc55c63f84ff.zip | |
Add supercollider support
Diffstat (limited to 'queries/supercollider')
| -rw-r--r-- | queries/supercollider/folds.scm | 7 | ||||
| -rw-r--r-- | queries/supercollider/highlights.scm | 109 | ||||
| -rw-r--r-- | queries/supercollider/indents.scm | 16 | ||||
| -rw-r--r-- | queries/supercollider/locals.scm | 36 |
4 files changed, 168 insertions, 0 deletions
diff --git a/queries/supercollider/folds.scm b/queries/supercollider/folds.scm new file mode 100644 index 000000000..214247bc0 --- /dev/null +++ b/queries/supercollider/folds.scm @@ -0,0 +1,7 @@ +[ +(function_call) +(code_block) +(function_block) +(control_structure) +] @fold + diff --git a/queries/supercollider/highlights.scm b/queries/supercollider/highlights.scm new file mode 100644 index 000000000..c5c3f7502 --- /dev/null +++ b/queries/supercollider/highlights.scm @@ -0,0 +1,109 @@ +; highlights.scm +; See this for full list: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md + +; comments +(line_comment) @comment +(block_comment) @comment + +; Argument definition + +; Fixme: Should be attribute but nvim-treesitter doesn't supprt it at the moment +(argument name: (identifier) @parameter) +;(argument name: (identifier) @parameter) + +; Variables +(local_var name: (identifier) @variable) +(environment_var name:(identifier) @variable.builtin) +(builtin_var) @constant.builtin + +; (variable) @variable + +; Functions +(function_definition + name: (variable) @function) + +; For function calls +(named_argument + name: (identifier) @property) + +; Methods +(instance_method_call + name: (method_name) @function) +(class_method_call + name: (class_method_name) @method) + +; Classes +(class) @type + +; Literals +(number) @number +(pi_statement) @constant.builtin +(float) @float + +(string) @string +(symbol) @string.special + +; Operators +[ +"&&" +"||" +"&" +"|" +"^" +"==" +"!=" +"<" +"<=" +">" +">=" +"<<" +">>" +"+" +"-" +"*" +"/" +"%" +"=" +] @operator + + +; Keywords +[ +"arg" +"classvar" +; "const" +; "super" +; "this" +"var" +] @type.builtin + +; Brackets +[ + "(" + ")" + "[" + "]" + "{" + "}" + "|" +] @punctuation.bracket + +; Delimeters +[ + ";" + "." + "," +] @punctuation.delimiter + +; control structure +(control_structure) @conditional + +(escape_sequence) @escape + +; SinOsc.ar()!2 +(duplicated_statement) @repeat + +; Builtins +; ((identifier) @variable.builtin +; (#match? @variable.builtin "^(inf|nil|thisFunction|thisFunctionDef|thisMethod|thisProcess|thisThread|currentEnvironment|topEnvironment)$") +; (#is-not? local)) diff --git a/queries/supercollider/indents.scm b/queries/supercollider/indents.scm new file mode 100644 index 000000000..2f24df028 --- /dev/null +++ b/queries/supercollider/indents.scm @@ -0,0 +1,16 @@ +[ + (collection) + (parameter_call_list) + (function_block) + (code_block) +] @indent + +[ + (parameter_call_list (argument_calls)) + "(" + ")" + "{" + "}" + "[" + "]" +] @branch diff --git a/queries/supercollider/locals.scm b/queries/supercollider/locals.scm new file mode 100644 index 000000000..c945cfa07 --- /dev/null +++ b/queries/supercollider/locals.scm @@ -0,0 +1,36 @@ +; The local variables query is different from the highlights query in that, while the highlights query uses arbitrary capture names which can then be mapped to colors, the locals variable query uses a fixed set of capture names, each of which has a special meaning. +; The capture names are as follows: +; @local.scope - indicates that a syntax node introduces a new local scope. +; @local.definition - indicates that a syntax node contains the name of a definition within the current local scope. +; @local.reference - indicates that a syntax node contains the name which may refer to an earlier definition within some enclosing scope. + + +; Scopes +[ +(function_call) +(code_block) +(function_block) +(control_structure) +] @scope + +; Definitions +(argument + name: (identifier) @definition.parameter + (set! "definition.var.scope" "local") +) + +(variable_definition + name: (variable (local_var (identifier) @definition.var + ))) + +(variable_definition + name: (variable (environment_var (identifier) @definition.var)) + (set! "definition.var.scope" "global")) + +(function_definition name: (variable) @definition.var + (set! "definition.var.scope" "parent") +) +;(variable_definition name: (variable (local_var(identifier))) @local.definition) +;(variable) @local.definition + +(identifier) @reference |
