@@ -0,0 +1,101 @@
1+; GENERATED VIA https://github.com/vito/tree-sitter-bass
2+
3+;;; comments
4+
5+(comment) @comment.line
6+
7+;;; punctuation
8+
9+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
10+
11+;;; constants
12+
13+[(ignore) (null)] @constant.builtin
14+
15+(bool) @constant.builtin.boolean
16+
17+(int) @constant.numeric.integer
18+
19+;;; strings
20+
21+;; string literals
22+
23+(string) @string
24+(string (string_escape) @constant.character.escape)
25+
26+;; keywords (symbol literals)
27+
28+(keyword) @string.special.symbol
29+
30+;; paths
31+
32+(dot) @string.special.path
33+(dotdot) @string.special.path
34+(command) @string.special.path
35+(subpath (symbol) @string.special.path)
36+
37+; slashes in a path denote a combiner call
38+(subpath (slash) @function)
39+
40+
41+
42+;;; specific highlighting for builtins & special forms
43+
44+;; symbol classification based highlighting
45+
46+(list . (symbol) @keyword.control.conditional (#match? @keyword.control.conditional "^(if|case|cond|when)$"))
47+(cons . (symbol) @keyword.control.conditional (#match? @keyword.control.conditional "^(if|case|cond|when)$"))
48+
49+(list . (symbol) @keyword.control.repeat (#match? @keyword.control.repeat "^(each)$"))
50+(cons . (symbol) @keyword.control.repeat (#match? @keyword.control.repeat "^(each)$"))
51+
52+(list . (symbol) @label (#match? @label "^(def|defop|defn)$"))
53+(cons . (symbol) @label (#match? @label "^(def|defop|defn)$"))
54+
55+(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|take-all|insecure!|from|cd|wrap-cmd|mkfile|path-base|not)$"))
56+(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|take-all|insecure!|from|cd|wrap-cmd|mkfile|path-base|not)$"))
57+
58+(list . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
59+(cons . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
60+
61+(list . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
62+(cons . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
63+
64+(list . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
65+(cons . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
66+
67+
68+;; special cases
69+
70+; [a & b] highlights & as operator rather than a regular symbol
71+(list (symbol) @operator (#match? @operator "&"))
72+(cons (symbol) @operator (#match? @operator "&"))
73+
74+; (-> x y z) highlights first x as var, y z as function
75+(list
76+ .
77+ (symbol) @function.macro
78+ (#eq? @function.macro "->")
79+ .
80+ (symbol) @variable.parameter
81+ (symbol) @function)
82+
83+; (-> 42 x y) highlights 42 as regular number
84+(list
85+ .
86+ (symbol) @function.macro
87+ (#eq? @function.macro "->")
88+ .
89+ (_)
90+ (symbol) @function)
91+
92+;;; generic highlighting for all forms
93+
94+; first symbol in a list form is a combiner call
95+(list . (symbol) @function)
96+
97+; highlight symbols as vars only when they're clearly vars
98+(cons (symbol) @variable)
99+(scope (symbol) @variable)
100+(path form: (symbol) @variable)
101+(symbind form: (symbol) @variable)