@acristoffers/tree-sitter-matlab 1.2.4
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 +19 -0
- package/README.md +97 -0
- package/binding.gyp +35 -0
- package/bindings/node/binding.cc +19 -0
- package/bindings/node/binding_test.js +9 -0
- package/bindings/node/index.d.ts +27 -0
- package/bindings/node/index.js +11 -0
- package/grammar.js +1000 -0
- package/package.json +59 -0
- package/queries/emacs/highlights.scm +176 -0
- package/queries/emacs/textobjects.scm +93 -0
- package/queries/helix/context.scm +41 -0
- package/queries/helix/folds.scm +11 -0
- package/queries/helix/highlights.scm +127 -0
- package/queries/helix/indents.scm +24 -0
- package/queries/helix/injections.scm +2 -0
- package/queries/helix/locals.scm +19 -0
- package/queries/helix/textobjects.scm +9 -0
- package/queries/neovim/context.scm +41 -0
- package/queries/neovim/folds.scm +11 -0
- package/queries/neovim/highlights.scm +157 -0
- package/queries/neovim/indents.scm +36 -0
- package/queries/neovim/injections.scm +1 -0
- package/queries/neovim/locals.scm +20 -0
- package/queries/neovim/tags.scm +10 -0
- package/queries/neovim/textobjects.scm +110 -0
- package/src/grammar.json +6184 -0
- package/src/node-types.json +3719 -0
- package/src/parser.c +113495 -0
- package/src/scanner.c +1094 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +286 -0
- package/tree-sitter.json +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acristoffers/tree-sitter-matlab",
|
|
3
|
+
"version": "1.2.4",
|
|
4
|
+
"description": "MATLAB tree-sitter parser",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"incremental",
|
|
7
|
+
"parsing",
|
|
8
|
+
"tree-sitter",
|
|
9
|
+
"matlab"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/acristoffers/tree-sitter-matlab#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/acristoffers/tree-sitter-matlab/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/acristoffers/tree-sitter-matlab.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Álan Crístoffer e Sousa",
|
|
21
|
+
"type": "commonjs",
|
|
22
|
+
"main": "bindings/node",
|
|
23
|
+
"types": "bindings/node",
|
|
24
|
+
"directories": {
|
|
25
|
+
"test": "test"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"grammar.js",
|
|
29
|
+
"tree-sitter.json",
|
|
30
|
+
"binding.gyp",
|
|
31
|
+
"prebuilds/**",
|
|
32
|
+
"bindings/node/*",
|
|
33
|
+
"queries/*",
|
|
34
|
+
"src/**",
|
|
35
|
+
"*.wasm"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"install": "node-gyp-build",
|
|
39
|
+
"prestart": "tree-sitter build --wasm",
|
|
40
|
+
"start": "tree-sitter playground",
|
|
41
|
+
"test": "node --test bindings/node/*_test.js"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"node-addon-api": "^8.2.1",
|
|
45
|
+
"node-gyp-build": "^4.8.2"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"prebuildify": "^6.0.1",
|
|
49
|
+
"tree-sitter-cli": "^0.25.3"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"tree-sitter": "^0.21.1"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"tree-sitter": {
|
|
56
|
+
"optional": true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
; attribute
|
|
2
|
+
; comment
|
|
3
|
+
; constant
|
|
4
|
+
; constant.builtin
|
|
5
|
+
; constructor
|
|
6
|
+
; doc
|
|
7
|
+
; embedded
|
|
8
|
+
; escape
|
|
9
|
+
; function
|
|
10
|
+
; function.builtin
|
|
11
|
+
; function.call
|
|
12
|
+
; function.macro
|
|
13
|
+
; function.special
|
|
14
|
+
; keyword
|
|
15
|
+
; label
|
|
16
|
+
; method
|
|
17
|
+
; method.call
|
|
18
|
+
; number
|
|
19
|
+
; operator
|
|
20
|
+
; property
|
|
21
|
+
; property.definition
|
|
22
|
+
; punctuation
|
|
23
|
+
; punctuation.bracket
|
|
24
|
+
; punctuation.delimiter
|
|
25
|
+
; punctuation.special
|
|
26
|
+
; string
|
|
27
|
+
; string.special
|
|
28
|
+
; tag
|
|
29
|
+
; type
|
|
30
|
+
; type.argument
|
|
31
|
+
; type.builtin
|
|
32
|
+
; type.parameter
|
|
33
|
+
; type.super
|
|
34
|
+
; variable
|
|
35
|
+
; variable.builtin
|
|
36
|
+
; variable.parameter
|
|
37
|
+
; variable.special
|
|
38
|
+
|
|
39
|
+
; Errors
|
|
40
|
+
|
|
41
|
+
(ERROR) @error
|
|
42
|
+
|
|
43
|
+
; Constants
|
|
44
|
+
|
|
45
|
+
(events (identifier) @constant)
|
|
46
|
+
(attribute (identifier) @constant)
|
|
47
|
+
|
|
48
|
+
"~" @constant.builtin
|
|
49
|
+
|
|
50
|
+
; Fields/Properties
|
|
51
|
+
|
|
52
|
+
(field_expression field: (identifier) @property)
|
|
53
|
+
(superclass "." (identifier) @property)
|
|
54
|
+
(property_name "." (identifier) @property)
|
|
55
|
+
(property name: (identifier) @property)
|
|
56
|
+
|
|
57
|
+
; Types
|
|
58
|
+
|
|
59
|
+
(class_definition name: (identifier) @type)
|
|
60
|
+
(attributes (identifier) @constant)
|
|
61
|
+
(enum . (identifier) @type)
|
|
62
|
+
|
|
63
|
+
; Functions
|
|
64
|
+
|
|
65
|
+
(function_definition
|
|
66
|
+
"function" @keyword
|
|
67
|
+
name: (identifier) @function
|
|
68
|
+
[ "end" "endfunction" ]? @keyword)
|
|
69
|
+
|
|
70
|
+
(function_signature name: (identifier) @function)
|
|
71
|
+
|
|
72
|
+
(function_call name: (identifier) @function.call)
|
|
73
|
+
|
|
74
|
+
(handle_operator (identifier) @function)
|
|
75
|
+
(validation_functions (identifier) @function)
|
|
76
|
+
|
|
77
|
+
(command (command_name) @function.macro)
|
|
78
|
+
(command_argument) @string
|
|
79
|
+
|
|
80
|
+
(return_statement) @keyword
|
|
81
|
+
|
|
82
|
+
; Parameters
|
|
83
|
+
|
|
84
|
+
(lambda (arguments (identifier) @variable.parameter))
|
|
85
|
+
(function_arguments (identifier) @variable.parameter)
|
|
86
|
+
|
|
87
|
+
; Conditionals
|
|
88
|
+
|
|
89
|
+
(if_statement [ "if" "end" ] @keyword)
|
|
90
|
+
(elseif_clause "elseif" @keyword)
|
|
91
|
+
(else_clause "else" @keyword)
|
|
92
|
+
(switch_statement [ "switch" "end" ] @keyword)
|
|
93
|
+
(case_clause "case" @keyword)
|
|
94
|
+
(otherwise_clause "otherwise" @keyword)
|
|
95
|
+
(break_statement) @keyword
|
|
96
|
+
|
|
97
|
+
; Repeats
|
|
98
|
+
|
|
99
|
+
(for_statement [ "for" "parfor" "end" ] @keyword)
|
|
100
|
+
(while_statement [ "while" "end" ] @keyword)
|
|
101
|
+
(continue_statement) @keyword
|
|
102
|
+
|
|
103
|
+
; Exceptions
|
|
104
|
+
|
|
105
|
+
(try_statement [ "try" "end" ] @keyword)
|
|
106
|
+
(catch_clause "catch" @keyword)
|
|
107
|
+
|
|
108
|
+
; Punctuation
|
|
109
|
+
|
|
110
|
+
[ ";" "," "." ] @punctuation.delimiter
|
|
111
|
+
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
|
112
|
+
|
|
113
|
+
; Literals
|
|
114
|
+
|
|
115
|
+
(escape_sequence) @escape
|
|
116
|
+
(formatting_sequence) @escape
|
|
117
|
+
(string) @string
|
|
118
|
+
(number) @number
|
|
119
|
+
|
|
120
|
+
; Comments
|
|
121
|
+
|
|
122
|
+
[ (comment) (line_continuation) ] @comment @spell
|
|
123
|
+
|
|
124
|
+
; Operators
|
|
125
|
+
|
|
126
|
+
(unary_operator ["+" "-"] @number)
|
|
127
|
+
|
|
128
|
+
[
|
|
129
|
+
"+"
|
|
130
|
+
".+"
|
|
131
|
+
"-"
|
|
132
|
+
".*"
|
|
133
|
+
"*"
|
|
134
|
+
".*"
|
|
135
|
+
"/"
|
|
136
|
+
"./"
|
|
137
|
+
"\\"
|
|
138
|
+
".\\"
|
|
139
|
+
"^"
|
|
140
|
+
".^"
|
|
141
|
+
"'"
|
|
142
|
+
".'"
|
|
143
|
+
"|"
|
|
144
|
+
"&"
|
|
145
|
+
"?"
|
|
146
|
+
"@"
|
|
147
|
+
"<"
|
|
148
|
+
"<="
|
|
149
|
+
">"
|
|
150
|
+
">="
|
|
151
|
+
"=="
|
|
152
|
+
"~="
|
|
153
|
+
"="
|
|
154
|
+
"&&"
|
|
155
|
+
"||"
|
|
156
|
+
":"
|
|
157
|
+
] @operator
|
|
158
|
+
|
|
159
|
+
; Assignments
|
|
160
|
+
|
|
161
|
+
(assignment left: (_) @variable)
|
|
162
|
+
(multioutput_variable (_) @variable)
|
|
163
|
+
|
|
164
|
+
; Keywords
|
|
165
|
+
|
|
166
|
+
[
|
|
167
|
+
"arguments"
|
|
168
|
+
"classdef"
|
|
169
|
+
"end"
|
|
170
|
+
"enumeration"
|
|
171
|
+
"events"
|
|
172
|
+
"global"
|
|
173
|
+
"methods"
|
|
174
|
+
"persistent"
|
|
175
|
+
"properties"
|
|
176
|
+
] @keyword
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
(_ (block) @block.inner) @block.outer
|
|
2
|
+
(block (_) @statement.outer)
|
|
3
|
+
(source_file (_) @statement.outer)
|
|
4
|
+
|
|
5
|
+
(function_call
|
|
6
|
+
(arguments)? @call.inner) @call.outer
|
|
7
|
+
((arguments ","? @parameter.outer._start . (_) @parameter.outer._end @parameter.inner . ))
|
|
8
|
+
((arguments (_) @parameter.outer._start @parameter.inner . "," @parameter.outer._end))
|
|
9
|
+
|
|
10
|
+
(command) @call.outer
|
|
11
|
+
(command (command_argument) @parameter.inner @parameter.outer)
|
|
12
|
+
(command
|
|
13
|
+
(command_argument) @call.inner._start (command_argument)* @call.inner._end .)
|
|
14
|
+
|
|
15
|
+
(if_statement
|
|
16
|
+
(block) @conditional.inner) @conditional.outer
|
|
17
|
+
(if_statement
|
|
18
|
+
(elseif_clause
|
|
19
|
+
(block) @conditional.inner))
|
|
20
|
+
(if_statement
|
|
21
|
+
(else_clause
|
|
22
|
+
(block) @conditional.inner))
|
|
23
|
+
|
|
24
|
+
(switch_statement
|
|
25
|
+
(case_clause (block) @conditional.inner)) @conditional.outer
|
|
26
|
+
|
|
27
|
+
(switch_statement
|
|
28
|
+
(otherwise_clause (block) @conditional.inner))
|
|
29
|
+
|
|
30
|
+
(for_statement
|
|
31
|
+
(block) @loop.inner) @loop.outer
|
|
32
|
+
(while_statement
|
|
33
|
+
(block) @loop.inner) @loop.outer
|
|
34
|
+
|
|
35
|
+
(lambda
|
|
36
|
+
expression: (_) @function.inner) @function.outer
|
|
37
|
+
|
|
38
|
+
(global_operator
|
|
39
|
+
(identifier) @parameter.inner)
|
|
40
|
+
|
|
41
|
+
(persistent_operator
|
|
42
|
+
(identifier) @parameter.inner)
|
|
43
|
+
|
|
44
|
+
(function_definition
|
|
45
|
+
(block) @function.inner) @function.outer
|
|
46
|
+
|
|
47
|
+
(function_output (identifier) @parameter.inner @parameter.outer)
|
|
48
|
+
|
|
49
|
+
((multioutput_variable ","? @parameter.outer._start . (_) @parameter.outer._end @parameter.inner . ))
|
|
50
|
+
((multioutput_variable (_) @parameter.inner @parameter.outer._start . "," @parameter.outer._end))
|
|
51
|
+
|
|
52
|
+
((function_arguments ","? @parameter.outer._start . (_) @parameter.inner._end @parameter.inner . ))
|
|
53
|
+
((function_arguments (_) @parameter.outer._start @parameter.inner . "," @parameter.outer._end))
|
|
54
|
+
|
|
55
|
+
(try_statement
|
|
56
|
+
(block) @conditional.inner) @conditional.outer
|
|
57
|
+
(catch_clause
|
|
58
|
+
(identifier) @parameter.inner @parameter.outer)
|
|
59
|
+
(catch_clause
|
|
60
|
+
(block) @conditional.inner)
|
|
61
|
+
|
|
62
|
+
(class_definition) @class.outer
|
|
63
|
+
|
|
64
|
+
(number) @number.inner
|
|
65
|
+
(_ (return_statement) @return.inner @return.outer)
|
|
66
|
+
(comment) @comment.outer
|
|
67
|
+
|
|
68
|
+
(matrix (row) @parameter.outer)
|
|
69
|
+
(cell (row) @parameter.outer)
|
|
70
|
+
(row (_) @parameter.inner)
|
|
71
|
+
|
|
72
|
+
(assignment
|
|
73
|
+
left: (_) @assignment.lhs
|
|
74
|
+
(_) @assignment.rhs) @assignment.outer
|
|
75
|
+
|
|
76
|
+
((superclasses "&"? @parameter.outer._start . (_) @parameter.inner @parameter.outer._end . ))
|
|
77
|
+
((superclasses (_) @parameter.inner @parameter.outer._start . "&" @parameter.outer._end))
|
|
78
|
+
|
|
79
|
+
(enum (identifier) @parameter.inner @parameter.outer)
|
|
80
|
+
|
|
81
|
+
(property name: (_) @parameter.outer @parameter.inner)
|
|
82
|
+
|
|
83
|
+
((enum ","? @parameter.outer._start . (_) @parameter.inner @parameter.outer._end . ))
|
|
84
|
+
((enum (_) @parameter.inner @parameter.outer._start . "," @parameter.outer._end))
|
|
85
|
+
|
|
86
|
+
((validation_functions ","? @paramenter.outer._start . (_) @parameter.inner @parameter.outer._end . ))
|
|
87
|
+
((validation_functions (_) @paramter.outer._start @parameter.inner . "," @parameter.outer._end))
|
|
88
|
+
|
|
89
|
+
((dimensions ","? @parameter.outer._start @_start . (_) @parameter.inner @parameter.outer._end . ))
|
|
90
|
+
((dimensions (_) @parameter.outer._start @parameter.inner . "," @parameter.outer._end))
|
|
91
|
+
|
|
92
|
+
((attributes ","? @parameter.outer._start . (_) @parameter.inner @parameter.outer._end . ))
|
|
93
|
+
((attributes (_) @parameter.outer._start @parameter.inner . "," @parameter.outer._end))
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
(function_definition
|
|
2
|
+
(block (_) @context.end)
|
|
3
|
+
) @context
|
|
4
|
+
|
|
5
|
+
(while_statement
|
|
6
|
+
(block (_) @context.end)
|
|
7
|
+
) @context
|
|
8
|
+
|
|
9
|
+
(for_statement
|
|
10
|
+
(block (_) @context.end)
|
|
11
|
+
) @context
|
|
12
|
+
|
|
13
|
+
(if_statement
|
|
14
|
+
(block (_) @context.end)
|
|
15
|
+
) @context
|
|
16
|
+
|
|
17
|
+
(elseif_clause
|
|
18
|
+
(block (_) @context.end)
|
|
19
|
+
) @context
|
|
20
|
+
|
|
21
|
+
(else_clause
|
|
22
|
+
(block (_) @context.end)
|
|
23
|
+
) @context
|
|
24
|
+
|
|
25
|
+
(switch_statement) @context
|
|
26
|
+
|
|
27
|
+
(case_clause
|
|
28
|
+
(block (_) @context.end)
|
|
29
|
+
) @context
|
|
30
|
+
|
|
31
|
+
(otherwise_clause
|
|
32
|
+
(block (_) @context.end)
|
|
33
|
+
) @context
|
|
34
|
+
|
|
35
|
+
(try_statement
|
|
36
|
+
"try"
|
|
37
|
+
(block (_) @context.end) @context
|
|
38
|
+
"end")
|
|
39
|
+
(catch_clause
|
|
40
|
+
"catch"
|
|
41
|
+
(block (_) @context.end) @context)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
; Constants
|
|
2
|
+
|
|
3
|
+
(events (identifier) @constant)
|
|
4
|
+
(attribute (identifier) @constant)
|
|
5
|
+
|
|
6
|
+
"~" @constant.builtin
|
|
7
|
+
|
|
8
|
+
; Fields/Properties
|
|
9
|
+
|
|
10
|
+
(superclass "." (identifier) @variable.other.member)
|
|
11
|
+
(property_name "." (identifier) @variable.other.member)
|
|
12
|
+
(property name: (identifier) @variable.other.member)
|
|
13
|
+
|
|
14
|
+
; Types
|
|
15
|
+
|
|
16
|
+
(class_definition name: (identifier) @keyword.storage.type)
|
|
17
|
+
(attributes (identifier) @constant)
|
|
18
|
+
(enum . (identifier) @type.enum.variant)
|
|
19
|
+
|
|
20
|
+
; Functions
|
|
21
|
+
|
|
22
|
+
(function_definition
|
|
23
|
+
"function" @keyword.function
|
|
24
|
+
name: (identifier) @function
|
|
25
|
+
[ "end" "endfunction" ]? @keyword.function)
|
|
26
|
+
|
|
27
|
+
(function_signature name: (identifier) @function)
|
|
28
|
+
(function_call name: (identifier) @function)
|
|
29
|
+
(handle_operator (identifier) @function)
|
|
30
|
+
(validation_functions (identifier) @function)
|
|
31
|
+
(command (command_name) @function.macro)
|
|
32
|
+
(command_argument) @string
|
|
33
|
+
(return_statement) @keyword.control.return
|
|
34
|
+
|
|
35
|
+
; Assignments
|
|
36
|
+
|
|
37
|
+
(assignment left: (_) @variable)
|
|
38
|
+
(multioutput_variable (_) @variable)
|
|
39
|
+
|
|
40
|
+
; Parameters
|
|
41
|
+
|
|
42
|
+
(function_arguments (identifier) @variable.parameter)
|
|
43
|
+
|
|
44
|
+
; Conditionals
|
|
45
|
+
|
|
46
|
+
(if_statement [ "if" "end" ] @keyword.control.conditional)
|
|
47
|
+
(elseif_clause "elseif" @keyword.control.conditional)
|
|
48
|
+
(else_clause "else" @keyword.control.conditional)
|
|
49
|
+
(switch_statement [ "switch" "end" ] @keyword.control.conditional)
|
|
50
|
+
(case_clause "case" @keyword.control.conditional)
|
|
51
|
+
(otherwise_clause "otherwise" @keyword.control.conditional)
|
|
52
|
+
(break_statement) @keyword.control.conditional
|
|
53
|
+
|
|
54
|
+
; Repeats
|
|
55
|
+
|
|
56
|
+
(for_statement [ "for" "parfor" "end" ] @keyword.control.repeat)
|
|
57
|
+
(while_statement [ "while" "end" ] @keyword.control.repeat)
|
|
58
|
+
(continue_statement) @keyword.control.repeat
|
|
59
|
+
|
|
60
|
+
; Exceptions
|
|
61
|
+
|
|
62
|
+
(try_statement [ "try" "end" ] @keyword.control.exception)
|
|
63
|
+
(catch_clause "catch" @keyword.control.exception)
|
|
64
|
+
|
|
65
|
+
; Punctuation
|
|
66
|
+
|
|
67
|
+
[ ";" "," "." ] @punctuation.delimiter
|
|
68
|
+
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
|
69
|
+
|
|
70
|
+
; Literals
|
|
71
|
+
|
|
72
|
+
(escape_sequence) @constant.character.escape
|
|
73
|
+
(formatting_sequence) @constant.character.escape
|
|
74
|
+
(string) @string
|
|
75
|
+
(number) @constant.numeric.float
|
|
76
|
+
(unary_operator ["+" "-"] @constant.numeric.float)
|
|
77
|
+
|
|
78
|
+
; Comments
|
|
79
|
+
|
|
80
|
+
[ (comment) (line_continuation) ] @comment.line
|
|
81
|
+
|
|
82
|
+
; Operators
|
|
83
|
+
|
|
84
|
+
[
|
|
85
|
+
"+"
|
|
86
|
+
".+"
|
|
87
|
+
"-"
|
|
88
|
+
".*"
|
|
89
|
+
"*"
|
|
90
|
+
".*"
|
|
91
|
+
"/"
|
|
92
|
+
"./"
|
|
93
|
+
"\\"
|
|
94
|
+
".\\"
|
|
95
|
+
"^"
|
|
96
|
+
".^"
|
|
97
|
+
"'"
|
|
98
|
+
".'"
|
|
99
|
+
"|"
|
|
100
|
+
"&"
|
|
101
|
+
"?"
|
|
102
|
+
"@"
|
|
103
|
+
"<"
|
|
104
|
+
"<="
|
|
105
|
+
">"
|
|
106
|
+
">="
|
|
107
|
+
"=="
|
|
108
|
+
"~="
|
|
109
|
+
"="
|
|
110
|
+
"&&"
|
|
111
|
+
"||"
|
|
112
|
+
":"
|
|
113
|
+
] @operator
|
|
114
|
+
|
|
115
|
+
; Keywords
|
|
116
|
+
|
|
117
|
+
"classdef" @keyword.storage.type
|
|
118
|
+
[
|
|
119
|
+
"arguments"
|
|
120
|
+
"end"
|
|
121
|
+
"enumeration"
|
|
122
|
+
"events"
|
|
123
|
+
"global"
|
|
124
|
+
"methods"
|
|
125
|
+
"persistent"
|
|
126
|
+
"properties"
|
|
127
|
+
] @keyword
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
(arguments_statement)
|
|
3
|
+
(if_statement)
|
|
4
|
+
(for_statement)
|
|
5
|
+
(while_statement)
|
|
6
|
+
(switch_statement)
|
|
7
|
+
(try_statement)
|
|
8
|
+
(function_definition)
|
|
9
|
+
(class_definition)
|
|
10
|
+
(enumeration)
|
|
11
|
+
(events)
|
|
12
|
+
(methods)
|
|
13
|
+
(properties)
|
|
14
|
+
] @indent
|
|
15
|
+
|
|
16
|
+
[
|
|
17
|
+
(elseif_clause)
|
|
18
|
+
(else_clause)
|
|
19
|
+
(case_clause)
|
|
20
|
+
(otherwise_clause)
|
|
21
|
+
(catch_clause)
|
|
22
|
+
] @indent @extend
|
|
23
|
+
|
|
24
|
+
[ "end" ] @outdent
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
(function_definition name: (identifier) @local.definition ?) @local.scope
|
|
2
|
+
(function_arguments (identifier)* @local.definition)
|
|
3
|
+
|
|
4
|
+
(lambda (arguments (identifier) @local.definition)) @local.scope
|
|
5
|
+
|
|
6
|
+
(assignment left: ((function_call
|
|
7
|
+
name: (identifier) @local.definition)))
|
|
8
|
+
(assignment left: ((field_expression . [(function_call
|
|
9
|
+
name: (identifier) @local.definition)
|
|
10
|
+
(identifier) @local.definition])))
|
|
11
|
+
(assignment left: (_) @local.definition)
|
|
12
|
+
(assignment (multioutput_variable (_) @local.definition))
|
|
13
|
+
|
|
14
|
+
(iterator . (identifier) @local.definition)
|
|
15
|
+
(global_operator (identifier) @local.definition)
|
|
16
|
+
(persistent_operator (identifier) @local.definition)
|
|
17
|
+
(catch_clause (identifier) @local.definition)
|
|
18
|
+
|
|
19
|
+
(identifier) @local.reference
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(arguments ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
|
2
|
+
(function_arguments ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
|
3
|
+
|
|
4
|
+
(lambda expression: (_) @function.inside) @function.around
|
|
5
|
+
(function_definition (block) @function.inside) @function.around
|
|
6
|
+
|
|
7
|
+
(class_definition) @class.inside @class.around
|
|
8
|
+
|
|
9
|
+
(comment) @comment.inside @comment.around
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
(function_definition
|
|
2
|
+
(block (_) @context.end)
|
|
3
|
+
) @context
|
|
4
|
+
|
|
5
|
+
(while_statement
|
|
6
|
+
(block (_) @context.end)
|
|
7
|
+
) @context
|
|
8
|
+
|
|
9
|
+
(for_statement
|
|
10
|
+
(block (_) @context.end)
|
|
11
|
+
) @context
|
|
12
|
+
|
|
13
|
+
(if_statement
|
|
14
|
+
(block (_) @context.end)
|
|
15
|
+
) @context
|
|
16
|
+
|
|
17
|
+
(elseif_clause
|
|
18
|
+
(block (_) @context.end)
|
|
19
|
+
) @context
|
|
20
|
+
|
|
21
|
+
(else_clause
|
|
22
|
+
(block (_) @context.end)
|
|
23
|
+
) @context
|
|
24
|
+
|
|
25
|
+
(switch_statement) @context
|
|
26
|
+
|
|
27
|
+
(case_clause
|
|
28
|
+
(block (_) @context.end)
|
|
29
|
+
) @context
|
|
30
|
+
|
|
31
|
+
(otherwise_clause
|
|
32
|
+
(block (_) @context.end)
|
|
33
|
+
) @context
|
|
34
|
+
|
|
35
|
+
(try_statement
|
|
36
|
+
"try"
|
|
37
|
+
(block (_) @context.end) @context
|
|
38
|
+
"end")
|
|
39
|
+
(catch_clause
|
|
40
|
+
"catch"
|
|
41
|
+
(block (_) @context.end) @context)
|