Skip to content

Commit

Permalink
add bass language + highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Sep 9, 2022
1 parent fae9203 commit db1299d
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
13 changes: 13 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1739,3 +1739,16 @@ language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"]
[[grammar]]
name = "jsonnet"
source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" }

[[language]]
name = "bass"
scope = "source.bass"
injection-regex = "bass"
file-types = ["bass"]
roots = []
comment-token = ";"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "bass"
source = { git = "https://github.com/vito/tree-sitter-bass", rev = "dd439406bcb4b24dc13968e87f1860c696cbfcb7" }
98 changes: 98 additions & 0 deletions runtime/queries/bass/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
; GENERATED VIA https://github.com/vito/tree-sitter-bass

(comment) @comment.line

["(" ")" "[" "]" "{" "}"] @punctuation.bracket

[(ignore) (null) (bool)] @constant.builtin

(int) @constant.numeric

(string (string_escape) @constant.character.escape)

(string) @string

[(command) (path) (relpath)] @namespace

(keyword) @string.special.symbol


((list . (symbol) @keyword.control.conditional (#match? @keyword.control.conditional "^(if|case|cond|when)$"))
(set! "priority" 105))

((cons . (symbol) @keyword.control.conditional (#match? @keyword.control.conditional "^(if|case|cond|when)$"))
(set! "priority" 105))

((list . (symbol) @keyword.control.repeat (#match? @keyword.control.repeat "^(each)$"))
(set! "priority" 105))

((cons . (symbol) @keyword.control.repeat (#match? @keyword.control.repeat "^(each)$"))
(set! "priority" 105))

((list . (symbol) @label (#match? @label "^(def|defop|defn)$"))
(set! "priority" 105))

((cons . (symbol) @label (#match? @label "^(def|defop|defn)$"))
(set! "priority" 105))

((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)$"))
(set! "priority" 105))

((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)$"))
(set! "priority" 105))

((list . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
(set! "priority" 105))

((cons . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
(set! "priority" 105))

((list . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
(set! "priority" 105))

((cons . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
(set! "priority" 105))

((list . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
(set! "priority" 105))

((cons . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
(set! "priority" 105))


((list
(symbol) @operator
(#match? @operator "&"))
(set! "priority" 105))

((cons
(symbol) @operator
(#match? @operator "&"))
(set! "priority" 105))

((list
.
(symbol) @function.macro
(#eq? @function.macro "->")
.
(symbol) @variable.parameter
(symbol) @function)
(set! "priority" 105))

((list
.
(symbol) @function.macro
(#eq? @function.macro "->")
.
(_)
(symbol) @function)
(set! "priority" 105))

; first symbol in a list form is a combiner call
(list . (symbol) @function)

; be conservative; we don't want to just call every single symbol a variable
(cons (symbol) @variable)
(scope (symbol) @variable)
(subpath form: (symbol) @variable)
(subbind form: (symbol) @variable)

0 comments on commit db1299d

Please sign in to comment.