ts-wasms 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/README.md +26 -9
  2. package/index.d.ts +102 -0
  3. package/index.js +27 -0
  4. package/out/angular/folds.scm +1 -0
  5. package/out/angular/highlights.scm +178 -0
  6. package/out/angular/indents.scm +16 -0
  7. package/out/angular/injections.scm +1 -0
  8. package/out/angular/locals.scm +1 -0
  9. package/out/angular/tree-sitter-angular.wasm +0 -0
  10. package/out/asm/highlights.scm +66 -0
  11. package/out/asm/injections.scm +5 -0
  12. package/out/asm/tree-sitter-asm.wasm +0 -0
  13. package/out/astro/folds.scm +1 -0
  14. package/out/astro/highlights.scm +12 -0
  15. package/out/astro/indents.scm +1 -0
  16. package/out/astro/injections.scm +27 -0
  17. package/out/astro/locals.scm +1 -0
  18. package/out/astro/tree-sitter-astro.wasm +0 -0
  19. package/out/bash/folds.scm +9 -0
  20. package/out/bash/indents.scm +32 -0
  21. package/out/bash/injections.scm +90 -0
  22. package/out/bash/locals.scm +14 -0
  23. package/out/c/folds.scm +23 -0
  24. package/out/c/indents.scm +99 -0
  25. package/out/c/injections.scm +128 -0
  26. package/out/c/locals.scm +67 -0
  27. package/out/clojure/folds.scm +2 -0
  28. package/out/clojure/injections.scm +2 -0
  29. package/out/clojure/locals.scm +1 -0
  30. package/out/cmake/folds.scm +8 -0
  31. package/out/cmake/highlights.scm +221 -0
  32. package/out/cmake/indents.scm +26 -0
  33. package/out/cmake/injections.scm +5 -0
  34. package/out/cmake/tree-sitter-cmake.wasm +0 -0
  35. package/out/comment/highlights.scm +49 -0
  36. package/out/comment/tree-sitter-comment.wasm +0 -0
  37. package/out/commonlisp/folds.scm +2 -0
  38. package/out/commonlisp/injections.scm +5 -0
  39. package/out/commonlisp/locals.scm +109 -0
  40. package/out/cpp/folds.scm +14 -0
  41. package/out/cpp/indents.scm +8 -0
  42. package/out/cpp/locals.scm +78 -0
  43. package/out/css/folds.scm +10 -0
  44. package/out/css/indents.scm +11 -0
  45. package/out/css/injections.scm +2 -0
  46. package/out/csv/highlights.scm +5 -0
  47. package/out/csv/tree-sitter-csv.wasm +0 -0
  48. package/out/csv-psv/highlights.scm +5 -0
  49. package/out/csv-psv/tree-sitter-csv-psv.wasm +0 -0
  50. package/out/csv-tsv/highlights.scm +4 -0
  51. package/out/csv-tsv/tree-sitter-csv-tsv.wasm +0 -0
  52. package/out/dart/indents.scm +49 -0
  53. package/out/dart/injections.scm +2 -0
  54. package/out/dart/locals.scm +32 -0
  55. package/out/diff/folds.scm +5 -0
  56. package/out/diff/highlights.scm +49 -0
  57. package/out/diff/injections.scm +2 -0
  58. package/out/diff/tree-sitter-diff.wasm +0 -0
  59. package/out/dockerfile/highlights.scm +58 -0
  60. package/out/dockerfile/injections.scm +12 -0
  61. package/out/dockerfile/tree-sitter-dockerfile.wasm +0 -0
  62. package/out/dtd/folds.scm +4 -0
  63. package/out/dtd/injections.scm +2 -0
  64. package/out/dtd/locals.scm +11 -0
  65. package/out/editorconfig/folds.scm +1 -0
  66. package/out/editorconfig/highlights.scm +35 -0
  67. package/out/editorconfig/injections.scm +2 -0
  68. package/out/editorconfig/tree-sitter-editorconfig.wasm +0 -0
  69. package/out/elixir/folds.scm +10 -0
  70. package/out/elixir/indents.scm +25 -0
  71. package/out/elixir/locals.scm +200 -0
  72. package/out/elm/folds.scm +14 -0
  73. package/out/erlang/folds.scm +9 -0
  74. package/out/erlang/injections.scm +2 -0
  75. package/out/fish/folds.scm +8 -0
  76. package/out/fish/highlights.scm +61 -0
  77. package/out/fish/indents.scm +18 -0
  78. package/out/fish/injections.scm +2 -0
  79. package/out/fish/locals.scm +19 -0
  80. package/out/fish/tree-sitter-fish.wasm +0 -0
  81. package/out/gdscript/folds.scm +26 -0
  82. package/out/gdscript/highlights.scm +635 -0
  83. package/out/gdscript/indents.scm +78 -0
  84. package/out/gdscript/injections.scm +2 -0
  85. package/out/gdscript/locals.scm +121 -0
  86. package/out/gdscript/tree-sitter-gdscript.wasm +0 -0
  87. package/out/gdshader/highlights.scm +256 -0
  88. package/out/gdshader/injections.scm +2 -0
  89. package/out/gdshader/locals.scm +24 -0
  90. package/out/gdshader/tags.scm +13 -0
  91. package/out/gdshader/tree-sitter-gdshader.wasm +0 -0
  92. package/out/git-config/highlights.scm +28 -0
  93. package/out/git-config/tree-sitter-git-config.wasm +0 -0
  94. package/out/git-rebase/highlights.scm +36 -0
  95. package/out/git-rebase/tree-sitter-git-rebase.wasm +0 -0
  96. package/out/gitattributes/highlights.scm +52 -0
  97. package/out/gitattributes/injections.scm +2 -0
  98. package/out/gitattributes/locals.scm +8 -0
  99. package/out/gitattributes/tree-sitter-gitattributes.wasm +0 -0
  100. package/out/gitignore/highlights.scm +36 -0
  101. package/out/gitignore/injections.scm +2 -0
  102. package/out/gitignore/tree-sitter-gitignore.wasm +0 -0
  103. package/out/go/folds.scm +19 -0
  104. package/out/go/indents.scm +48 -0
  105. package/out/go/injections.scm +42 -0
  106. package/out/go/locals.scm +88 -0
  107. package/out/godot-resource/tree-sitter-godot-resource.wasm +0 -0
  108. package/out/graphql/indents.scm +11 -0
  109. package/out/graphql/injections.scm +2 -0
  110. package/out/groovy/folds.scm +6 -0
  111. package/out/groovy/highlights.scm +148 -0
  112. package/out/groovy/indents.scm +23 -0
  113. package/out/groovy/injections.scm +5 -0
  114. package/out/groovy/locals.scm +6 -0
  115. package/out/groovy/tree-sitter-groovy.wasm +0 -0
  116. package/out/haskell/folds.scm +6 -0
  117. package/out/hcl/folds.scm +6 -0
  118. package/out/hcl/indents.scm +16 -0
  119. package/out/hcl/injections.scm +6 -0
  120. package/out/html/folds.scm +5 -0
  121. package/out/html/indents.scm +1 -0
  122. package/out/html/locals.scm +1 -0
  123. package/out/ini/folds.scm +1 -0
  124. package/out/ini/highlights.scm +16 -0
  125. package/out/ini/injections.scm +3 -0
  126. package/out/ini/tree-sitter-ini.wasm +0 -0
  127. package/out/java/folds.scm +8 -0
  128. package/out/java/indents.scm +40 -0
  129. package/out/java/injections.scm +31 -0
  130. package/out/java/locals.scm +100 -0
  131. package/out/javascript/folds.scm +1 -0
  132. package/out/javascript/indents.scm +1 -0
  133. package/out/json/folds.scm +5 -0
  134. package/out/json/indents.scm +11 -0
  135. package/out/json/injections.scm +2 -0
  136. package/out/json/locals.scm +4 -0
  137. package/out/julia/folds.scm +14 -0
  138. package/out/julia/indents.scm +52 -0
  139. package/out/kotlin/folds.scm +13 -0
  140. package/out/kotlin/injections.scm +52 -0
  141. package/out/kotlin/locals.scm +78 -0
  142. package/out/lua/folds.scm +12 -0
  143. package/out/lua/indents.scm +47 -0
  144. package/out/markdown/folds.scm +12 -0
  145. package/out/markdown/indents.scm +1 -0
  146. package/out/matlab/folds.scm +13 -0
  147. package/out/matlab/highlights.scm +218 -0
  148. package/out/matlab/indents.scm +40 -0
  149. package/out/matlab/injections.scm +2 -0
  150. package/out/matlab/locals.scm +33 -0
  151. package/out/matlab/tree-sitter-matlab.wasm +0 -0
  152. package/out/nim/folds.scm +41 -0
  153. package/out/nim/highlights.scm +186 -0
  154. package/out/nim/injections.scm +79 -0
  155. package/out/nim/locals.scm +328 -0
  156. package/out/nim/tree-sitter-nim.wasm +0 -0
  157. package/out/nix/folds.scm +11 -0
  158. package/out/nix/indents.scm +75 -0
  159. package/out/ocaml/folds.scm +30 -0
  160. package/out/ocaml/indents.scm +77 -0
  161. package/out/ocaml/injections.scm +2 -0
  162. package/out/php/folds.scm +1 -0
  163. package/out/php/indents.scm +1 -0
  164. package/out/php/locals.scm +1 -0
  165. package/out/prisma/folds.scm +7 -0
  166. package/out/prisma/injections.scm +5 -0
  167. package/out/python/folds.scm +28 -0
  168. package/out/python/indents.scm +213 -0
  169. package/out/python/injections.scm +30 -0
  170. package/out/python/locals.scm +124 -0
  171. package/out/qmljs/folds.scm +8 -0
  172. package/out/qmljs/highlights.scm +61 -0
  173. package/out/qmljs/injections.scm +1 -0
  174. package/out/qmljs/locals.scm +6 -0
  175. package/out/qmljs/tree-sitter-qmljs.wasm +0 -0
  176. package/out/query/folds.scm +6 -0
  177. package/out/query/indents.scm +25 -0
  178. package/out/query/injections.scm +28 -0
  179. package/out/query/locals.scm +21 -0
  180. package/out/r/indents.scm +33 -0
  181. package/out/r/injections.scm +2 -0
  182. package/out/racket/folds.scm +2 -0
  183. package/out/racket/injections.scm +5 -0
  184. package/out/ruby/folds.scm +12 -0
  185. package/out/ruby/indents.scm +43 -0
  186. package/out/ruby/injections.scm +34 -0
  187. package/out/rust/folds.scm +25 -0
  188. package/out/rust/indents.scm +133 -0
  189. package/out/rust/locals.scm +98 -0
  190. package/out/scala/folds.scm +16 -0
  191. package/out/scala/injections.scm +5 -0
  192. package/out/scheme/folds.scm +2 -0
  193. package/out/scheme/injections.scm +2 -0
  194. package/out/scss/folds.scm +1 -0
  195. package/out/scss/indents.scm +7 -0
  196. package/out/scss/injections.scm +2 -0
  197. package/out/sql/folds.scm +1 -0
  198. package/out/sql/injections.scm +5 -0
  199. package/out/terraform/folds.scm +1 -0
  200. package/out/terraform/indents.scm +1 -0
  201. package/out/terraform/injections.scm +1 -0
  202. package/out/toml/folds.scm +5 -0
  203. package/out/toml/indents.scm +11 -0
  204. package/out/toml/injections.scm +2 -0
  205. package/out/toml/locals.scm +4 -0
  206. package/out/tsx/folds.scm +1 -0
  207. package/out/tsx/indents.scm +1 -0
  208. package/out/tsx/injections.scm +1 -0
  209. package/out/typescript/folds.scm +8 -0
  210. package/out/typescript/indents.scm +7 -0
  211. package/out/typescript/injections.scm +28 -0
  212. package/out/vim/folds.scm +4 -0
  213. package/out/vim/highlights.scm +362 -0
  214. package/out/vim/injections.scm +44 -0
  215. package/out/vim/locals.scm +19 -0
  216. package/out/vim/tree-sitter-vim.wasm +0 -0
  217. package/out/vimdoc/injections.scm +4 -0
  218. package/out/vue/folds.scm +6 -0
  219. package/out/vue/highlights.scm +54 -0
  220. package/out/vue/indents.scm +7 -0
  221. package/out/vue/injections.scm +78 -0
  222. package/out/vue/tree-sitter-vue.wasm +0 -0
  223. package/out/xml/folds.scm +5 -0
  224. package/out/xml/indents.scm +16 -0
  225. package/out/xml/injections.scm +32 -0
  226. package/out/xml/locals.scm +35 -0
  227. package/out/yaml/folds.scm +4 -0
  228. package/out/yaml/highlights.scm +79 -0
  229. package/out/yaml/indents.scm +7 -0
  230. package/out/yaml/injections.scm +81 -0
  231. package/out/yaml/locals.scm +9 -0
  232. package/out/yaml/tree-sitter-yaml.wasm +0 -0
  233. package/out/zig/locals.scm +96 -0
  234. package/package.json +49 -17
package/README.md CHANGED
@@ -1,16 +1,31 @@
1
- # ts-wasms
2
- Prebuilt WASM binaries for tree-sitter's language parsers.
3
- You can find a list of supported packages [here](https://app.unpkg.com/ts-wasms/files/out)
1
+ # ts-wasms [![npm version](https://img.shields.io/npm/v/ts-wasms.svg?style=flat-square)](https://www.npmjs.com/package/ts-wasms)
2
+ Prebuilt WASM binaries and query files(`.scm`) for tree-sitter's language parsers.
3
+ You can find a list of supported languages [here](https://app.unpkg.com/ts-wasms/files/out)
4
4
 
5
5
  ## Installation
6
6
  ```bash
7
+ npm install ts-wasms
8
+ # or
7
9
  pnpm add ts-wasms
10
+ # or
11
+ yarn add ts-wasms
12
+ # or
13
+ bun install ts-wasms
8
14
  ```
9
15
 
10
16
  ## Usage
11
- ```ts
12
- import pythonWasm from "ts-wasms/out/python/tree-sitter-python.wasm"
13
- import pythonHighlights from "ts-wasms/out/python/highlights.scm"
17
+ A type-safe API is provided for accessing grammars and queries at runtime
18
+ ```typescript
19
+ import { getWasmPath, getQueryPath } from "ts-wasms";
20
+
21
+ const wasmPath = getWasmPath("python");
22
+ const queryPath = getQueryPath("python", "highlights");
23
+ ```
24
+
25
+ You can also import the assets directly via your bundler
26
+ ```typescript
27
+ import wasmUrl from "ts-wasms/python/tree-sitter-python.wasm?url";
28
+ import wasmHighlights from "ts-wasms/python/highlights.scm?raw";
14
29
  ```
15
30
 
16
31
  Each language directory includes a `tree-sitter-<lang>.wasm` file but may also include:
@@ -22,12 +37,14 @@ Each language directory includes a `tree-sitter-<lang>.wasm` file but may also i
22
37
  - `indents.scm`
23
38
 
24
39
  ```txt
25
- out/python/
40
+ python/
26
41
  ├── tree-sitter-python.wasm
27
42
  ├── highlights.scm
28
43
  └── tags.scm
29
44
  ```
30
45
 
31
46
  ## Licenses
32
- Licenses belong to their respective upstream grammar authors, however this repo is MIT licensed.
33
- (If you have a problem with this licensing, please open an issue.)
47
+ The licenses for the generated .wasm and .scm files belong to their respective upstream grammar authors and can be found on their github repos.
48
+
49
+ The code in this repository is licensed under MIT.
50
+ If you maintain an upstream grammar and have a problem with this licensing, please open an issue.
package/index.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ /** Standard Tree-sitter query categories */
2
+ export type TreeSitterQuery =
3
+     | "highlights"
4
+     | "injections"
5
+     | "locals"
6
+     | "tags"
7
+     | "folds"
8
+     | "indents";
9
+
10
+ /** Supported language identifiers compiled during build step */
11
+ export type SupportedLanguage =
12
+     | "angular"
13
+     | "asm"
14
+     | "astro"
15
+     | "bash"
16
+     | "c"
17
+     | "c-sharp"
18
+     | "clojure"
19
+     | "cmake"
20
+     | "comment"
21
+     | "commonlisp"
22
+     | "cpp"
23
+     | "css"
24
+     | "csv"
25
+     | "csv-psv"
26
+     | "csv-tsv"
27
+     | "dart"
28
+     | "diff"
29
+     | "dockerfile"
30
+     | "dtd"
31
+     | "editorconfig"
32
+     | "elisp"
33
+     | "elixir"
34
+     | "elm"
35
+     | "embedded-template"
36
+     | "erlang"
37
+     | "fish"
38
+     | "gdscript"
39
+     | "gdshader"
40
+     | "git-config"
41
+     | "git-rebase"
42
+     | "gitattributes"
43
+     | "gitignore"
44
+     | "go"
45
+     | "godot-resource"
46
+     | "graphql"
47
+     | "groovy"
48
+     | "haskell"
49
+     | "hcl"
50
+     | "html"
51
+     | "ini"
52
+     | "java"
53
+     | "javascript"
54
+     | "json"
55
+     | "julia"
56
+     | "kotlin"
57
+     | "lua"
58
+     | "markdown"
59
+     | "markdown-inline"
60
+     | "matlab"
61
+     | "nim"
62
+     | "nix"
63
+     | "objc"
64
+     | "ocaml"
65
+     | "ocaml-interface"
66
+     | "ocaml-type"
67
+     | "perl"
68
+     | "php"
69
+     | "php-only"
70
+     | "prisma"
71
+     | "python"
72
+     | "qmljs"
73
+     | "query"
74
+     | "r"
75
+     | "racket"
76
+     | "regex"
77
+     | "ruby"
78
+     | "rust"
79
+     | "scala"
80
+     | "scheme"
81
+     | "scss"
82
+     | "sql"
83
+     | "swift"
84
+     | "terraform"
85
+     | "toml"
86
+     | "tsx"
87
+     | "typescript"
88
+     | "vim"
89
+     | "vimdoc"
90
+     | "vue"
91
+     | "xml"
92
+     | "yaml"
93
+     | "zig";
94
+
95
+ /** Resolves the absolute path to a specific language's WASM file. */
96
+ export declare function getWasmPath(lang: SupportedLanguage): string;
97
+
98
+ /** Resolves the absolute path to a specific language's query file. */
99
+ export declare function getQueryPath(
100
+     lang: SupportedLanguage,
101
+     query: TreeSitterQuery,
102
+ ): string;
package/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { fileURLToPath } from "node:url";
2
+
3
+ /**
4
+ * Resolves the absolute path to a specific language's WASM file.
5
+ *
6
+ * @param {string} lang
7
+ * @returns {string}
8
+ */
9
+ export function getWasmPath(lang) {
10
+ const url = new URL(
11
+ `./out/${lang}/tree-sitter-${lang}.wasm`,
12
+ import.meta.url,
13
+ );
14
+ return fileURLToPath(url);
15
+ }
16
+
17
+ /**
18
+ * Resolves the absolute path to a specific language's query file.
19
+ *
20
+ * @param {string} lang
21
+ * @param {string} query
22
+ * @returns {string}
23
+ */
24
+ export function getQueryPath(lang, query) {
25
+ const url = new URL(`./out/${lang}/${query}.scm`, import.meta.url);
26
+ return fileURLToPath(url);
27
+ }
@@ -0,0 +1 @@
1
+ ; inherits: html
@@ -0,0 +1,178 @@
1
+ ; inherits: html
2
+
3
+ (identifier) @variable
4
+
5
+ (style_unit) @variable
6
+
7
+ (pipe_operator) @operator
8
+
9
+ (string) @string
10
+
11
+ (number) @number
12
+
13
+ (pipe_call
14
+ name: (identifier) @function)
15
+
16
+ (pipe_call
17
+ arguments: (pipe_arguments
18
+ (identifier) @variable.parameter))
19
+
20
+ (structural_directive
21
+ "*" @keyword
22
+ (identifier) @keyword)
23
+
24
+ (attribute
25
+ (attribute_name) @variable.member
26
+ (#lua-match? @variable.member "#.*"))
27
+
28
+ (binding_name
29
+ (identifier) @keyword)
30
+
31
+ (class_binding
32
+ [
33
+ (identifier)
34
+ (class_name)
35
+ ] @keyword)
36
+
37
+ (event_binding
38
+ (binding_name
39
+ (identifier) @keyword))
40
+
41
+ (event_binding
42
+ "\"" @punctuation.delimiter)
43
+
44
+ (property_binding
45
+ [
46
+ "\""
47
+ "\"\""
48
+ ] @punctuation.delimiter)
49
+
50
+ (structural_assignment
51
+ operator: (identifier) @keyword)
52
+
53
+ (member_expression
54
+ property: (identifier) @property)
55
+
56
+ (call_expression
57
+ function: (identifier) @function)
58
+
59
+ (call_expression
60
+ function: ((identifier) @function.builtin
61
+ (#eq? @function.builtin "$any")))
62
+
63
+ (pair
64
+ key: ((identifier) @variable.builtin
65
+ (#eq? @variable.builtin "$implicit")))
66
+
67
+ [
68
+ (control_keyword)
69
+ (special_keyword)
70
+ ] @keyword
71
+
72
+ ((control_keyword) @keyword.repeat
73
+ (#any-of? @keyword.repeat "for" "empty"))
74
+
75
+ ((control_keyword) @keyword.conditional
76
+ (#any-of? @keyword.conditional "if" "else" "switch" "case" "default"))
77
+
78
+ ((control_keyword) @keyword.coroutine
79
+ (#any-of? @keyword.coroutine "defer" "placeholder" "loading"))
80
+
81
+ ((control_keyword) @keyword.exception
82
+ (#eq? @keyword.exception "error"))
83
+
84
+ ((identifier) @boolean
85
+ (#any-of? @boolean "true" "false"))
86
+
87
+ ((identifier) @variable.builtin
88
+ (#any-of? @variable.builtin "this" "$event"))
89
+
90
+ ((identifier) @constant.builtin
91
+ (#eq? @constant.builtin "null"))
92
+
93
+ [
94
+ (ternary_operator)
95
+ (conditional_operator)
96
+ ] @keyword.conditional.ternary
97
+
98
+ [
99
+ "("
100
+ ")"
101
+ "["
102
+ "]"
103
+ "{"
104
+ "}"
105
+ "@"
106
+ ] @punctuation.bracket
107
+
108
+ (two_way_binding
109
+ [
110
+ "[("
111
+ ")]"
112
+ ] @punctuation.bracket)
113
+
114
+ [
115
+ "{{"
116
+ "}}"
117
+ ] @punctuation.special
118
+
119
+ (template_substitution
120
+ [
121
+ "${"
122
+ "}"
123
+ ] @punctuation.special)
124
+
125
+ (template_chars) @string
126
+
127
+ [
128
+ ";"
129
+ "."
130
+ ","
131
+ "?."
132
+ "!."
133
+ ] @punctuation.delimiter
134
+
135
+ (nullish_coalescing_expression
136
+ (coalescing_operator) @operator)
137
+
138
+ (concatenation_expression
139
+ "+" @operator)
140
+
141
+ (icu_clause) @keyword.operator
142
+
143
+ (icu_category) @keyword.conditional
144
+
145
+ (binary_expression
146
+ [
147
+ "-"
148
+ "&&"
149
+ "+"
150
+ "<"
151
+ "<="
152
+ "="
153
+ "=="
154
+ "==="
155
+ "!="
156
+ "!=="
157
+ ">"
158
+ ">="
159
+ "*"
160
+ "/"
161
+ "||"
162
+ "%"
163
+ ] @operator)
164
+
165
+ (arrow_function
166
+ "=>" @operator)
167
+
168
+ (object
169
+ (spread
170
+ "..." @operator))
171
+
172
+ (array
173
+ (spread
174
+ "..." @operator))
175
+
176
+ (arguments
177
+ (spread
178
+ "..." @operator))
@@ -0,0 +1,16 @@
1
+ ; inherits: html
2
+
3
+ [
4
+ (statement_block)
5
+ (switch_statement)
6
+ ] @indent.begin
7
+
8
+ (statement_block
9
+ "{" @indent.branch)
10
+
11
+ (statement_block
12
+ "}" @indent.end)
13
+
14
+ "}" @indent.branch
15
+
16
+ "}" @indent.end
@@ -0,0 +1 @@
1
+ ; inherits: html
@@ -0,0 +1 @@
1
+ ; inherits: html
@@ -0,0 +1,66 @@
1
+ ; General
2
+ (label
3
+ [
4
+ (ident)
5
+ (word)
6
+ ] @label)
7
+
8
+ (reg) @variable.builtin
9
+
10
+ (meta
11
+ kind: (_) @function.builtin)
12
+
13
+ (instruction
14
+ kind: (_) @function.builtin)
15
+
16
+ (const
17
+ name: (word) @constant)
18
+
19
+ ; Comments
20
+ [
21
+ (line_comment)
22
+ (block_comment)
23
+ ] @comment @spell
24
+
25
+ ; Literals
26
+ (int) @number
27
+
28
+ (float) @number.float
29
+
30
+ (string) @string
31
+
32
+ ; Keywords
33
+ [
34
+ "byte"
35
+ "word"
36
+ "dword"
37
+ "qword"
38
+ "ptr"
39
+ "rel"
40
+ "label"
41
+ "const"
42
+ ] @keyword
43
+
44
+ ; Operators & Punctuation
45
+ [
46
+ "+"
47
+ "-"
48
+ "*"
49
+ "/"
50
+ "%"
51
+ "|"
52
+ "^"
53
+ "&"
54
+ ] @operator
55
+
56
+ [
57
+ "("
58
+ ")"
59
+ "["
60
+ "]"
61
+ ] @punctuation.bracket
62
+
63
+ [
64
+ ","
65
+ ":"
66
+ ] @punctuation.delimiter
@@ -0,0 +1,5 @@
1
+ ([
2
+ (line_comment)
3
+ (block_comment)
4
+ ] @injection.content
5
+ (#set! injection.language "comment"))
Binary file
@@ -0,0 +1 @@
1
+ ; inherits: html
@@ -0,0 +1,12 @@
1
+ (tag_name) @tag
2
+ (erroneous_end_tag_name) @tag.error
3
+ (doctype) @constant
4
+ (attribute_name) @attribute
5
+ (attribute_value) @string
6
+ (comment) @comment
7
+
8
+ [
9
+ "<"
10
+ ">"
11
+ "</"
12
+ ] @punctuation.bracket
@@ -0,0 +1 @@
1
+ ; inherits: html
@@ -0,0 +1,27 @@
1
+ (frontmatter
2
+ (frontmatter_js_block) @injection.content
3
+ (#set! injection.language "typescript"))
4
+
5
+ (attribute_interpolation
6
+ (attribute_js_expr) @injection.content
7
+ (#set! injection.language "typescript"))
8
+
9
+ ; TODO proper queries for html_interpolation highlighting
10
+ (html_interpolation
11
+ (permissible_text) @injection.content
12
+ (#set! injection.language "typescript"))
13
+
14
+ (script_element
15
+ (raw_text) @injection.content
16
+ (#set! injection.language "typescript"))
17
+
18
+ (style_element
19
+ (start_tag
20
+ (attribute
21
+ (attribute_name) @_lang_attr
22
+ (quoted_attribute_value
23
+ (attribute_value) @_lang_value)))
24
+ (raw_text) @injection.content
25
+ (#eq? @_lang_attr "lang")
26
+ (#eq? @_lang_value "scss")
27
+ (#set! injection.language "scss"))
@@ -0,0 +1 @@
1
+ ; inherits: html
Binary file
@@ -0,0 +1,9 @@
1
+ [
2
+ (function_definition)
3
+ (if_statement)
4
+ (case_statement)
5
+ (for_statement)
6
+ (while_statement)
7
+ (c_style_for_statement)
8
+ (heredoc_redirect)
9
+ ] @fold
@@ -0,0 +1,32 @@
1
+ [
2
+ (if_statement)
3
+ (for_statement)
4
+ (while_statement)
5
+ (case_statement)
6
+ (function_definition)
7
+ (compound_statement)
8
+ (subshell)
9
+ (command_substitution)
10
+ (do_group)
11
+ (case_item)
12
+ ] @indent.begin
13
+
14
+ [
15
+ "fi"
16
+ "done"
17
+ "esac"
18
+ "}"
19
+ ")"
20
+ "then"
21
+ "do"
22
+ (elif_clause)
23
+ (else_clause)
24
+ ] @indent.branch
25
+
26
+ [
27
+ "fi"
28
+ "done"
29
+ "esac"
30
+ "}"
31
+ ")"
32
+ ] @indent.end
@@ -0,0 +1,90 @@
1
+ ((comment) @injection.content
2
+ (#set! injection.language "comment"))
3
+
4
+ ((regex) @injection.content
5
+ (#set! injection.language "regex"))
6
+
7
+ (heredoc_redirect
8
+ (heredoc_body) @injection.content
9
+ (heredoc_end) @injection.language)
10
+
11
+ ; printf 'format'
12
+ ((command
13
+ name: (command_name) @_command
14
+ .
15
+ argument: [
16
+ (string) @injection.content
17
+ (concatenation
18
+ (string) @injection.content)
19
+ (raw_string) @injection.content
20
+ (concatenation
21
+ (raw_string) @injection.content)
22
+ ])
23
+ (#eq? @_command "printf")
24
+ (#offset! @injection.content 0 1 0 -1)
25
+ (#set! injection.include-children)
26
+ (#set! injection.language "printf"))
27
+
28
+ ; printf -v var 'format'
29
+ ((command
30
+ name: (command_name) @_command
31
+ argument: (word) @_arg
32
+ .
33
+ (_)
34
+ .
35
+ argument: [
36
+ (string) @injection.content
37
+ (concatenation
38
+ (string) @injection.content)
39
+ (raw_string) @injection.content
40
+ (concatenation
41
+ (raw_string) @injection.content)
42
+ ])
43
+ (#eq? @_command "printf")
44
+ (#eq? @_arg "-v")
45
+ (#offset! @injection.content 0 1 0 -1)
46
+ (#set! injection.include-children)
47
+ (#set! injection.language "printf"))
48
+
49
+ ; printf -- 'format'
50
+ ((command
51
+ name: (command_name) @_command
52
+ argument: (word) @_arg
53
+ .
54
+ argument: [
55
+ (string) @injection.content
56
+ (concatenation
57
+ (string) @injection.content)
58
+ (raw_string) @injection.content
59
+ (concatenation
60
+ (raw_string) @injection.content)
61
+ ])
62
+ (#eq? @_command "printf")
63
+ (#eq? @_arg "--")
64
+ (#offset! @injection.content 0 1 0 -1)
65
+ (#set! injection.include-children)
66
+ (#set! injection.language "printf"))
67
+
68
+ ((command
69
+ name: (command_name) @_command
70
+ .
71
+ argument: [
72
+ (string)
73
+ (raw_string)
74
+ ] @injection.content)
75
+ (#eq? @_command "bind")
76
+ (#offset! @injection.content 0 1 0 -1)
77
+ (#set! injection.include-children)
78
+ (#set! injection.language "readline"))
79
+
80
+ ((command
81
+ name: (command_name) @_command
82
+ .
83
+ argument: [
84
+ (string)
85
+ (raw_string)
86
+ ] @injection.content)
87
+ (#eq? @_command "trap")
88
+ (#offset! @injection.content 0 1 0 -1)
89
+ (#set! injection.include-children)
90
+ (#set! injection.self))
@@ -0,0 +1,14 @@
1
+ ; Scopes
2
+ (function_definition) @local.scope
3
+
4
+ ; Definitions
5
+ (variable_assignment
6
+ name: (variable_name) @local.definition.var)
7
+
8
+ (function_definition
9
+ name: (word) @local.definition.function)
10
+
11
+ ; References
12
+ (variable_name) @local.reference
13
+
14
+ (word) @local.reference
@@ -0,0 +1,23 @@
1
+ [
2
+ (for_statement)
3
+ (if_statement)
4
+ (while_statement)
5
+ (do_statement)
6
+ (switch_statement)
7
+ (case_statement)
8
+ (function_definition)
9
+ (struct_specifier)
10
+ (enum_specifier)
11
+ (comment)
12
+ (preproc_if)
13
+ (preproc_elif)
14
+ (preproc_else)
15
+ (preproc_ifdef)
16
+ (preproc_function_def)
17
+ (initializer_list)
18
+ (gnu_asm_expression)
19
+ (preproc_include)+
20
+ ] @fold
21
+
22
+ (compound_statement
23
+ (compound_statement) @fold)