@acristoffers/tree-sitter-matlab 1.2.12 → 1.2.13
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/README.md +20 -4
- package/grammar.js +7 -1
- package/package.json +1 -1
- package/src/grammar.json +14 -19
- package/src/node-types.json +12 -0
- package/src/parser.c +70583 -55905
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -62,11 +62,24 @@ special class folder.
|
|
|
62
62
|
|
|
63
63
|
# Installation
|
|
64
64
|
|
|
65
|
-
This parser is
|
|
65
|
+
This parser is available in the following editors:
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
67
|
+
| Editor | Plugin | Highlights | Folds | Indents | Code Format | Injections | Locals |
|
|
68
|
+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
|
69
|
+
| Emacs | [Emacs-MATLAB-Mode] | ✔ | ✘ | ✔ | ✔ | ✔ | ✘ |
|
|
70
|
+
| Helix | Builtin | ✔ | ✘ | ✔ | ✘ | ✘ | ✘ |
|
|
71
|
+
| NeoVim | [nvim-treesitter] | ✔ | ✔ | ✔ | ✘ | ✔ | ✔ |
|
|
72
|
+
|
|
73
|
+
The columns have the following meaning:
|
|
74
|
+
|
|
75
|
+
- *Highlights*: supports syntax highlight
|
|
76
|
+
- *Folds*: supports code folding
|
|
77
|
+
- *Indents*: supports code indenting, which adjusts the leftmost whitespace on each line.
|
|
78
|
+
- *Code Format*: indent includes code formatting that standardizes the spacing of language elements
|
|
79
|
+
within code lines, aligns matrix columns, adds missing commas within cells and matrices, etc.
|
|
80
|
+
- *Injections*: supports embedding the language into another language (i.e.: MATLAB code blocks inside
|
|
81
|
+
Markdown or [org-mode](https://orgmode.org/))
|
|
82
|
+
- *Locals*: supports identifying variables/functions/etc scope
|
|
70
83
|
|
|
71
84
|
# Known issues
|
|
72
85
|
|
|
@@ -81,3 +94,6 @@ This parser is now the default for the following editors:
|
|
|
81
94
|

|
|
82
95
|

|
|
83
96
|

|
|
97
|
+
|
|
98
|
+
[Emacs-MATLAB-Mode]: https://github.com/mathworks/Emacs-MATLAB-Mode
|
|
99
|
+
[nvim-treesitter]: https://github.com/nvim-treesitter/nvim-treesitter
|
package/grammar.js
CHANGED
|
@@ -527,14 +527,20 @@ module.exports = grammar({
|
|
|
527
527
|
),
|
|
528
528
|
),
|
|
529
529
|
_index_parenthesis: ($) => seq('(', $._index_expression, ')'),
|
|
530
|
+
// _index_expression is intentionally a superset of _expression to avoid
|
|
531
|
+
// conflicts like obj([1;end]) where the parser would otherwise reduce to
|
|
532
|
+
// a non-index matrix/row too early.
|
|
530
533
|
_index_expression: ($) =>
|
|
531
534
|
choice(
|
|
532
535
|
alias($._index_boolean_operator, $.boolean_operator),
|
|
533
536
|
$.field_expression,
|
|
534
537
|
$.function_call,
|
|
538
|
+
$.handle_operator,
|
|
535
539
|
$.identifier,
|
|
536
540
|
$.cell,
|
|
541
|
+
$.lambda,
|
|
537
542
|
alias($._index_matrix, $.matrix),
|
|
543
|
+
$.metaclass_operator,
|
|
538
544
|
alias($._index_not_operator, $.not_operator),
|
|
539
545
|
$.number,
|
|
540
546
|
alias($._index_comparison_operator, $.comparison_operator),
|
|
@@ -590,7 +596,7 @@ module.exports = grammar({
|
|
|
590
596
|
),
|
|
591
597
|
);
|
|
592
598
|
},
|
|
593
|
-
_index_argument: ($) => choice($.spread_operator,
|
|
599
|
+
_index_argument: ($) => choice($.spread_operator, $._index_expression),
|
|
594
600
|
_index_arguments: ($) => commaSep1(field('argument', $._index_argument)),
|
|
595
601
|
|
|
596
602
|
arguments: ($) =>
|
package/package.json
CHANGED
package/src/grammar.json
CHANGED
|
@@ -2521,6 +2521,10 @@
|
|
|
2521
2521
|
"type": "SYMBOL",
|
|
2522
2522
|
"name": "function_call"
|
|
2523
2523
|
},
|
|
2524
|
+
{
|
|
2525
|
+
"type": "SYMBOL",
|
|
2526
|
+
"name": "handle_operator"
|
|
2527
|
+
},
|
|
2524
2528
|
{
|
|
2525
2529
|
"type": "SYMBOL",
|
|
2526
2530
|
"name": "identifier"
|
|
@@ -2529,6 +2533,10 @@
|
|
|
2529
2533
|
"type": "SYMBOL",
|
|
2530
2534
|
"name": "cell"
|
|
2531
2535
|
},
|
|
2536
|
+
{
|
|
2537
|
+
"type": "SYMBOL",
|
|
2538
|
+
"name": "lambda"
|
|
2539
|
+
},
|
|
2532
2540
|
{
|
|
2533
2541
|
"type": "ALIAS",
|
|
2534
2542
|
"content": {
|
|
@@ -2538,6 +2546,10 @@
|
|
|
2538
2546
|
"named": true,
|
|
2539
2547
|
"value": "matrix"
|
|
2540
2548
|
},
|
|
2549
|
+
{
|
|
2550
|
+
"type": "SYMBOL",
|
|
2551
|
+
"name": "metaclass_operator"
|
|
2552
|
+
},
|
|
2541
2553
|
{
|
|
2542
2554
|
"type": "ALIAS",
|
|
2543
2555
|
"content": {
|
|
@@ -3143,25 +3155,8 @@
|
|
|
3143
3155
|
"name": "spread_operator"
|
|
3144
3156
|
},
|
|
3145
3157
|
{
|
|
3146
|
-
"type": "
|
|
3147
|
-
"
|
|
3148
|
-
{
|
|
3149
|
-
"type": "PREC_DYNAMIC",
|
|
3150
|
-
"value": 1,
|
|
3151
|
-
"content": {
|
|
3152
|
-
"type": "SYMBOL",
|
|
3153
|
-
"name": "_index_expression"
|
|
3154
|
-
}
|
|
3155
|
-
},
|
|
3156
|
-
{
|
|
3157
|
-
"type": "PREC_DYNAMIC",
|
|
3158
|
-
"value": -1,
|
|
3159
|
-
"content": {
|
|
3160
|
-
"type": "SYMBOL",
|
|
3161
|
-
"name": "_expression"
|
|
3162
|
-
}
|
|
3163
|
-
}
|
|
3164
|
-
]
|
|
3158
|
+
"type": "SYMBOL",
|
|
3159
|
+
"name": "_index_expression"
|
|
3165
3160
|
}
|
|
3166
3161
|
]
|
|
3167
3162
|
},
|
package/src/node-types.json
CHANGED
|
@@ -35,14 +35,26 @@
|
|
|
35
35
|
"type": "function_call",
|
|
36
36
|
"named": true
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"type": "handle_operator",
|
|
40
|
+
"named": true
|
|
41
|
+
},
|
|
38
42
|
{
|
|
39
43
|
"type": "identifier",
|
|
40
44
|
"named": true
|
|
41
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"type": "lambda",
|
|
48
|
+
"named": true
|
|
49
|
+
},
|
|
42
50
|
{
|
|
43
51
|
"type": "matrix",
|
|
44
52
|
"named": true
|
|
45
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"type": "metaclass_operator",
|
|
56
|
+
"named": true
|
|
57
|
+
},
|
|
46
58
|
{
|
|
47
59
|
"type": "not_operator",
|
|
48
60
|
"named": true
|