Skip to content

Commit 6672ac0

Browse files
committed
add bass language + highlighting
1 parent fae9203 commit 6672ac0

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

languages.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,3 +1739,17 @@ language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"]
17391739
[[grammar]]
17401740
name = "jsonnet"
17411741
source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" }
1742+
1743+
[[language]]
1744+
name = "bass"
1745+
scope = "source.bass"
1746+
injection-regex = "bass"
1747+
file-types = ["bass"]
1748+
roots = []
1749+
comment-token = ";"
1750+
indent = { tab-width = 2, unit = " " }
1751+
language-server = { command = "bass", args = ["--lsp"] }
1752+
1753+
[[grammar]]
1754+
name = "bass"
1755+
source = { git = "https://github.com/vito/tree-sitter-bass", rev = "dd439406bcb4b24dc13968e87f1860c696cbfcb7" }

runtime/queries/bass/highlights.scm

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
; GENERATED VIA https://github.com/vito/tree-sitter-bass
2+
3+
(comment) @comment.line
4+
5+
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
6+
7+
[(ignore) (null) (bool)] @constant.builtin
8+
9+
(int) @constant.numeric
10+
11+
(string (string_escape) @constant.character.escape)
12+
13+
(string) @string
14+
15+
[(command) (path) (relpath)] @namespace
16+
17+
(keyword) @string.special.symbol
18+
19+
20+
((list . (symbol) @keyword.control.conditional (#match? @keyword.control.conditional "^(if|case|cond|when)$"))
21+
(set! "priority" 105))
22+
23+
((cons . (symbol) @keyword.control.conditional (#match? @keyword.control.conditional "^(if|case|cond|when)$"))
24+
(set! "priority" 105))
25+
26+
((list . (symbol) @keyword.control.repeat (#match? @keyword.control.repeat "^(each)$"))
27+
(set! "priority" 105))
28+
29+
((cons . (symbol) @keyword.control.repeat (#match? @keyword.control.repeat "^(each)$"))
30+
(set! "priority" 105))
31+
32+
((list . (symbol) @label (#match? @label "^(def|defop|defn)$"))
33+
(set! "priority" 105))
34+
35+
((cons . (symbol) @label (#match? @label "^(def|defop|defn)$"))
36+
(set! "priority" 105))
37+
38+
((list . (symbol) @function.builtin (#match? @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|insecure!|from|cd|wrap-cmd|mkfile|path-base|not)$"))
39+
(set! "priority" 105))
40+
41+
((cons . (symbol) @function.builtin (#match? @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|insecure!|from|cd|wrap-cmd|mkfile|path-base|not)$"))
42+
(set! "priority" 105))
43+
44+
((list . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
45+
(set! "priority" 105))
46+
47+
((cons . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
48+
(set! "priority" 105))
49+
50+
((list . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
51+
(set! "priority" 105))
52+
53+
((cons . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
54+
(set! "priority" 105))
55+
56+
((list . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
57+
(set! "priority" 105))
58+
59+
((cons . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
60+
(set! "priority" 105))
61+
62+
63+
((list
64+
(symbol) @operator
65+
(#match? @operator "&"))
66+
(set! "priority" 105))
67+
68+
((cons
69+
(symbol) @operator
70+
(#match? @operator "&"))
71+
(set! "priority" 105))
72+
73+
((list
74+
.
75+
(symbol) @function.macro
76+
(#eq? @function.macro "->")
77+
.
78+
(symbol) @variable.parameter
79+
(symbol) @function)
80+
(set! "priority" 105))
81+
82+
((list
83+
.
84+
(symbol) @function.macro
85+
(#eq? @function.macro "->")
86+
.
87+
(_)
88+
(symbol) @function)
89+
(set! "priority" 105))
90+
91+
; first symbol in a list form is a combiner call
92+
(list . (symbol) @function)
93+
94+
; be conservative; we don't want to just call every single symbol a variable
95+
(cons (symbol) @variable)
96+
(scope (symbol) @variable)
97+
(subpath form: (symbol) @variable)
98+
(subbind form: (symbol) @variable)

0 commit comments

Comments
 (0)