Unnamed repository; edit this file 'description' to name the repository.
add werk language and highlights (#13136)
Freddie Gilbraith 11 months ago
parent ccf9564 · commit d6cacb2
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml10
-rw-r--r--runtime/queries/werk/highlights.scm62
3 files changed, 73 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index fd621c94..f6aee3fe 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -247,6 +247,7 @@
| wast | ✓ | | | |
| wat | ✓ | | | `wat_server` |
| webc | ✓ | | | |
+| werk | ✓ | | | |
| wgsl | ✓ | | | `wgsl-analyzer` |
| wit | ✓ | | ✓ | |
| wren | ✓ | ✓ | ✓ | |
diff --git a/languages.toml b/languages.toml
index a0f59717..079671b2 100644
--- a/languages.toml
+++ b/languages.toml
@@ -4244,3 +4244,13 @@ formatter = {command = "tlafmt", args = ["--stdin"]}
name = "tlaplus"
source = { git = "https://github.com/tlaplus-community/tree-sitter-tlaplus", rev = "4ba91b07b97741a67f61221d0d50e6d962e4987e"}
+[[language]]
+name = "werk"
+scope = "source.werk"
+file-types = [ "werk", { glob = "Werkfile" } ]
+comment-token = "#"
+indent = { tab-width = 2, unit = " " }
+
+[[grammar]]
+name = "werk"
+source = { git = "https://github.com/little-bonsai/tree-sitter-werk", rev = "92b0f7fe98465c4c435794a58e961306193d1c1e" }
diff --git a/runtime/queries/werk/highlights.scm b/runtime/queries/werk/highlights.scm
new file mode 100644
index 00000000..2636be3c
--- /dev/null
+++ b/runtime/queries/werk/highlights.scm
@@ -0,0 +1,62 @@
+(buildBlock . ("build") @keyword.function)
+(taskBlock . ("task") @keyword.function )
+(run . ("run") @keyword.function )
+(taskBlock name: (identifier) @function )
+
+(comment) @comment
+(string) @string
+(number) @constant.numeric
+(identifier) @identifier
+
+(include) @keyword.control.import
+(let) @keyword.storage
+(default) @keyword.storage
+(config) @keyword.storage
+
+(interpolation ["{" "}" "<" ">" ] @punctuation.special)
+["{" "}" "<" ">" "(" ")" "[" "]"] @punctuation.bracket
+["=>" "|"] @punctuation
+
+; Statements
+(build "build") @function
+(config "config") @function
+(copy "copy") @function
+(default "default") @function
+(delete "delete") @function
+(depfile "depfile") @function
+(envRemove "env-remove") @function
+(from "from") @function
+(info "info") @function
+(let "let") @function
+(setEnv "env") @function
+(shell "shell") @function
+(write "write") @function
+
+; Expressions
+(error "error" @function.builtin)
+(getEnv "env" @function.builtin)
+(glob "glob" @function.builtin)
+(include "include" @function.builtin)
+(info "info" @function.builtin)
+(read "read" @function.builtin)
+(warn "warn" @function.builtin)
+(which "which" @function.builtin)
+
+; Operations
+(op (string) @operator)
+("dedup" @operator)
+("first" @operator)
+("flatten" @operator)
+("last" @operator)
+("len" @operator)
+("lines" @operator)
+("tail" @operator)
+(assertEq "assert-eq" @operator)
+(discard "discard" @operator)
+(filter "filter" @operator)
+(filterMatch "filter-match" @operator)
+(join "join" @operator)
+(map "map" @operator)
+(match "match" @operator)
+(split "split" @operator)
+