; GENERATED VIA https://github.com/vito/tree-sitter-bass ;;; comments (comment) @comment.line ;;; punctuation ["(" ")" "[" "]" "{" "}"] @punctuation.bracket ;;; constants [(ignore) (null)] @constant.builtin (boolean) @constant.builtin.boolean (int) @{{hl "constant.numeric.integer" "number" "constant.numeric.integer"}} ;;; strings ;; string literals (string) @string (string (string_escape) @{{hl "constant.character.escape" "string.escape" "constant.character.escape"}}) ;; keywords (symbol literals) (keyword) @{{hl "string.special.symbol" "symbol" "string.special.symbol"}} ;; paths (dot) @string.special.path (dotdot) @string.special.path (keyword) @string.special.path (subpath (symbol) @string.special.path) ; slashes in a path denote a combiner call (subpath (slash) @function) {{- define "generic"}} ;;; generic highlighting for all forms ; first symbol in a list form is a combiner call (list . (symbol) @function) ; highlight symbols as vars only when they're clearly vars (cons (symbol) @variable) (scope (symbol) @variable) (path form: (symbol) @variable) (symbind form: (symbol) @variable) {{- end -}} {{- define "overrides"}} ;;; specific highlighting for builtins & special forms ;; symbol classification based highlighting {{range .Classes}} (list . (symbol) {{.}}) (cons . (symbol) {{.}}) {{end}} ;; special cases ; [a & b] highlights & as operator rather than a regular symbol (list (symbol) @operator (#match? @operator "&")) (cons (symbol) @operator (#match? @operator "&")) ; (-> x y z) highlights first x as var, y z as function (list . (symbol) @function.macro (#eq? @function.macro "->") . (symbol) @variable.parameter (symbol) @function) ; (-> 42 x y) highlights 42 as regular number (list . (symbol) @function.macro (#eq? @function.macro "->") . (_) (symbol) @function) {{- end}} {{if .IsNeovim}} {{template "generic"}} {{template "overrides" .}} {{else}} {{template "overrides" .}} {{template "generic"}} {{end -}}