@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
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
; Includes
|
|
2
|
+
|
|
3
|
+
((command_name) @include
|
|
4
|
+
(#eq? @include "import"))
|
|
5
|
+
|
|
6
|
+
; Keywords
|
|
7
|
+
|
|
8
|
+
[
|
|
9
|
+
"arguments"
|
|
10
|
+
"classdef"
|
|
11
|
+
"end"
|
|
12
|
+
"enumeration"
|
|
13
|
+
"events"
|
|
14
|
+
"global"
|
|
15
|
+
"methods"
|
|
16
|
+
"persistent"
|
|
17
|
+
"properties"
|
|
18
|
+
] @keyword
|
|
19
|
+
|
|
20
|
+
; Conditionals
|
|
21
|
+
|
|
22
|
+
(if_statement [ "if" "end" ] @conditional)
|
|
23
|
+
(elseif_clause "elseif" @conditional)
|
|
24
|
+
(else_clause "else" @conditional)
|
|
25
|
+
(switch_statement [ "switch" "end" ] @conditional)
|
|
26
|
+
(case_clause "case" @conditional)
|
|
27
|
+
(otherwise_clause "otherwise" @conditional)
|
|
28
|
+
(break_statement) @conditional
|
|
29
|
+
|
|
30
|
+
; Repeats
|
|
31
|
+
|
|
32
|
+
(for_statement [ "for" "parfor" "end" ] @repeat)
|
|
33
|
+
(while_statement [ "while" "end" ] @repeat)
|
|
34
|
+
(continue_statement) @repeat
|
|
35
|
+
|
|
36
|
+
; Exceptions
|
|
37
|
+
|
|
38
|
+
(try_statement [ "try" "end" ] @exception)
|
|
39
|
+
(catch_clause "catch" @exception)
|
|
40
|
+
|
|
41
|
+
; Variables
|
|
42
|
+
|
|
43
|
+
(identifier) @variable
|
|
44
|
+
|
|
45
|
+
; Constants
|
|
46
|
+
|
|
47
|
+
(events (identifier) @constant)
|
|
48
|
+
(attribute (identifier) @constant)
|
|
49
|
+
|
|
50
|
+
"~" @constant.builtin
|
|
51
|
+
|
|
52
|
+
; Fields/Properties
|
|
53
|
+
|
|
54
|
+
(field_expression field: (identifier) @field)
|
|
55
|
+
|
|
56
|
+
(superclass "." (identifier) @property)
|
|
57
|
+
|
|
58
|
+
(property_name "." (identifier) @property)
|
|
59
|
+
|
|
60
|
+
(property name: (identifier) @property)
|
|
61
|
+
|
|
62
|
+
; Types
|
|
63
|
+
|
|
64
|
+
(class_definition name: (identifier) @type)
|
|
65
|
+
|
|
66
|
+
(attributes (identifier) @constant)
|
|
67
|
+
|
|
68
|
+
(enum . (identifier) @type)
|
|
69
|
+
|
|
70
|
+
((identifier) @type
|
|
71
|
+
(#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$"))
|
|
72
|
+
|
|
73
|
+
; Functions
|
|
74
|
+
|
|
75
|
+
(function_definition
|
|
76
|
+
"function" @keyword.function
|
|
77
|
+
name: (identifier) @function
|
|
78
|
+
[ "end" "endfunction" ]? @keyword.function)
|
|
79
|
+
|
|
80
|
+
(function_signature name: (identifier) @function)
|
|
81
|
+
|
|
82
|
+
(function_call
|
|
83
|
+
name: (identifier) @function.call)
|
|
84
|
+
|
|
85
|
+
(handle_operator (identifier) @function)
|
|
86
|
+
|
|
87
|
+
(validation_functions (identifier) @function)
|
|
88
|
+
|
|
89
|
+
(command (command_name) @function.call)
|
|
90
|
+
(command_argument) @parameter
|
|
91
|
+
|
|
92
|
+
(return_statement) @keyword.return
|
|
93
|
+
|
|
94
|
+
; Parameters
|
|
95
|
+
|
|
96
|
+
(function_arguments (identifier) @parameter)
|
|
97
|
+
|
|
98
|
+
; Punctuation
|
|
99
|
+
|
|
100
|
+
[ ";" "," "." ] @punctuation.delimiter
|
|
101
|
+
|
|
102
|
+
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
|
103
|
+
|
|
104
|
+
; Operators
|
|
105
|
+
|
|
106
|
+
[
|
|
107
|
+
"+"
|
|
108
|
+
".+"
|
|
109
|
+
"-"
|
|
110
|
+
".*"
|
|
111
|
+
"*"
|
|
112
|
+
".*"
|
|
113
|
+
"/"
|
|
114
|
+
"./"
|
|
115
|
+
"\\"
|
|
116
|
+
".\\"
|
|
117
|
+
"^"
|
|
118
|
+
".^"
|
|
119
|
+
"'"
|
|
120
|
+
".'"
|
|
121
|
+
"|"
|
|
122
|
+
"&"
|
|
123
|
+
"?"
|
|
124
|
+
"@"
|
|
125
|
+
"<"
|
|
126
|
+
"<="
|
|
127
|
+
">"
|
|
128
|
+
">="
|
|
129
|
+
"=="
|
|
130
|
+
"~="
|
|
131
|
+
"="
|
|
132
|
+
"&&"
|
|
133
|
+
"||"
|
|
134
|
+
":"
|
|
135
|
+
] @operator
|
|
136
|
+
|
|
137
|
+
; Literals
|
|
138
|
+
|
|
139
|
+
(string) @string
|
|
140
|
+
|
|
141
|
+
(escape_sequence) @string.escape
|
|
142
|
+
(formatting_sequence) @string.special
|
|
143
|
+
|
|
144
|
+
(number) @number
|
|
145
|
+
|
|
146
|
+
((identifier) @boolean
|
|
147
|
+
(#eq? @boolean "true"))
|
|
148
|
+
((identifier) @boolean
|
|
149
|
+
(#eq? @boolean "false"))
|
|
150
|
+
|
|
151
|
+
; Comments
|
|
152
|
+
|
|
153
|
+
[ (comment) (line_continuation) ] @comment @spell
|
|
154
|
+
|
|
155
|
+
; Errors
|
|
156
|
+
|
|
157
|
+
(ERROR) @error
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"end" @indent.end @indent.branch
|
|
2
|
+
|
|
3
|
+
[
|
|
4
|
+
(arguments_statement)
|
|
5
|
+
(if_statement)
|
|
6
|
+
(for_statement)
|
|
7
|
+
(while_statement)
|
|
8
|
+
(switch_statement)
|
|
9
|
+
(try_statement)
|
|
10
|
+
(function_definition)
|
|
11
|
+
(class_definition)
|
|
12
|
+
(enumeration)
|
|
13
|
+
(events)
|
|
14
|
+
(methods)
|
|
15
|
+
(properties)
|
|
16
|
+
] @indent.begin
|
|
17
|
+
|
|
18
|
+
[
|
|
19
|
+
"elseif"
|
|
20
|
+
"else"
|
|
21
|
+
"case"
|
|
22
|
+
"otherwise"
|
|
23
|
+
"catch"
|
|
24
|
+
] @indent.branch
|
|
25
|
+
|
|
26
|
+
((matrix (row) @indent.align)
|
|
27
|
+
(#set! indent.open_delimiter "[")
|
|
28
|
+
(#set! indent.close_delimiter "]"))
|
|
29
|
+
((cell (row) @indent.align)
|
|
30
|
+
(#set! indent.open_delimiter "{")
|
|
31
|
+
(#set! indent.close_delimiter "}"))
|
|
32
|
+
((parenthesis) @indent.align
|
|
33
|
+
(#set! indent.open_delimiter "(")
|
|
34
|
+
(#set! indent.close_delimiter ")"))
|
|
35
|
+
|
|
36
|
+
(comment) @indent.auto
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(comment) @comment
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
; References
|
|
2
|
+
|
|
3
|
+
(identifier) @reference
|
|
4
|
+
|
|
5
|
+
; Definitions
|
|
6
|
+
|
|
7
|
+
(function_definition
|
|
8
|
+
name: (identifier) @definition.function
|
|
9
|
+
(function_arguments
|
|
10
|
+
(identifier)* @definition.parameter
|
|
11
|
+
("," (identifier) @definition.parameter)*)?) @scope
|
|
12
|
+
|
|
13
|
+
(assignment left: (identifier) @definition.var)
|
|
14
|
+
(multioutput_variable (identifier) @definition.var)
|
|
15
|
+
|
|
16
|
+
(iterator . (identifier) @definition.var)
|
|
17
|
+
(lambda (arguments (identifier) @definition.parameter))
|
|
18
|
+
(global_operator (identifier) @definition.var)
|
|
19
|
+
(persistent_operator (identifier) @definition.var)
|
|
20
|
+
(catch_clause (identifier) @definition)
|
|
@@ -0,0 +1,110 @@
|
|
|
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 ","? @_start . (_) @parameter.inner . )
|
|
8
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
9
|
+
((arguments (_) @parameter.inner . "," @_end)
|
|
10
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
11
|
+
|
|
12
|
+
(command) @call.outer
|
|
13
|
+
(command (command_argument) @parameter.inner @parameter.outer)
|
|
14
|
+
(command
|
|
15
|
+
(command_argument) @_start (command_argument)* @_end .
|
|
16
|
+
(#make-range! "call.inner" @_start @_end))
|
|
17
|
+
|
|
18
|
+
(if_statement
|
|
19
|
+
(block) @conditional.inner) @conditional.outer
|
|
20
|
+
(if_statement
|
|
21
|
+
(elseif_clause
|
|
22
|
+
(block) @conditional.inner))
|
|
23
|
+
(if_statement
|
|
24
|
+
(else_clause
|
|
25
|
+
(block) @conditional.inner))
|
|
26
|
+
|
|
27
|
+
(switch_statement
|
|
28
|
+
(case_clause (block) @conditional.inner)) @conditional.outer
|
|
29
|
+
|
|
30
|
+
(switch_statement
|
|
31
|
+
(otherwise_clause (block) @conditional.inner))
|
|
32
|
+
|
|
33
|
+
(for_statement
|
|
34
|
+
(block) @loop.inner) @loop.outer
|
|
35
|
+
(while_statement
|
|
36
|
+
(block) @loop.inner) @loop.outer
|
|
37
|
+
|
|
38
|
+
(lambda
|
|
39
|
+
expression: (_) @function.inner) @function.outer
|
|
40
|
+
|
|
41
|
+
(global_operator
|
|
42
|
+
(identifier) @parameter.inner)
|
|
43
|
+
|
|
44
|
+
(persistent_operator
|
|
45
|
+
(identifier) @parameter.inner)
|
|
46
|
+
|
|
47
|
+
(function_definition
|
|
48
|
+
(block) @function.inner) @function.outer
|
|
49
|
+
|
|
50
|
+
(function_output (identifier) @parameter.inner @parameter.outer)
|
|
51
|
+
|
|
52
|
+
((function_arguments ","? @_start . (_) @parameter.inner . )
|
|
53
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
54
|
+
((function_arguments (_) @parameter.inner . "," @_end)
|
|
55
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
56
|
+
|
|
57
|
+
((multioutput_variable ","? @_start . (_) @parameter.inner . )
|
|
58
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
59
|
+
((multioutput_variable (_) @parameter.inner . "," @_end)
|
|
60
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
61
|
+
|
|
62
|
+
(try_statement
|
|
63
|
+
(block) @conditional.inner) @conditional.outer
|
|
64
|
+
(catch_clause
|
|
65
|
+
(identifier) @parameter.inner @parameter.outer)
|
|
66
|
+
(catch_clause
|
|
67
|
+
(block) @conditional.inner)
|
|
68
|
+
|
|
69
|
+
(class_definition) @class.outer
|
|
70
|
+
|
|
71
|
+
(number) @number.inner
|
|
72
|
+
(_ (return_statement) @return.inner @return.outer)
|
|
73
|
+
(comment) @comment.outer
|
|
74
|
+
|
|
75
|
+
(matrix (row) @parameter.outer)
|
|
76
|
+
(cell (row) @parameter.outer)
|
|
77
|
+
(row (_) @parameter.inner)
|
|
78
|
+
|
|
79
|
+
(assignment
|
|
80
|
+
left: (_) @assignment.lhs
|
|
81
|
+
(_) @assignment.rhs) @assignment.outer
|
|
82
|
+
|
|
83
|
+
((superclasses "&"? @_start . (_) @parameter.inner . )
|
|
84
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
85
|
+
((superclasses (_) @parameter.inner . "&" @_end)
|
|
86
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
87
|
+
|
|
88
|
+
(enum (identifier) @parameter.inner @parameter.outer)
|
|
89
|
+
|
|
90
|
+
(property name: (_) @parameter.outer @parameter.inner)
|
|
91
|
+
|
|
92
|
+
((enum ","? @_start . (_) @parameter.inner . )
|
|
93
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
94
|
+
((enum (_) @parameter.inner . "," @_end)
|
|
95
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
96
|
+
|
|
97
|
+
((validation_functions ","? @_start . (_) @parameter.inner . )
|
|
98
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
99
|
+
((validation_functions (_) @parameter.inner . "," @_end)
|
|
100
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
101
|
+
|
|
102
|
+
((dimensions ","? @_start . (_) @parameter.inner . )
|
|
103
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
104
|
+
((dimensions (_) @parameter.inner . "," @_end)
|
|
105
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|
|
106
|
+
|
|
107
|
+
((attributes ","? @_start . (_) @parameter.inner . )
|
|
108
|
+
(#make-range! "parameter.outer" @_start @parameter.inner))
|
|
109
|
+
((attributes (_) @parameter.inner . "," @_end)
|
|
110
|
+
(#make-range! "parameter.outer" @parameter.inner @_end))
|