aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Hiner <karl.hiner@gmail.com>2024-02-08 04:54:33 -0500
committerGitHub <noreply@github.com>2024-02-08 10:54:33 +0100
commitb444afa1dacd3d031c0ffe4763671d89afda5ddb (patch)
treed3d2097ff3b34164583f1be49d91042e9d1d1e35
parentUpdate parsers: groovy, haskell, javascript, svelte, templ, wing (diff)
downloadnvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.tar
nvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.tar.gz
nvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.tar.bz2
nvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.tar.lz
nvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.tar.xz
nvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.tar.zst
nvim-treesitter-b444afa1dacd3d031c0ffe4763671d89afda5ddb.zip
feat(faust): add tree-sitter-faust (#6043)
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/faust/highlights.scm218
-rw-r--r--queries/faust/injections.scm2
5 files changed, 233 insertions, 0 deletions
diff --git a/README.md b/README.md
index 786aa2276..0f7c50cb4 100644
--- a/README.md
+++ b/README.md
@@ -225,6 +225,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [ ] [embedded_template](https://github.com/tree-sitter/tree-sitter-embedded-template)
- [x] [erlang](https://github.com/WhatsApp/tree-sitter-erlang) (maintained by @filmor)
- [x] [facility](https://github.com/FacilityApi/tree-sitter-facility) (maintained by @bryankenote)
+- [x] [faust](https://github.com/khiner/tree-sitter-faust) (maintained by @khiner)
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
- [x] [firrtl](https://github.com/amaanq/tree-sitter-firrtl) (maintained by @amaanq)
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
diff --git a/lockfile.json b/lockfile.json
index 5fda6ae1f..f6e095874 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -155,6 +155,9 @@
"facility": {
"revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4"
},
+ "faust": {
+ "revision": "4609dd2c126a4803139db03eed784d26effe9844"
+ },
"fennel": {
"revision": "15e4f8c417281768db17080c4447297f8ff5343a"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index d74267c20..b5c8778cb 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -514,6 +514,15 @@ list.facility = {
maintainers = { "@bryankenote" },
}
+list.faust = {
+ install_info = {
+ url = "https://github.com/khiner/tree-sitter-faust",
+ files = { "src/parser.c" },
+ },
+ filetype = "dsp",
+ maintainers = { "@khiner" },
+}
+
list.fennel = {
install_info = {
url = "https://github.com/travonted/tree-sitter-fennel",
diff --git a/queries/faust/highlights.scm b/queries/faust/highlights.scm
new file mode 100644
index 000000000..012562971
--- /dev/null
+++ b/queries/faust/highlights.scm
@@ -0,0 +1,218 @@
+; Identifiers
+(identifier) @variable
+
+(process) @variable.builtin
+
+(parameters
+ (identifier)) @variable.parameter
+
+(global_metadata
+ key: (identifier) @variable.member)
+
+(function_metadata
+ function_name: (identifier) @variable.member)
+
+; Literals
+(_
+ filename: (string)) @string.special.path
+
+(documentation) @string.documentation @spell
+
+[
+ (string)
+ (fstring)
+] @string
+
+(int) @number
+
+(real) @number.float
+
+; Types
+(_
+ type:
+ [
+ (int_type)
+ (float_type)
+ (any_type)
+ ]) @type.builtin
+
+[
+ (single_precision)
+ (double_precision)
+ (quad_precision)
+ (fixed_point_precision)
+] @attribute
+
+; Functions
+(function_definition
+ name: (identifier) @function)
+
+(function_names) @function
+
+[
+ (lambda)
+ (prefix)
+ (prim1)
+ (prim2)
+ (prim3)
+ (prim4)
+ (prim5)
+ (function_call)
+] @function.call
+
+[
+ "exp"
+ "log"
+ "log10"
+ "sqrt"
+ "abs"
+ "floor"
+ "ceil"
+ "rint"
+ "round"
+ "acos"
+ "asin"
+ "atan"
+ "cos"
+ "sin"
+ "tan"
+ "atan2"
+ "int"
+ "float"
+ "pow"
+ "min"
+ "max"
+ "fmod"
+ "remainder"
+ "prefix"
+ "attach"
+ "enable"
+ "control"
+ "rdtable"
+ "rwtable"
+ "select2"
+ "select3"
+ "lowest"
+ "highest"
+ "assertbounds"
+ (par)
+ (seq)
+ (sum)
+ (prod)
+ (component)
+ (library)
+ (vslider_type)
+ (hslider_type)
+ (nentry_type)
+ (vbargraph_type)
+ (hbargraph_type)
+ (vgroup_type)
+ (hgroup_type)
+ (tgroup_type)
+ "button"
+ "checkbox"
+ "soundfile"
+ "inputs"
+ "outputs"
+ "route"
+] @function.builtin
+
+; xor is a @keyword.operator
+[
+ (add)
+ (sub)
+ (mult)
+ (div)
+ (mod)
+ (pow)
+ (or)
+ (and)
+ (lshift)
+ (rshift)
+ (lt)
+ (le)
+ (gt)
+ (ge)
+ (eq)
+ (neq)
+ (delay)
+ (one_sample_delay)
+ "="
+ "=>"
+ "->"
+] @operator
+
+(recursive
+ "~" @operator)
+
+(sequential
+ ":" @operator)
+
+(split
+ "<:" @operator)
+
+(merge
+ ":>" @operator)
+
+(parallel
+ "," @operator)
+
+; Keywords
+[
+ (par)
+ (seq)
+ (sum)
+ (prod)
+] @keyword.repeat
+
+(file_import
+ "import" @keyword.import)
+
+[
+ (wire)
+ (cut)
+ (mem)
+ "declare"
+ "with"
+ "environment"
+ "case"
+ "ffunction"
+ "fconstant"
+ "fvariable"
+] @keyword
+
+(xor) @keyword.operator
+
+; Punctuation
+[
+ ","
+ ";"
+ "."
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+; Comments
+(comment) @comment @spell
+
+; Tags
+[
+ "<mdoc>"
+ "</mdoc>"
+ "<metadata>"
+ "</metadata>"
+ "<equation>"
+ "</equation>"
+ "<diagram>"
+ "</diagram>"
+ "<listing"
+ "<notice"
+ "/>"
+] @tag
diff --git a/queries/faust/injections.scm b/queries/faust/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/queries/faust/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))