aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-03-22 05:24:56 -0400
committerAmaan Qureshi <amaanq12@gmail.com>2023-03-22 06:34:30 -0400
commit40670af9806e2bc5be820a18a50b4ffcd14f40fb (patch)
tree065f6cce4703de7ead453203a979a57119f193aa
parentfix(python): add object as `@type.builtin` (diff)
downloadnvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.tar
nvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.tar.gz
nvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.tar.bz2
nvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.tar.lz
nvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.tar.xz
nvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.tar.zst
nvim-treesitter-40670af9806e2bc5be820a18a50b4ffcd14f40fb.zip
feat: add Bass
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/bass/folds.scm5
-rw-r--r--queries/bass/highlights.scm109
-rw-r--r--queries/bass/indents.scm22
-rw-r--r--queries/bass/injections.scm1
-rw-r--r--queries/bass/locals.scm25
8 files changed, 174 insertions, 0 deletions
diff --git a/README.md b/README.md
index a1c40bd66..ac73bd66f 100644
--- a/README.md
+++ b/README.md
@@ -179,6 +179,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [astro](https://github.com/virchau13/tree-sitter-astro) (maintained by @virchau13)
- [ ] [awk](https://github.com/Beaglefoot/tree-sitter-awk)
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
+- [x] [bass](https://github.com/amaanq/tree-sitter-bass) (maintained by @amaanq)
- [x] [beancount](https://github.com/polarmutex/tree-sitter-beancount) (maintained by @polarmutex)
- [x] [bibtex](https://github.com/latex-lsp/tree-sitter-bibtex) (maintained by @theHamsta, @clason)
- [x] [bicep](https://github.com/amaanq/tree-sitter-bicep) (maintained by @amaanq)
diff --git a/lockfile.json b/lockfile.json
index 99eac6e6b..558a22221 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -17,6 +17,9 @@
"bash": {
"revision": "b338fa9f4807b9e0336cd4dde04948a8c324a4cf"
},
+ "bass": {
+ "revision": "27f110dfe79620993f5493ffa0d0f2fe12d250ed"
+ },
"beancount": {
"revision": "f3741a3a68ade59ec894ed84a64673494d2ba8f3"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index b523c2274..1d03bd63b 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -120,6 +120,14 @@ list.bash = {
maintainers = { "@TravonteD" },
}
+list.bass = {
+ install_info = {
+ url = "https://github.com/amaanq/tree-sitter-bass",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@amaanq" },
+}
+
list.beancount = {
install_info = {
url = "https://github.com/polarmutex/tree-sitter-beancount",
diff --git a/queries/bass/folds.scm b/queries/bass/folds.scm
new file mode 100644
index 000000000..d99e0c1ac
--- /dev/null
+++ b/queries/bass/folds.scm
@@ -0,0 +1,5 @@
+[
+ (list)
+ (scope)
+ (cons)
+] @fold
diff --git a/queries/bass/highlights.scm b/queries/bass/highlights.scm
new file mode 100644
index 000000000..296443d52
--- /dev/null
+++ b/queries/bass/highlights.scm
@@ -0,0 +1,109 @@
+;; Variables
+
+(list (symbol) @variable)
+
+(cons (symbol) @variable)
+
+(scope (symbol) @variable)
+
+(symbind (symbol) @variable)
+
+;; Constants
+
+((symbol) @constant
+ (#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
+
+;; Functions
+
+(list
+ . (symbol) @function)
+
+;; Namespaces
+
+(symbind
+ (symbol) @namespace
+ . (keyword))
+
+;; Includes
+
+((symbol) @include
+ (#any-of? @include "use" "import" "load"))
+
+;; Keywords
+
+((symbol) @keyword
+ (#any-of? @keyword "do" "doc"))
+
+;; Special Functions
+
+; Keywords construct a symbol
+
+(keyword) @constructor
+
+((list
+ . (symbol) @keyword.function
+ . (symbol) @function
+ (symbol)? @parameter)
+ (#any-of? @keyword.function "def" "defop" "defn" "fn"))
+
+((cons
+ . (symbol) @keyword.function
+ . (symbol) @function
+ (symbol)? @parameter)
+ (#any-of? @keyword.function "def" "defop" "defn" "fn"))
+
+((symbol) @function.builtin
+ (#any-of? @function.builtin "dump" "mkfs" "json" "log" "error" "now" "cons" "wrap" "unwrap" "eval" "make-scope" "bind" "meta" "with-meta" "null?" "ignore?" "boolean?" "number?" "string?" "symbol?" "scope?" "sink?" "source?" "list?" "pair?" "applicative?" "operative?" "combiner?" "path?" "empty?" "thunk?" "+" "*" "quot" "-" "max" "min" "=" ">" ">=" "<" "<=" "list->source" "across" "emit" "next" "reduce-kv" "assoc" "symbol->string" "string->symbol" "str" "substring" "trim" "scope->list" "string->fs-path" "string->cmd-path" "string->dir" "subpath" "path-name" "path-stem" "with-image" "with-dir" "with-args" "with-cmd" "with-stdin" "with-env" "with-insecure" "with-label" "with-port" "with-tls" "with-mount" "thunk-cmd" "thunk-args" "resolve" "start" "addr" "wait" "read" "cache-dir" "binds?" "recall-memo" "store-memo" "mask" "list" "list*" "first" "rest" "length" "second" "third" "map" "map-pairs" "foldr" "foldl" "append" "filter" "conj" "list->scope" "merge" "apply" "id" "always" "vals" "keys" "memo" "succeeds?" "run" "last" "take" "take-all" "insecure!" "from" "cd" "wrap-cmd" "mkfile" "path-base" "not"))
+
+((symbol) @function.macro
+ (#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
+
+;; Conditionals
+
+((symbol) @conditional
+ (#any-of? @conditional "if" "case" "cond" "when"))
+
+;; Repeats
+
+((symbol) @repeat
+ (#any-of? @repeat "each"))
+
+;; Operators
+
+((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
+
+;; Punctuation
+
+[ "(" ")" ] @punctuation.bracket
+
+[ "{" "}" ] @punctuation.bracket
+
+[ "[" "]" ] @punctuation.bracket
+
+((symbol) @punctuation.delimiter
+ (#eq? @punctuation.delimiter "->"))
+
+;; Literals
+
+(string) @string
+
+(escape_sequence) @string.escape
+
+(path) @text.uri @string.special
+
+(number) @number
+
+(boolean) @boolean
+
+[
+ (ignore)
+ (null)
+] @constant.builtin
+
+[
+ "^"
+] @character.special
+
+;; Comments
+
+(comment) @comment @spell
diff --git a/queries/bass/indents.scm b/queries/bass/indents.scm
new file mode 100644
index 000000000..f1f4e0ecf
--- /dev/null
+++ b/queries/bass/indents.scm
@@ -0,0 +1,22 @@
+[
+ (list)
+ (scope)
+ (cons)
+] @indent
+
+[
+ ")"
+ "}"
+ "]"
+] @indent_end
+
+[ "(" ")" ] @branch
+
+[ "{" "}" ] @branch
+
+[ "[" "]" ] @branch
+
+[
+ (ERROR)
+ (comment)
+] @auto
diff --git a/queries/bass/injections.scm b/queries/bass/injections.scm
new file mode 100644
index 000000000..4bb7d675d
--- /dev/null
+++ b/queries/bass/injections.scm
@@ -0,0 +1 @@
+(comment) @comment
diff --git a/queries/bass/locals.scm b/queries/bass/locals.scm
new file mode 100644
index 000000000..5a94e7532
--- /dev/null
+++ b/queries/bass/locals.scm
@@ -0,0 +1,25 @@
+; Scopes
+
+[
+ (list)
+ (scope)
+ (cons)
+] @scope
+
+; References
+
+(symbol) @reference
+
+; Definitions
+
+((list
+ . (symbol) @_fnkw
+ . (symbol) @definition.function
+ (symbol)? @definition.parameter)
+ (#any-of? @_fnkw "def" "defop" "defn" "fn"))
+
+((cons
+ . (symbol) @_fnkw
+ . (symbol) @definition.function
+ (symbol)? @definition.parameter)
+ (#any-of? @_fnkw "def" "defop" "defn" "fn"))