ts-wasms 1.0.2
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.
- package/LICENSE +21 -0
- package/README +2 -0
- package/out/bash/highlights.scm +56 -0
- package/out/bash/tree-sitter-bash.wasm +0 -0
- package/out/c/highlights.scm +81 -0
- package/out/c/tags.scm +9 -0
- package/out/c/tree-sitter-c.wasm +0 -0
- package/out/c-sharp/highlights.scm +213 -0
- package/out/c-sharp/tags.scm +23 -0
- package/out/c-sharp/tree-sitter-c_sharp.wasm +0 -0
- package/out/cpp/highlights.scm +70 -0
- package/out/cpp/injections.scm +3 -0
- package/out/cpp/tags.scm +15 -0
- package/out/cpp/tree-sitter-cpp.wasm +0 -0
- package/out/css/highlights.scm +76 -0
- package/out/css/tree-sitter-css.wasm +0 -0
- package/out/dart/folds.scm +8 -0
- package/out/dart/highlights.scm +224 -0
- package/out/dart/tree-sitter-dart.wasm +0 -0
- package/out/elisp/highlights.scm +72 -0
- package/out/elisp/tags.scm +5 -0
- package/out/elisp/tree-sitter-elisp.wasm +0 -0
- package/out/elixir/highlights.scm +223 -0
- package/out/elixir/injections.scm +55 -0
- package/out/elixir/tags.scm +54 -0
- package/out/elixir/tree-sitter-elixir.wasm +0 -0
- package/out/embedded-template/highlights.scm +12 -0
- package/out/embedded-template/injections-ejs.scm +7 -0
- package/out/embedded-template/injections-erb.scm +7 -0
- package/out/embedded-template/injections-etlua.scm +7 -0
- package/out/embedded-template/tree-sitter-embedded_template.wasm +0 -0
- package/out/go/highlights.scm +123 -0
- package/out/go/tags.scm +42 -0
- package/out/go/tree-sitter-go.wasm +0 -0
- package/out/haskell/highlights.scm +443 -0
- package/out/haskell/injections.scm +76 -0
- package/out/haskell/locals.scm +4 -0
- package/out/haskell/tree-sitter-haskell.wasm +0 -0
- package/out/html/highlights.scm +13 -0
- package/out/html/injections.scm +7 -0
- package/out/html/tree-sitter-html.wasm +0 -0
- package/out/java/highlights.scm +149 -0
- package/out/java/tags.scm +20 -0
- package/out/java/tree-sitter-java.wasm +0 -0
- package/out/javascript/highlights-jsx.scm +8 -0
- package/out/javascript/highlights-params.scm +12 -0
- package/out/javascript/highlights.scm +204 -0
- package/out/javascript/injections.scm +31 -0
- package/out/javascript/locals.scm +23 -0
- package/out/javascript/tags.scm +99 -0
- package/out/javascript/tree-sitter-javascript.wasm +0 -0
- package/out/json/highlights.scm +16 -0
- package/out/json/tree-sitter-json.wasm +0 -0
- package/out/kotlin/highlights.scm +380 -0
- package/out/kotlin/tree-sitter-kotlin.wasm +0 -0
- package/out/objc/folds.scm +20 -0
- package/out/objc/highlights.scm +216 -0
- package/out/objc/indents.scm +1 -0
- package/out/objc/injections.scm +10 -0
- package/out/objc/locals.scm +1 -0
- package/out/objc/tree-sitter-objc.wasm +0 -0
- package/out/php/tree-sitter-php.wasm +0 -0
- package/out/php_only/tree-sitter-php_only.wasm +0 -0
- package/out/python/highlights.scm +137 -0
- package/out/python/tags.scm +14 -0
- package/out/python/tree-sitter-python.wasm +0 -0
- package/out/regex/highlights.scm +63 -0
- package/out/regex/tree-sitter-regex.wasm +0 -0
- package/out/ruby/highlights.scm +154 -0
- package/out/ruby/locals.scm +27 -0
- package/out/ruby/tags.scm +64 -0
- package/out/ruby/tree-sitter-ruby.wasm +0 -0
- package/out/rust/highlights.scm +161 -0
- package/out/rust/injections.scm +9 -0
- package/out/rust/tags.scm +60 -0
- package/out/rust/tree-sitter-rust.wasm +0 -0
- package/out/scala/highlights.scm +260 -0
- package/out/scala/indents.scm +30 -0
- package/out/scala/locals.scm +30 -0
- package/out/scala/tags.scm +66 -0
- package/out/scala/tree-sitter-scala.wasm +0 -0
- package/out/swift/folds.scm +35 -0
- package/out/swift/highlights.scm +336 -0
- package/out/swift/indents.scm +123 -0
- package/out/swift/injections.scm +10 -0
- package/out/swift/locals.scm +23 -0
- package/out/swift/outline.scm +66 -0
- package/out/swift/tags.scm +51 -0
- package/out/swift/textobjects.scm +19 -0
- package/out/swift/tree-sitter-swift.wasm +0 -0
- package/out/tsx/tree-sitter-tsx.wasm +0 -0
- package/out/typescript/tree-sitter-typescript.wasm +0 -0
- package/out/vue/tree-sitter-vue.wasm +0 -0
- package/package.json +64 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
(dotted_identifier_list) @string
|
|
2
|
+
|
|
3
|
+
; Methods
|
|
4
|
+
; --------------------
|
|
5
|
+
;; TODO: does not work
|
|
6
|
+
;(function_type
|
|
7
|
+
;name: (identifier) @method)
|
|
8
|
+
(super) @function
|
|
9
|
+
|
|
10
|
+
; Annotations
|
|
11
|
+
; --------------------
|
|
12
|
+
(annotation
|
|
13
|
+
name: (identifier) @attribute)
|
|
14
|
+
(marker_annotation
|
|
15
|
+
name: (identifier) @attribute)
|
|
16
|
+
|
|
17
|
+
; Operators and Tokens
|
|
18
|
+
; --------------------
|
|
19
|
+
(template_substitution
|
|
20
|
+
"$" @punctuation.special
|
|
21
|
+
"{" @punctuation.special
|
|
22
|
+
"}" @punctuation.special
|
|
23
|
+
) @none
|
|
24
|
+
|
|
25
|
+
(template_substitution
|
|
26
|
+
"$" @punctuation.special
|
|
27
|
+
(identifier_dollar_escaped) @variable
|
|
28
|
+
) @none
|
|
29
|
+
|
|
30
|
+
(escape_sequence) @string.escape
|
|
31
|
+
|
|
32
|
+
[
|
|
33
|
+
"@"
|
|
34
|
+
"=>"
|
|
35
|
+
".."
|
|
36
|
+
"??"
|
|
37
|
+
"=="
|
|
38
|
+
"?"
|
|
39
|
+
":"
|
|
40
|
+
"&&"
|
|
41
|
+
"%"
|
|
42
|
+
"<"
|
|
43
|
+
">"
|
|
44
|
+
"="
|
|
45
|
+
">="
|
|
46
|
+
"<="
|
|
47
|
+
"||"
|
|
48
|
+
(increment_operator)
|
|
49
|
+
(is_operator)
|
|
50
|
+
(prefix_operator)
|
|
51
|
+
(equality_operator)
|
|
52
|
+
(additive_operator)
|
|
53
|
+
] @operator
|
|
54
|
+
|
|
55
|
+
[
|
|
56
|
+
"("
|
|
57
|
+
")"
|
|
58
|
+
"["
|
|
59
|
+
"]"
|
|
60
|
+
"{"
|
|
61
|
+
"}"
|
|
62
|
+
] @punctuation.bracket
|
|
63
|
+
|
|
64
|
+
; Delimiters
|
|
65
|
+
; --------------------
|
|
66
|
+
[
|
|
67
|
+
";"
|
|
68
|
+
"."
|
|
69
|
+
","
|
|
70
|
+
] @punctuation.delimiter
|
|
71
|
+
|
|
72
|
+
; Types
|
|
73
|
+
; --------------------
|
|
74
|
+
(class_definition
|
|
75
|
+
name: (identifier) @type)
|
|
76
|
+
(constructor_signature
|
|
77
|
+
name: (identifier) @type)
|
|
78
|
+
;; TODO: does not work
|
|
79
|
+
;(type_identifier
|
|
80
|
+
;(identifier) @type)
|
|
81
|
+
(scoped_identifier
|
|
82
|
+
scope: (identifier) @type)
|
|
83
|
+
(function_signature
|
|
84
|
+
name: (identifier) @method)
|
|
85
|
+
(getter_signature
|
|
86
|
+
(identifier) @method)
|
|
87
|
+
(setter_signature
|
|
88
|
+
name: (identifier) @method)
|
|
89
|
+
(enum_declaration
|
|
90
|
+
name: (identifier) @type)
|
|
91
|
+
(enum_constant
|
|
92
|
+
name: (identifier) @type)
|
|
93
|
+
(type_identifier) @type
|
|
94
|
+
(void_type) @type
|
|
95
|
+
|
|
96
|
+
((scoped_identifier
|
|
97
|
+
scope: (identifier) @type
|
|
98
|
+
name: (identifier) @type)
|
|
99
|
+
(#match? @type "^[a-zA-Z]"))
|
|
100
|
+
|
|
101
|
+
(type_identifier) @type
|
|
102
|
+
|
|
103
|
+
; Variables
|
|
104
|
+
; --------------------
|
|
105
|
+
; var keyword
|
|
106
|
+
(inferred_type) @keyword
|
|
107
|
+
|
|
108
|
+
(const_builtin) @constant.builtin
|
|
109
|
+
(final_builtin) @constant.builtin
|
|
110
|
+
|
|
111
|
+
((identifier) @type
|
|
112
|
+
(#match? @type "^_?[A-Z]"))
|
|
113
|
+
|
|
114
|
+
("Function" @type)
|
|
115
|
+
|
|
116
|
+
; properties
|
|
117
|
+
; TODO: add method/call_expression to grammar and
|
|
118
|
+
; distinguish method call from variable access
|
|
119
|
+
(unconditional_assignable_selector
|
|
120
|
+
(identifier) @property)
|
|
121
|
+
|
|
122
|
+
; assignments
|
|
123
|
+
(assignment_expression
|
|
124
|
+
left: (assignable_expression) @variable)
|
|
125
|
+
|
|
126
|
+
(this) @variable.builtin
|
|
127
|
+
|
|
128
|
+
; Parameters
|
|
129
|
+
; --------------------
|
|
130
|
+
(formal_parameter
|
|
131
|
+
name: (identifier) @parameter)
|
|
132
|
+
|
|
133
|
+
(named_argument
|
|
134
|
+
(label (identifier) @parameter))
|
|
135
|
+
|
|
136
|
+
; Literals
|
|
137
|
+
; --------------------
|
|
138
|
+
[
|
|
139
|
+
(hex_integer_literal)
|
|
140
|
+
(decimal_integer_literal)
|
|
141
|
+
(decimal_floating_point_literal)
|
|
142
|
+
; TODO: inaccessbile nodes
|
|
143
|
+
; (octal_integer_literal)
|
|
144
|
+
; (hex_floating_point_literal)
|
|
145
|
+
] @number
|
|
146
|
+
|
|
147
|
+
(symbol_literal) @symbol
|
|
148
|
+
(string_literal) @string
|
|
149
|
+
(true) @boolean
|
|
150
|
+
(false) @boolean
|
|
151
|
+
(null_literal) @constant.builtin
|
|
152
|
+
|
|
153
|
+
(documentation_comment) @comment
|
|
154
|
+
(comment) @comment
|
|
155
|
+
|
|
156
|
+
; Keywords
|
|
157
|
+
; --------------------
|
|
158
|
+
["import" "library" "export"] @include
|
|
159
|
+
|
|
160
|
+
; Reserved words (cannot be used as identifiers)
|
|
161
|
+
; TODO: "rethrow" @keyword
|
|
162
|
+
[
|
|
163
|
+
; "assert"
|
|
164
|
+
(case_builtin)
|
|
165
|
+
"extension"
|
|
166
|
+
"on"
|
|
167
|
+
"class"
|
|
168
|
+
"enum"
|
|
169
|
+
"extends"
|
|
170
|
+
"in"
|
|
171
|
+
"is"
|
|
172
|
+
"new"
|
|
173
|
+
"return"
|
|
174
|
+
"super"
|
|
175
|
+
"with"
|
|
176
|
+
] @keyword
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
; Built in identifiers:
|
|
180
|
+
; alone these are marked as keywords
|
|
181
|
+
[
|
|
182
|
+
"abstract"
|
|
183
|
+
"as"
|
|
184
|
+
"async"
|
|
185
|
+
"async*"
|
|
186
|
+
"yield"
|
|
187
|
+
"sync*"
|
|
188
|
+
"await"
|
|
189
|
+
"covariant"
|
|
190
|
+
"deferred"
|
|
191
|
+
"dynamic"
|
|
192
|
+
"external"
|
|
193
|
+
"factory"
|
|
194
|
+
"get"
|
|
195
|
+
"implements"
|
|
196
|
+
"interface"
|
|
197
|
+
"library"
|
|
198
|
+
"operator"
|
|
199
|
+
"mixin"
|
|
200
|
+
"part"
|
|
201
|
+
"set"
|
|
202
|
+
"show"
|
|
203
|
+
"static"
|
|
204
|
+
"typedef"
|
|
205
|
+
] @keyword
|
|
206
|
+
|
|
207
|
+
; when used as an identifier:
|
|
208
|
+
((identifier) @variable.builtin
|
|
209
|
+
(#vim-match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$"))
|
|
210
|
+
|
|
211
|
+
["if" "else" "switch" "default"] @conditional
|
|
212
|
+
|
|
213
|
+
[
|
|
214
|
+
"try"
|
|
215
|
+
"throw"
|
|
216
|
+
"catch"
|
|
217
|
+
"finally"
|
|
218
|
+
(break_statement)
|
|
219
|
+
] @exception
|
|
220
|
+
|
|
221
|
+
["do" "while" "continue" "for"] @repeat
|
|
222
|
+
|
|
223
|
+
; Error
|
|
224
|
+
(ERROR) @error
|
|
Binary file
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
;; Special forms
|
|
2
|
+
[
|
|
3
|
+
"and"
|
|
4
|
+
"catch"
|
|
5
|
+
"cond"
|
|
6
|
+
"condition-case"
|
|
7
|
+
"defconst"
|
|
8
|
+
"defvar"
|
|
9
|
+
"function"
|
|
10
|
+
"if"
|
|
11
|
+
"interactive"
|
|
12
|
+
"lambda"
|
|
13
|
+
"let"
|
|
14
|
+
"let*"
|
|
15
|
+
"or"
|
|
16
|
+
"prog1"
|
|
17
|
+
"prog2"
|
|
18
|
+
"progn"
|
|
19
|
+
"quote"
|
|
20
|
+
"save-current-buffer"
|
|
21
|
+
"save-excursion"
|
|
22
|
+
"save-restriction"
|
|
23
|
+
"setq"
|
|
24
|
+
"setq-default"
|
|
25
|
+
"unwind-protect"
|
|
26
|
+
"while"
|
|
27
|
+
] @keyword
|
|
28
|
+
|
|
29
|
+
;; Function definitions
|
|
30
|
+
[
|
|
31
|
+
"defun"
|
|
32
|
+
"defsubst"
|
|
33
|
+
] @keyword
|
|
34
|
+
(function_definition name: (symbol) @function)
|
|
35
|
+
(function_definition parameters: (list (symbol) @variable.parameter))
|
|
36
|
+
(function_definition docstring: (string) @comment)
|
|
37
|
+
|
|
38
|
+
;; Highlight macro definitions the same way as function definitions.
|
|
39
|
+
"defmacro" @keyword
|
|
40
|
+
(macro_definition name: (symbol) @function)
|
|
41
|
+
(macro_definition parameters: (list (symbol) @variable.parameter))
|
|
42
|
+
(macro_definition docstring: (string) @comment)
|
|
43
|
+
|
|
44
|
+
(comment) @comment
|
|
45
|
+
|
|
46
|
+
(integer) @number
|
|
47
|
+
(float) @number
|
|
48
|
+
(char) @number
|
|
49
|
+
|
|
50
|
+
(string) @string
|
|
51
|
+
|
|
52
|
+
[
|
|
53
|
+
"("
|
|
54
|
+
")"
|
|
55
|
+
"#["
|
|
56
|
+
"["
|
|
57
|
+
"]"
|
|
58
|
+
] @punctuation.bracket
|
|
59
|
+
|
|
60
|
+
[
|
|
61
|
+
"`"
|
|
62
|
+
"#'"
|
|
63
|
+
"'"
|
|
64
|
+
","
|
|
65
|
+
",@"
|
|
66
|
+
] @operator
|
|
67
|
+
|
|
68
|
+
;; Highlight nil and t as constants, unlike other symbols
|
|
69
|
+
[
|
|
70
|
+
"nil"
|
|
71
|
+
"t"
|
|
72
|
+
] @constant.builtin
|
|
Binary file
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
; Punctuation
|
|
2
|
+
|
|
3
|
+
[
|
|
4
|
+
"%"
|
|
5
|
+
] @punctuation
|
|
6
|
+
|
|
7
|
+
[
|
|
8
|
+
","
|
|
9
|
+
";"
|
|
10
|
+
] @punctuation.delimiter
|
|
11
|
+
|
|
12
|
+
[
|
|
13
|
+
"("
|
|
14
|
+
")"
|
|
15
|
+
"["
|
|
16
|
+
"]"
|
|
17
|
+
"{"
|
|
18
|
+
"}"
|
|
19
|
+
"<<"
|
|
20
|
+
">>"
|
|
21
|
+
] @punctuation.bracket
|
|
22
|
+
|
|
23
|
+
; Literals
|
|
24
|
+
|
|
25
|
+
[
|
|
26
|
+
(boolean)
|
|
27
|
+
(nil)
|
|
28
|
+
] @constant
|
|
29
|
+
|
|
30
|
+
[
|
|
31
|
+
(integer)
|
|
32
|
+
(float)
|
|
33
|
+
] @number
|
|
34
|
+
|
|
35
|
+
(char) @constant
|
|
36
|
+
|
|
37
|
+
; Identifiers
|
|
38
|
+
|
|
39
|
+
; * regular
|
|
40
|
+
(identifier) @variable
|
|
41
|
+
|
|
42
|
+
; * unused
|
|
43
|
+
(
|
|
44
|
+
(identifier) @comment.unused
|
|
45
|
+
(#match? @comment.unused "^_")
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
; * special
|
|
49
|
+
(
|
|
50
|
+
(identifier) @constant.builtin
|
|
51
|
+
(#any-of? @constant.builtin "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__STACKTRACE__")
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
; Comment
|
|
55
|
+
|
|
56
|
+
(comment) @comment
|
|
57
|
+
|
|
58
|
+
; Quoted content
|
|
59
|
+
|
|
60
|
+
(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
|
|
61
|
+
|
|
62
|
+
(escape_sequence) @string.escape
|
|
63
|
+
|
|
64
|
+
[
|
|
65
|
+
(string)
|
|
66
|
+
(charlist)
|
|
67
|
+
] @string
|
|
68
|
+
|
|
69
|
+
[
|
|
70
|
+
(atom)
|
|
71
|
+
(quoted_atom)
|
|
72
|
+
(keyword)
|
|
73
|
+
(quoted_keyword)
|
|
74
|
+
] @string.special.symbol
|
|
75
|
+
|
|
76
|
+
; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters
|
|
77
|
+
|
|
78
|
+
(sigil
|
|
79
|
+
(sigil_name) @__name__
|
|
80
|
+
quoted_start: _ @string.special
|
|
81
|
+
quoted_end: _ @string.special) @string.special
|
|
82
|
+
|
|
83
|
+
(sigil
|
|
84
|
+
(sigil_name) @__name__
|
|
85
|
+
quoted_start: _ @string
|
|
86
|
+
quoted_end: _ @string
|
|
87
|
+
(#match? @__name__ "^[sS]$")) @string
|
|
88
|
+
|
|
89
|
+
(sigil
|
|
90
|
+
(sigil_name) @__name__
|
|
91
|
+
quoted_start: _ @string.regex
|
|
92
|
+
quoted_end: _ @string.regex
|
|
93
|
+
(#match? @__name__ "^[rR]$")) @string.regex
|
|
94
|
+
|
|
95
|
+
; Calls
|
|
96
|
+
|
|
97
|
+
; * local function call
|
|
98
|
+
(call
|
|
99
|
+
target: (identifier) @function)
|
|
100
|
+
|
|
101
|
+
; * remote function call
|
|
102
|
+
(call
|
|
103
|
+
target: (dot
|
|
104
|
+
right: (identifier) @function))
|
|
105
|
+
|
|
106
|
+
; * field without parentheses or block
|
|
107
|
+
(call
|
|
108
|
+
target: (dot
|
|
109
|
+
right: (identifier) @property)
|
|
110
|
+
.)
|
|
111
|
+
|
|
112
|
+
; * remote call without parentheses or block (overrides above)
|
|
113
|
+
(call
|
|
114
|
+
target: (dot
|
|
115
|
+
left: [
|
|
116
|
+
(alias)
|
|
117
|
+
(atom)
|
|
118
|
+
]
|
|
119
|
+
right: (identifier) @function)
|
|
120
|
+
.)
|
|
121
|
+
|
|
122
|
+
; * definition keyword
|
|
123
|
+
(call
|
|
124
|
+
target: (identifier) @keyword
|
|
125
|
+
(#any-of? @keyword "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
|
|
126
|
+
|
|
127
|
+
; * kernel or special forms keyword
|
|
128
|
+
(call
|
|
129
|
+
target: (identifier) @keyword
|
|
130
|
+
(#any-of? @keyword "alias" "case" "cond" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
|
|
131
|
+
|
|
132
|
+
; * just identifier in function definition
|
|
133
|
+
(call
|
|
134
|
+
target: (identifier) @keyword
|
|
135
|
+
(arguments
|
|
136
|
+
[
|
|
137
|
+
(identifier) @function
|
|
138
|
+
(binary_operator
|
|
139
|
+
left: (identifier) @function
|
|
140
|
+
operator: "when")
|
|
141
|
+
])
|
|
142
|
+
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
|
143
|
+
|
|
144
|
+
; * pipe into identifier (function call)
|
|
145
|
+
(binary_operator
|
|
146
|
+
operator: "|>"
|
|
147
|
+
right: (identifier) @function)
|
|
148
|
+
|
|
149
|
+
; * pipe into identifier (definition)
|
|
150
|
+
(call
|
|
151
|
+
target: (identifier) @keyword
|
|
152
|
+
(arguments
|
|
153
|
+
(binary_operator
|
|
154
|
+
operator: "|>"
|
|
155
|
+
right: (identifier) @variable))
|
|
156
|
+
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
|
157
|
+
|
|
158
|
+
; * pipe into field without parentheses (function call)
|
|
159
|
+
(binary_operator
|
|
160
|
+
operator: "|>"
|
|
161
|
+
right: (call
|
|
162
|
+
target: (dot
|
|
163
|
+
right: (identifier) @function)))
|
|
164
|
+
|
|
165
|
+
; Operators
|
|
166
|
+
|
|
167
|
+
; * capture operand
|
|
168
|
+
(unary_operator
|
|
169
|
+
operator: "&"
|
|
170
|
+
operand: (integer) @operator)
|
|
171
|
+
|
|
172
|
+
(operator_identifier) @operator
|
|
173
|
+
|
|
174
|
+
(unary_operator
|
|
175
|
+
operator: _ @operator)
|
|
176
|
+
|
|
177
|
+
(binary_operator
|
|
178
|
+
operator: _ @operator)
|
|
179
|
+
|
|
180
|
+
(dot
|
|
181
|
+
operator: _ @operator)
|
|
182
|
+
|
|
183
|
+
(stab_clause
|
|
184
|
+
operator: _ @operator)
|
|
185
|
+
|
|
186
|
+
; * module attribute
|
|
187
|
+
(unary_operator
|
|
188
|
+
operator: "@" @attribute
|
|
189
|
+
operand: [
|
|
190
|
+
(identifier) @attribute
|
|
191
|
+
(call
|
|
192
|
+
target: (identifier) @attribute)
|
|
193
|
+
(boolean) @attribute
|
|
194
|
+
(nil) @attribute
|
|
195
|
+
])
|
|
196
|
+
|
|
197
|
+
; * doc string
|
|
198
|
+
(unary_operator
|
|
199
|
+
operator: "@" @comment.doc
|
|
200
|
+
operand: (call
|
|
201
|
+
target: (identifier) @comment.doc.__attribute__
|
|
202
|
+
(arguments
|
|
203
|
+
[
|
|
204
|
+
(string) @comment.doc
|
|
205
|
+
(charlist) @comment.doc
|
|
206
|
+
(sigil
|
|
207
|
+
quoted_start: _ @comment.doc
|
|
208
|
+
quoted_end: _ @comment.doc) @comment.doc
|
|
209
|
+
(boolean) @comment.doc
|
|
210
|
+
]))
|
|
211
|
+
(#any-of? @comment.doc.__attribute__ "moduledoc" "typedoc" "doc"))
|
|
212
|
+
|
|
213
|
+
; Module
|
|
214
|
+
|
|
215
|
+
(alias) @module
|
|
216
|
+
|
|
217
|
+
(call
|
|
218
|
+
target: (dot
|
|
219
|
+
left: (atom) @module))
|
|
220
|
+
|
|
221
|
+
; Reserved keywords
|
|
222
|
+
|
|
223
|
+
["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
; Phoenix HTML template
|
|
2
|
+
((sigil
|
|
3
|
+
(sigil_name) @_sigil_name
|
|
4
|
+
(quoted_content) @injection.content)
|
|
5
|
+
(#any-of? @_sigil_name "H" "LVN" "HOLO")
|
|
6
|
+
(#set! injection.language "heex")
|
|
7
|
+
(#set! injection.combined))
|
|
8
|
+
|
|
9
|
+
; Regex
|
|
10
|
+
((sigil
|
|
11
|
+
(sigil_name) @_sigil_name
|
|
12
|
+
(quoted_content) @injection.content)
|
|
13
|
+
(#any-of? @_sigil_name "r" "R")
|
|
14
|
+
(#set! injection.language "regex")
|
|
15
|
+
(#set! injection.combined))
|
|
16
|
+
|
|
17
|
+
; SQL injection
|
|
18
|
+
((sigil
|
|
19
|
+
(sigil_name) @_sigil_name
|
|
20
|
+
(quoted_content) @injection.content)
|
|
21
|
+
(#eq? @_sigil_name "SQL")
|
|
22
|
+
(#set! injection.language "sql")
|
|
23
|
+
(#set! injection.combined))
|
|
24
|
+
|
|
25
|
+
; Markdown
|
|
26
|
+
((sigil
|
|
27
|
+
(sigil_name) @_sigil_name
|
|
28
|
+
(quoted_content) @injection.content)
|
|
29
|
+
(#eq? @_sigil_name "MD")
|
|
30
|
+
(#set! injection.language "markdown")
|
|
31
|
+
(#set! injection.combined))
|
|
32
|
+
|
|
33
|
+
; Python
|
|
34
|
+
((sigil
|
|
35
|
+
(sigil_name) @_sigil_name
|
|
36
|
+
(quoted_content) @injection.content)
|
|
37
|
+
(#eq? @_sigil_name "PY")
|
|
38
|
+
(#set! injection.language "python")
|
|
39
|
+
(#set! injection.combined))
|
|
40
|
+
|
|
41
|
+
; JavaScript
|
|
42
|
+
((sigil
|
|
43
|
+
(sigil_name) @_sigil_name
|
|
44
|
+
(quoted_content) @injection.content)
|
|
45
|
+
(#eq? @_sigil_name "JS")
|
|
46
|
+
(#set! injection.language "javascript")
|
|
47
|
+
(#set! injection.combined))
|
|
48
|
+
|
|
49
|
+
; Vue
|
|
50
|
+
((sigil
|
|
51
|
+
(sigil_name) @_sigil_name
|
|
52
|
+
(quoted_content) @injection.content)
|
|
53
|
+
(#eq? @_sigil_name "VUE")
|
|
54
|
+
(#set! injection.language "vue")
|
|
55
|
+
(#set! injection.combined))
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
; Definitions
|
|
2
|
+
|
|
3
|
+
; * modules and protocols
|
|
4
|
+
(call
|
|
5
|
+
target: (identifier) @ignore
|
|
6
|
+
(arguments (alias) @name)
|
|
7
|
+
(#any-of? @ignore "defmodule" "defprotocol")) @definition.module
|
|
8
|
+
|
|
9
|
+
; * functions/macros
|
|
10
|
+
(call
|
|
11
|
+
target: (identifier) @ignore
|
|
12
|
+
(arguments
|
|
13
|
+
[
|
|
14
|
+
; zero-arity functions with no parentheses
|
|
15
|
+
(identifier) @name
|
|
16
|
+
; regular function clause
|
|
17
|
+
(call target: (identifier) @name)
|
|
18
|
+
; function clause with a guard clause
|
|
19
|
+
(binary_operator
|
|
20
|
+
left: (call target: (identifier) @name)
|
|
21
|
+
operator: "when")
|
|
22
|
+
])
|
|
23
|
+
(#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp")) @definition.function
|
|
24
|
+
|
|
25
|
+
; References
|
|
26
|
+
|
|
27
|
+
; ignore calls to kernel/special-forms keywords
|
|
28
|
+
(call
|
|
29
|
+
target: (identifier) @ignore
|
|
30
|
+
(#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defmodule" "defprotocol" "defimpl" "defstruct" "defexception" "defoverridable" "alias" "case" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
|
|
31
|
+
|
|
32
|
+
; ignore module attributes
|
|
33
|
+
(unary_operator
|
|
34
|
+
operator: "@"
|
|
35
|
+
operand: (call
|
|
36
|
+
target: (identifier) @ignore))
|
|
37
|
+
|
|
38
|
+
; * function call
|
|
39
|
+
(call
|
|
40
|
+
target: [
|
|
41
|
+
; local
|
|
42
|
+
(identifier) @name
|
|
43
|
+
; remote
|
|
44
|
+
(dot
|
|
45
|
+
right: (identifier) @name)
|
|
46
|
+
]) @reference.call
|
|
47
|
+
|
|
48
|
+
; * pipe into function call
|
|
49
|
+
(binary_operator
|
|
50
|
+
operator: "|>"
|
|
51
|
+
right: (identifier) @name) @reference.call
|
|
52
|
+
|
|
53
|
+
; * modules
|
|
54
|
+
(alias) @name @reference.module
|
|
Binary file
|
|
Binary file
|