@mirascript/textmate 0.1.85 → 0.1.87
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/dist/grammar.d.ts.map +1 -1
- package/dist/grammar.js +139 -128
- package/dist/grammar.js.map +1 -1
- package/dist/mirascript-doc.tmLanguage.json +1 -1
- package/dist/mirascript-template.tmLanguage.json +278 -158
- package/dist/mirascript.tmLanguage.json +275 -155
- package/package.json +2 -2
- package/src/grammar.ts +140 -128
- package/tests/grammar/documentation-mode.ts +2 -2
- package/tests/grammar/language.ts +3 -1
- package/tests/grammar/strings.ts +11 -0
package/dist/grammar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../src/grammar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../src/grammar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA8nB3D;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,oBAAoB,CAW9D;AAED;;GAEG;AACH,wBAAgB,+BAA+B,IAAI,oBAAoB,CAUtE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAgfjE"}
|
package/dist/grammar.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CONSTANT_KEYWORDS, CONTROL_KEYWORDS, KEYWORDS, NUMERIC_KEYWORDS, REG_IDENTIFIER, RESERVED_KEYWORDS, } from '@mirascript/constants';
|
|
2
2
|
import { mirascriptDocLanguage, mirascriptLanguage, mirascriptTemplateLanguage } from "./language.js";
|
|
3
|
-
const SCOPE_SUFFIX = 'mira';
|
|
4
3
|
const IDENTIFIER = REG_IDENTIFIER.source;
|
|
5
4
|
const IDENTIFIER_START = String.raw `(?<!\p{XID_Continue})`;
|
|
6
5
|
const IDENTIFIER_END = String.raw `(?!\p{XID_Continue})`;
|
|
@@ -70,33 +69,33 @@ function interpolationPatterns(dollarCount) {
|
|
|
70
69
|
const dollars = String.raw `\$`.repeat(dollarCount);
|
|
71
70
|
return [
|
|
72
71
|
{
|
|
73
|
-
name: `meta.interpolation.simple
|
|
72
|
+
name: `meta.embedded.interpolation.simple.mira`,
|
|
74
73
|
match: `(${dollars})(${IDENTIFIER})`,
|
|
75
74
|
captures: {
|
|
76
|
-
1: { name: `punctuation.definition.template-expression.begin
|
|
77
|
-
2: { name: `variable.other
|
|
75
|
+
1: { name: `punctuation.definition.template-expression.begin.mira` },
|
|
76
|
+
2: { name: `variable.other.mira` },
|
|
78
77
|
},
|
|
79
78
|
},
|
|
80
79
|
{
|
|
81
|
-
name: `meta.interpolation.block
|
|
80
|
+
name: `meta.embedded.interpolation.block.mira`,
|
|
82
81
|
begin: String.raw `(${dollars}\{)`,
|
|
83
|
-
beginCaptures: { 1: { name: `punctuation.definition.template-expression.begin
|
|
82
|
+
beginCaptures: { 1: { name: `punctuation.definition.template-expression.begin.mira` } },
|
|
84
83
|
end: String.raw `\}`,
|
|
85
|
-
endCaptures: { 0: { name: `punctuation.definition.template-expression.end
|
|
84
|
+
endCaptures: { 0: { name: `punctuation.definition.template-expression.end.mira` } },
|
|
86
85
|
patterns: [{ include: '#braced-content' }],
|
|
87
86
|
},
|
|
88
87
|
{
|
|
89
|
-
name: `meta.interpolation.expression
|
|
88
|
+
name: `meta.embedded.interpolation.expression.mira`,
|
|
90
89
|
begin: String.raw `(${dollars}\()`,
|
|
91
|
-
beginCaptures: { 1: { name: `punctuation.definition.template-expression.begin
|
|
90
|
+
beginCaptures: { 1: { name: `punctuation.definition.template-expression.begin.mira` } },
|
|
92
91
|
end: String.raw `\)`,
|
|
93
|
-
endCaptures: { 0: { name: `punctuation.definition.template-expression.end
|
|
92
|
+
endCaptures: { 0: { name: `punctuation.definition.template-expression.end.mira` } },
|
|
94
93
|
patterns: [
|
|
95
94
|
{
|
|
96
95
|
begin: ':(?!:)',
|
|
97
|
-
beginCaptures: { 0: { name: `punctuation.separator.format
|
|
96
|
+
beginCaptures: { 0: { name: `punctuation.separator.format.mira` } },
|
|
98
97
|
end: String.raw `(?=\))`,
|
|
99
|
-
contentName: `string.unquoted.format
|
|
98
|
+
contentName: `string.unquoted.format.mira`,
|
|
100
99
|
patterns: [{ include: '#format-content' }],
|
|
101
100
|
},
|
|
102
101
|
{ include: '#interpolation-expression-content' },
|
|
@@ -110,16 +109,16 @@ function interpolationPatterns(dollarCount) {
|
|
|
110
109
|
function normalString(quote, label) {
|
|
111
110
|
const escapedQuote = escapeRegex(quote);
|
|
112
111
|
return {
|
|
113
|
-
name: `string.quoted.${label}
|
|
112
|
+
name: `string.quoted.${label}.mira`,
|
|
114
113
|
begin: escapedQuote,
|
|
115
|
-
beginCaptures: { 0: { name: `punctuation.definition.string.begin
|
|
114
|
+
beginCaptures: { 0: { name: `punctuation.definition.string.begin.mira` } },
|
|
116
115
|
end: escapedQuote,
|
|
117
|
-
endCaptures: { 0: { name: `punctuation.definition.string.end
|
|
116
|
+
endCaptures: { 0: { name: `punctuation.definition.string.end.mira` } },
|
|
118
117
|
patterns: [
|
|
119
|
-
{ name: `constant.character.escape.unicode
|
|
120
|
-
{ name: `constant.character.escape.hex
|
|
121
|
-
{ name: `constant.character.escape
|
|
122
|
-
{ name: `invalid.illegal.escape
|
|
118
|
+
{ name: `constant.character.escape.unicode.mira`, match: String.raw `\\u\{[0-9A-Fa-f]+\}` },
|
|
119
|
+
{ name: `constant.character.escape.hex.mira`, match: String.raw `\\x[0-9A-Fa-f]{2}` },
|
|
120
|
+
{ name: `constant.character.escape.mira`, match: '\\\\[\\\\\'"\\`$rntbfv0]' },
|
|
121
|
+
{ name: `invalid.illegal.escape.mira`, match: String.raw `\\.` },
|
|
123
122
|
...interpolationPatterns(1),
|
|
124
123
|
],
|
|
125
124
|
};
|
|
@@ -131,11 +130,11 @@ function verbatimString(atCount, quote, label) {
|
|
|
131
130
|
const ats = '@'.repeat(atCount);
|
|
132
131
|
const escapedQuote = escapeRegex(quote);
|
|
133
132
|
return {
|
|
134
|
-
name: `string.quoted.${label}.verbatim
|
|
133
|
+
name: `string.quoted.${label}.verbatim.mira`,
|
|
135
134
|
begin: `(?<!@)${ats}${escapedQuote}`,
|
|
136
|
-
beginCaptures: { 0: { name: `punctuation.definition.string.begin
|
|
135
|
+
beginCaptures: { 0: { name: `punctuation.definition.string.begin.mira` } },
|
|
137
136
|
end: `${escapedQuote}${ats}(?!@)`,
|
|
138
|
-
endCaptures: { 0: { name: `punctuation.definition.string.end
|
|
137
|
+
endCaptures: { 0: { name: `punctuation.definition.string.end.mira` } },
|
|
139
138
|
patterns: interpolationPatterns(atCount),
|
|
140
139
|
};
|
|
141
140
|
}
|
|
@@ -153,6 +152,18 @@ function stringPatterns() {
|
|
|
153
152
|
...quotes.map(([quote, label]) => normalString(quote, label)),
|
|
154
153
|
];
|
|
155
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a balanced-delimiter rule whose begin and end retain punctuation scopes.
|
|
157
|
+
*/
|
|
158
|
+
function delimitedContent(delimiter, begin, end, include) {
|
|
159
|
+
return {
|
|
160
|
+
begin,
|
|
161
|
+
beginCaptures: { 0: { name: `punctuation.section.${delimiter}.begin.mira` } },
|
|
162
|
+
end,
|
|
163
|
+
endCaptures: { 0: { name: `punctuation.section.${delimiter}.end.mira` } },
|
|
164
|
+
patterns: [{ include }],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
156
167
|
/**
|
|
157
168
|
* Build the documentation-comment rules shared by source and doc grammars.
|
|
158
169
|
*/
|
|
@@ -169,15 +180,15 @@ function documentationRepository(sourceInclude = '#source') {
|
|
|
169
180
|
'documentation-inline': {
|
|
170
181
|
patterns: [
|
|
171
182
|
{
|
|
172
|
-
name: `storage.type.class.documentation
|
|
183
|
+
name: `storage.type.class.documentation.mira`,
|
|
173
184
|
match: String.raw `@(param|returns)\b`,
|
|
174
185
|
},
|
|
175
186
|
{
|
|
176
|
-
name: `markup.bold.documentation
|
|
187
|
+
name: `markup.bold.documentation.mira`,
|
|
177
188
|
match: String.raw `\*\*[^*]+\*\*`,
|
|
178
189
|
},
|
|
179
|
-
{ name: `markup.italic.documentation
|
|
180
|
-
{ name: `constant.character.escape.documentation
|
|
190
|
+
{ name: `markup.italic.documentation.mira`, match: String.raw `\*[^*]+\*` },
|
|
191
|
+
{ name: `constant.character.escape.documentation.mira`, match: String.raw `\\\*` },
|
|
181
192
|
],
|
|
182
193
|
},
|
|
183
194
|
'documentation-line': {
|
|
@@ -185,9 +196,9 @@ function documentationRepository(sourceInclude = '#source') {
|
|
|
185
196
|
{
|
|
186
197
|
match: String.raw `^(?!\s*\*/)(\s*\*\s?)(.*?)(?=\*/|$)`,
|
|
187
198
|
captures: {
|
|
188
|
-
1: { name: `comment.block.documentation
|
|
199
|
+
1: { name: `comment.block.documentation.mira` },
|
|
189
200
|
2: {
|
|
190
|
-
name: `meta.documentation.inline
|
|
201
|
+
name: `meta.documentation.inline.mira`,
|
|
191
202
|
patterns: [{ include: '#documentation-inline' }],
|
|
192
203
|
},
|
|
193
204
|
},
|
|
@@ -200,7 +211,7 @@ function documentationRepository(sourceInclude = '#source') {
|
|
|
200
211
|
match: String.raw `(?!\*/)(.+?)(?=\*/|$)`,
|
|
201
212
|
captures: {
|
|
202
213
|
1: {
|
|
203
|
-
name: `meta.documentation.inline
|
|
214
|
+
name: `meta.documentation.inline.mira`,
|
|
204
215
|
patterns: [{ include: '#documentation-inline' }],
|
|
205
216
|
},
|
|
206
217
|
},
|
|
@@ -210,34 +221,34 @@ function documentationRepository(sourceInclude = '#source') {
|
|
|
210
221
|
'documentation-mirascript-fence': {
|
|
211
222
|
patterns: [
|
|
212
223
|
{
|
|
213
|
-
name: `markup.fenced_code.block
|
|
224
|
+
name: `markup.fenced_code.block.mira`,
|
|
214
225
|
begin: documentationMiraFenceBegin,
|
|
215
226
|
beginCaptures: {
|
|
216
|
-
1: { name: `comment.block.documentation
|
|
217
|
-
2: { name: `punctuation.definition.markdown
|
|
218
|
-
3: { name: `fenced_code.block.language
|
|
227
|
+
1: { name: `comment.block.documentation.mira` },
|
|
228
|
+
2: { name: `punctuation.definition.markdown.mira` },
|
|
229
|
+
3: { name: `fenced_code.block.language.mira` },
|
|
219
230
|
},
|
|
220
231
|
end: documentationFenceEnd,
|
|
221
232
|
endCaptures: {
|
|
222
|
-
1: { name: `comment.block.documentation
|
|
223
|
-
2: { name: `punctuation.definition.markdown
|
|
233
|
+
1: { name: `comment.block.documentation.mira` },
|
|
234
|
+
2: { name: `punctuation.definition.markdown.mira` },
|
|
224
235
|
},
|
|
225
236
|
patterns: [
|
|
226
237
|
{
|
|
227
|
-
name: `meta.embedded.block
|
|
228
|
-
contentName: `source
|
|
238
|
+
name: `meta.embedded.block.mira`,
|
|
239
|
+
contentName: `source.mira`,
|
|
229
240
|
begin: documentationMiraLine,
|
|
230
241
|
beginCaptures: {
|
|
231
|
-
1: { name: `comment.block.documentation
|
|
242
|
+
1: { name: `comment.block.documentation.mira` },
|
|
232
243
|
},
|
|
233
244
|
while: documentationMiraLine,
|
|
234
245
|
whileCaptures: {
|
|
235
|
-
1: { name: `comment.block.documentation
|
|
246
|
+
1: { name: `comment.block.documentation.mira` },
|
|
236
247
|
},
|
|
237
248
|
patterns: [{ include: sourceInclude }],
|
|
238
249
|
},
|
|
239
250
|
{
|
|
240
|
-
name: `comment.block.documentation
|
|
251
|
+
name: `comment.block.documentation.mira`,
|
|
241
252
|
match: String.raw `^(?!\s*\*/)(\s*\*\s?)`,
|
|
242
253
|
},
|
|
243
254
|
],
|
|
@@ -247,22 +258,22 @@ function documentationRepository(sourceInclude = '#source') {
|
|
|
247
258
|
'documentation-other-fence': {
|
|
248
259
|
patterns: [
|
|
249
260
|
{
|
|
250
|
-
name: `markup.fenced_code.block
|
|
251
|
-
contentName: `markup.raw.block
|
|
261
|
+
name: `markup.fenced_code.block.mira`,
|
|
262
|
+
contentName: `markup.raw.block.mira`,
|
|
252
263
|
begin: documentationOtherFenceBegin,
|
|
253
264
|
beginCaptures: {
|
|
254
|
-
1: { name: `comment.block.documentation
|
|
255
|
-
2: { name: `punctuation.definition.markdown
|
|
256
|
-
3: { name: `fenced_code.block.language
|
|
265
|
+
1: { name: `comment.block.documentation.mira` },
|
|
266
|
+
2: { name: `punctuation.definition.markdown.mira` },
|
|
267
|
+
3: { name: `fenced_code.block.language.mira` },
|
|
257
268
|
},
|
|
258
269
|
end: documentationFenceEnd,
|
|
259
270
|
endCaptures: {
|
|
260
|
-
1: { name: `comment.block.documentation
|
|
261
|
-
2: { name: `punctuation.definition.markdown
|
|
271
|
+
1: { name: `comment.block.documentation.mira` },
|
|
272
|
+
2: { name: `punctuation.definition.markdown.mira` },
|
|
262
273
|
},
|
|
263
274
|
patterns: [
|
|
264
275
|
{
|
|
265
|
-
name: `comment.block.documentation
|
|
276
|
+
name: `comment.block.documentation.mira`,
|
|
266
277
|
match: String.raw `^(?!\s*\*/)(\s*\*\s?)`,
|
|
267
278
|
},
|
|
268
279
|
],
|
|
@@ -279,7 +290,7 @@ function sourceRepository() {
|
|
|
279
290
|
* Create a boundary-aware TextMate keyword rule.
|
|
280
291
|
*/
|
|
281
292
|
const keywordRule = (values, name) => ({
|
|
282
|
-
name: `${name}
|
|
293
|
+
name: `${name}.mira`,
|
|
283
294
|
match: `${IDENTIFIER_START}(?:${alternatives(values)})${IDENTIFIER_END}`,
|
|
284
295
|
});
|
|
285
296
|
const keywordPatterns = [
|
|
@@ -288,7 +299,7 @@ function sourceRepository() {
|
|
|
288
299
|
keywordRule(CONTROL_KEYWORDS, 'keyword.control'),
|
|
289
300
|
keywordRule(wordOperators, 'keyword.operator.wordlike'),
|
|
290
301
|
keywordRule(declarationKeywords, 'keyword.declaration'),
|
|
291
|
-
keywordRule(moduleKeywords, 'keyword.
|
|
302
|
+
keywordRule(moduleKeywords, 'keyword.module'),
|
|
292
303
|
keywordRule(RESERVED_KEYWORDS, 'keyword.reserved'),
|
|
293
304
|
keywordRule(languageVariables, 'variable.language'),
|
|
294
305
|
keywordRule(otherKeywords, 'keyword.other'),
|
|
@@ -314,29 +325,29 @@ function sourceRepository() {
|
|
|
314
325
|
},
|
|
315
326
|
comments: {
|
|
316
327
|
patterns: [
|
|
317
|
-
{ name: `comment.line.double-slash
|
|
328
|
+
{ name: `comment.line.double-slash.mira`, match: '//.*$' },
|
|
318
329
|
{
|
|
319
|
-
name: `comment.block.documentation
|
|
330
|
+
name: `comment.block.documentation.mira`,
|
|
320
331
|
begin: String.raw `/\*\*`,
|
|
321
332
|
end: String.raw `\*/`,
|
|
322
333
|
},
|
|
323
|
-
{ name: `comment.block
|
|
334
|
+
{ name: `comment.block.mira`, begin: String.raw `/\*`, end: String.raw `\*/` },
|
|
324
335
|
],
|
|
325
336
|
},
|
|
326
337
|
...documentationRepository(),
|
|
327
338
|
'format-content': {
|
|
328
339
|
patterns: [
|
|
329
|
-
{ name: `constant.character.escape.format
|
|
340
|
+
{ name: `constant.character.escape.format.mira`, match: String.raw `\\.` },
|
|
330
341
|
{
|
|
331
342
|
begin: String.raw `\[`,
|
|
332
343
|
end: String.raw `\]`,
|
|
333
|
-
name: `string.unquoted.format.character-class
|
|
334
|
-
patterns: [{ name: `constant.character.escape.format
|
|
344
|
+
name: `string.unquoted.format.character-class.mira`,
|
|
345
|
+
patterns: [{ name: `constant.character.escape.format.mira`, match: String.raw `\\.` }],
|
|
335
346
|
},
|
|
336
347
|
{
|
|
337
348
|
begin: String.raw `\(`,
|
|
338
349
|
end: String.raw `\)`,
|
|
339
|
-
name: `string.unquoted.format.group
|
|
350
|
+
name: `string.unquoted.format.group.mira`,
|
|
340
351
|
patterns: [{ include: '#format-content' }],
|
|
341
352
|
},
|
|
342
353
|
],
|
|
@@ -345,34 +356,34 @@ function sourceRepository() {
|
|
|
345
356
|
'function-declarations': {
|
|
346
357
|
patterns: [
|
|
347
358
|
{
|
|
348
|
-
name: `meta.function.declaration
|
|
359
|
+
name: `meta.function.declaration.mira`,
|
|
349
360
|
begin: String.raw `${IDENTIFIER_START}(fn)(\s+)(${IDENTIFIER})(\s*)(\()`,
|
|
350
361
|
beginCaptures: {
|
|
351
|
-
1: { name: `keyword.declaration.function
|
|
352
|
-
3: { name: `entity.name.function
|
|
353
|
-
5: { name: `punctuation.section.parameters.begin
|
|
362
|
+
1: { name: `keyword.declaration.function.mira` },
|
|
363
|
+
3: { name: `entity.name.function.mira` },
|
|
364
|
+
5: { name: `punctuation.section.parameters.begin.mira` },
|
|
354
365
|
},
|
|
355
366
|
end: String.raw `\)`,
|
|
356
|
-
endCaptures: { 0: { name: `punctuation.section.parameters.end
|
|
367
|
+
endCaptures: { 0: { name: `punctuation.section.parameters.end.mira` } },
|
|
357
368
|
patterns: [{ include: '#parameters' }],
|
|
358
369
|
},
|
|
359
370
|
{
|
|
360
|
-
name: `meta.function.declaration
|
|
371
|
+
name: `meta.function.declaration.mira`,
|
|
361
372
|
match: String.raw `${IDENTIFIER_START}(fn)(\s+)(${IDENTIFIER})`,
|
|
362
373
|
captures: {
|
|
363
|
-
1: { name: `keyword.declaration.function
|
|
364
|
-
3: { name: `entity.name.function
|
|
374
|
+
1: { name: `keyword.declaration.function.mira` },
|
|
375
|
+
3: { name: `entity.name.function.mira` },
|
|
365
376
|
},
|
|
366
377
|
},
|
|
367
378
|
{
|
|
368
|
-
name: `meta.function.expression.parameters
|
|
379
|
+
name: `meta.function.expression.parameters.mira`,
|
|
369
380
|
begin: String.raw `${IDENTIFIER_START}(fn)(\s*)(\()`,
|
|
370
381
|
beginCaptures: {
|
|
371
|
-
1: { name: `keyword.declaration.function
|
|
372
|
-
3: { name: `punctuation.section.parameters.begin
|
|
382
|
+
1: { name: `keyword.declaration.function.mira` },
|
|
383
|
+
3: { name: `punctuation.section.parameters.begin.mira` },
|
|
373
384
|
},
|
|
374
385
|
end: String.raw `\)`,
|
|
375
|
-
endCaptures: { 0: { name: `punctuation.section.parameters.end
|
|
386
|
+
endCaptures: { 0: { name: `punctuation.section.parameters.end.mira` } },
|
|
376
387
|
patterns: [{ include: '#parameters' }],
|
|
377
388
|
},
|
|
378
389
|
],
|
|
@@ -382,17 +393,17 @@ function sourceRepository() {
|
|
|
382
393
|
{
|
|
383
394
|
match: String.raw `${IDENTIFIER_START}(mut)(\s+)(${IDENTIFIER})`,
|
|
384
395
|
captures: {
|
|
385
|
-
1: { name: `keyword.declaration.mutable
|
|
386
|
-
3: { name: `variable.emphasis
|
|
396
|
+
1: { name: `keyword.declaration.mutable.mira` },
|
|
397
|
+
3: { name: `variable.emphasis.mira` },
|
|
387
398
|
},
|
|
388
399
|
},
|
|
389
400
|
{
|
|
390
|
-
name: `keyword.declaration.mutable
|
|
401
|
+
name: `keyword.declaration.mutable.mira`,
|
|
391
402
|
match: `${IDENTIFIER_START}mut${IDENTIFIER_END}`,
|
|
392
403
|
},
|
|
393
|
-
{ name: `keyword.operator.spread
|
|
394
|
-
{ name: `variable.other.constant.emphasis
|
|
395
|
-
{ name: `punctuation.separator.parameter
|
|
404
|
+
{ name: `keyword.operator.spread.mira`, match: String.raw `\.\.` },
|
|
405
|
+
{ name: `variable.other.constant.emphasis.mira`, match: IDENTIFIER },
|
|
406
|
+
{ name: `punctuation.separator.parameter.mira`, match: ',' },
|
|
396
407
|
{
|
|
397
408
|
begin: String.raw `\(`,
|
|
398
409
|
end: String.raw `\)`,
|
|
@@ -411,8 +422,8 @@ function sourceRepository() {
|
|
|
411
422
|
{
|
|
412
423
|
match: String.raw `${IDENTIFIER_START}(mod)(\s+)(${IDENTIFIER})`,
|
|
413
424
|
captures: {
|
|
414
|
-
1: { name: `keyword.
|
|
415
|
-
3: { name: `entity.name.namespace
|
|
425
|
+
1: { name: `keyword.module.mira` },
|
|
426
|
+
3: { name: `entity.name.namespace.mira` },
|
|
416
427
|
},
|
|
417
428
|
},
|
|
418
429
|
],
|
|
@@ -422,18 +433,18 @@ function sourceRepository() {
|
|
|
422
433
|
{
|
|
423
434
|
match: String.raw `${IDENTIFIER_START}(for)(\s+)(mut)(\s+)(${IDENTIFIER})(\s+)(in)${IDENTIFIER_END}`,
|
|
424
435
|
captures: {
|
|
425
|
-
1: { name: `keyword.control.loop
|
|
426
|
-
3: { name: `keyword.declaration.mutable
|
|
427
|
-
5: { name: `variable.other.readwrite
|
|
428
|
-
7: { name: `keyword.control.loop
|
|
436
|
+
1: { name: `keyword.control.loop.mira` },
|
|
437
|
+
3: { name: `keyword.declaration.mutable.mira` },
|
|
438
|
+
5: { name: `variable.other.readwrite.mira` },
|
|
439
|
+
7: { name: `keyword.control.loop.mira` },
|
|
429
440
|
},
|
|
430
441
|
},
|
|
431
442
|
{
|
|
432
443
|
match: String.raw `${IDENTIFIER_START}(for)(\s+)(${IDENTIFIER})(\s+)(in)${IDENTIFIER_END}`,
|
|
433
444
|
captures: {
|
|
434
|
-
1: { name: `keyword.control.loop
|
|
435
|
-
3: { name: `variable.other
|
|
436
|
-
5: { name: `keyword.control.loop
|
|
445
|
+
1: { name: `keyword.control.loop.mira` },
|
|
446
|
+
3: { name: `variable.other.mira` },
|
|
447
|
+
5: { name: `keyword.control.loop.mira` },
|
|
437
448
|
},
|
|
438
449
|
},
|
|
439
450
|
],
|
|
@@ -443,8 +454,8 @@ function sourceRepository() {
|
|
|
443
454
|
{
|
|
444
455
|
match: String.raw `(${IDENTIFIER})(\s*)(\??:)(?!:)`,
|
|
445
456
|
captures: {
|
|
446
|
-
1: { name: `variable.other.property
|
|
447
|
-
3: { name: `punctuation.separator.key-value
|
|
457
|
+
1: { name: `variable.other.property.mira` },
|
|
458
|
+
3: { name: `punctuation.separator.key-value.mira` },
|
|
448
459
|
},
|
|
449
460
|
},
|
|
450
461
|
],
|
|
@@ -454,23 +465,23 @@ function sourceRepository() {
|
|
|
454
465
|
{
|
|
455
466
|
match: String.raw `(\.)(\s*)(\d+)`,
|
|
456
467
|
captures: {
|
|
457
|
-
1: { name: `punctuation.accessor
|
|
458
|
-
3: { name: `variable.other.property
|
|
468
|
+
1: { name: `punctuation.accessor.mira` },
|
|
469
|
+
3: { name: `variable.other.property.mira` },
|
|
459
470
|
},
|
|
460
471
|
},
|
|
461
472
|
{
|
|
462
473
|
match: `(\\.)(\\s*)(${IDENTIFIER})(\\s*)(!?)(?=\\s*(?:\\(|@*["'\`]))`,
|
|
463
474
|
captures: {
|
|
464
|
-
1: { name: `punctuation.accessor
|
|
465
|
-
3: { name: `entity.name.function.member
|
|
466
|
-
5: { name: `keyword.operator.non-null
|
|
475
|
+
1: { name: `punctuation.accessor.mira` },
|
|
476
|
+
3: { name: `entity.name.function.member.mira` },
|
|
477
|
+
5: { name: `keyword.operator.non-null.mira` },
|
|
467
478
|
},
|
|
468
479
|
},
|
|
469
480
|
{
|
|
470
481
|
match: String.raw `(\.)(\s*)(${IDENTIFIER})`,
|
|
471
482
|
captures: {
|
|
472
|
-
1: { name: `punctuation.accessor
|
|
473
|
-
3: { name: `variable.other.property
|
|
483
|
+
1: { name: `punctuation.accessor.mira` },
|
|
484
|
+
3: { name: `variable.other.property.mira` },
|
|
474
485
|
},
|
|
475
486
|
},
|
|
476
487
|
],
|
|
@@ -480,8 +491,8 @@ function sourceRepository() {
|
|
|
480
491
|
{
|
|
481
492
|
match: `(${IDENTIFIER})(\\s*)(!?)(?=\\s*(?:\\(|@*["'\`]))`,
|
|
482
493
|
captures: {
|
|
483
|
-
1: { name: `entity.name.function
|
|
484
|
-
3: { name: `keyword.operator.non-null
|
|
494
|
+
1: { name: `entity.name.function.mira` },
|
|
495
|
+
3: { name: `keyword.operator.non-null.mira` },
|
|
485
496
|
},
|
|
486
497
|
},
|
|
487
498
|
],
|
|
@@ -489,7 +500,7 @@ function sourceRepository() {
|
|
|
489
500
|
'type-keyword': {
|
|
490
501
|
patterns: [
|
|
491
502
|
{
|
|
492
|
-
name: `keyword.operator.expression
|
|
503
|
+
name: `keyword.operator.expression.mira`,
|
|
493
504
|
match: String.raw `${IDENTIFIER_START}type${IDENTIFIER_END}(?=\s*\(|\s+${IDENTIFIER})`,
|
|
494
505
|
},
|
|
495
506
|
],
|
|
@@ -497,23 +508,23 @@ function sourceRepository() {
|
|
|
497
508
|
numbers: {
|
|
498
509
|
patterns: [
|
|
499
510
|
{
|
|
500
|
-
name: `constant.numeric.hex
|
|
511
|
+
name: `constant.numeric.hex.mira`,
|
|
501
512
|
match: `0[xX][0-9A-Fa-f](?:[0-9A-Fa-f_]*[0-9A-Fa-f])?${IDENTIFIER_END}`,
|
|
502
513
|
},
|
|
503
514
|
{
|
|
504
|
-
name: `constant.numeric.octal
|
|
515
|
+
name: `constant.numeric.octal.mira`,
|
|
505
516
|
match: `0[oO][0-7](?:[0-7_]*[0-7])?${IDENTIFIER_END}`,
|
|
506
517
|
},
|
|
507
518
|
{
|
|
508
|
-
name: `constant.numeric.binary
|
|
519
|
+
name: `constant.numeric.binary.mira`,
|
|
509
520
|
match: `0[bB][01](?:[01_]*[01])?${IDENTIFIER_END}`,
|
|
510
521
|
},
|
|
511
522
|
{
|
|
512
|
-
name: `invalid.illegal.numeric
|
|
523
|
+
name: `invalid.illegal.numeric.mira`,
|
|
513
524
|
match: String.raw `0[xXoObB]\p{XID_Continue}*`,
|
|
514
525
|
},
|
|
515
526
|
{
|
|
516
|
-
name: `constant.numeric.float
|
|
527
|
+
name: `constant.numeric.float.mira`,
|
|
517
528
|
match: String.raw `\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?[\d_]*\d)?${IDENTIFIER_END}`,
|
|
518
529
|
},
|
|
519
530
|
],
|
|
@@ -521,49 +532,49 @@ function sourceRepository() {
|
|
|
521
532
|
keywords: { patterns: keywordPatterns },
|
|
522
533
|
identifiers: {
|
|
523
534
|
patterns: [
|
|
524
|
-
{ name: `variable.other.constant
|
|
525
|
-
{ name: `variable.other
|
|
535
|
+
{ name: `variable.other.constant.mira`, match: String.raw `@+\p{XID_Continue}+` },
|
|
536
|
+
{ name: `variable.other.mira`, match: IDENTIFIER },
|
|
526
537
|
],
|
|
527
538
|
},
|
|
528
539
|
operators: {
|
|
529
540
|
patterns: [
|
|
530
|
-
{ name: `keyword.operator.spread
|
|
531
|
-
{ name: `keyword.operator.bind
|
|
532
|
-
{ name: `keyword.operator.conditional
|
|
541
|
+
{ name: `keyword.operator.spread.mira`, match: String.raw `\.\.<|\.\.` },
|
|
542
|
+
{ name: `keyword.operator.bind.mira`, match: '::' },
|
|
543
|
+
{ name: `keyword.operator.conditional.mira`, match: String.raw `\?:` },
|
|
533
544
|
{
|
|
534
|
-
name: `keyword.operator.assignment
|
|
545
|
+
name: `keyword.operator.assignment.mira`,
|
|
535
546
|
match: String.raw `&&=|\|\|=|\?\?=|\+=|-=|\*=|/=|%=|\^=|=`,
|
|
536
547
|
},
|
|
537
548
|
{
|
|
538
|
-
name: `keyword.operator.comparison
|
|
549
|
+
name: `keyword.operator.comparison.mira`,
|
|
539
550
|
match: '===|!==|>=|<=|==|!=|=~|!~|>|<',
|
|
540
551
|
},
|
|
541
|
-
{ name: `keyword.operator.logical
|
|
542
|
-
{ name: `keyword.operator.arithmetic
|
|
552
|
+
{ name: `keyword.operator.logical.mira`, match: String.raw `&&|\|\||\?\?|!` },
|
|
553
|
+
{ name: `keyword.operator.arithmetic.mira`, match: String.raw `\+|-|\*|/|%|\^` },
|
|
543
554
|
],
|
|
544
555
|
},
|
|
545
556
|
punctuation: {
|
|
546
557
|
patterns: [
|
|
547
|
-
{ name: `punctuation.section.braces
|
|
548
|
-
{ name: `punctuation.section.brackets
|
|
549
|
-
{ name: `punctuation.section.parens
|
|
550
|
-
{ name: `punctuation.separator
|
|
551
|
-
{ name: `punctuation.accessor
|
|
558
|
+
{ name: `punctuation.section.braces.mira`, match: '[{}]' },
|
|
559
|
+
{ name: `punctuation.section.brackets.mira`, match: String.raw `[\[\]]` },
|
|
560
|
+
{ name: `punctuation.section.parens.mira`, match: '[()]' },
|
|
561
|
+
{ name: `punctuation.separator.mira`, match: '[,;:]' },
|
|
562
|
+
{ name: `punctuation.accessor.mira`, match: String.raw `\.` },
|
|
552
563
|
],
|
|
553
564
|
},
|
|
554
565
|
'braced-content': {
|
|
555
566
|
patterns: [
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
567
|
+
delimitedContent('braces', String.raw `\{`, String.raw `\}`, '#braced-content'),
|
|
568
|
+
delimitedContent('parens', String.raw `\(`, String.raw `\)`, '#parenthesized-content'),
|
|
569
|
+
delimitedContent('brackets', String.raw `\[`, String.raw `\]`, '#bracketed-content'),
|
|
559
570
|
{ include: '#source' },
|
|
560
571
|
],
|
|
561
572
|
},
|
|
562
573
|
'interpolation-expression-content': {
|
|
563
574
|
patterns: [
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
575
|
+
delimitedContent('parens', String.raw `\(`, String.raw `\)`, '#parenthesized-content'),
|
|
576
|
+
delimitedContent('braces', String.raw `\{`, String.raw `\}`, '#braced-content'),
|
|
577
|
+
delimitedContent('brackets', String.raw `\[`, String.raw `\]`, '#bracketed-content'),
|
|
567
578
|
{ include: '#comments' },
|
|
568
579
|
{ include: '#strings' },
|
|
569
580
|
{ include: '#function-declarations' },
|
|
@@ -581,17 +592,17 @@ function sourceRepository() {
|
|
|
581
592
|
},
|
|
582
593
|
'parenthesized-content': {
|
|
583
594
|
patterns: [
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
595
|
+
delimitedContent('parens', String.raw `\(`, String.raw `\)`, '#parenthesized-content'),
|
|
596
|
+
delimitedContent('braces', String.raw `\{`, String.raw `\}`, '#braced-content'),
|
|
597
|
+
delimitedContent('brackets', String.raw `\[`, String.raw `\]`, '#bracketed-content'),
|
|
587
598
|
{ include: '#source' },
|
|
588
599
|
],
|
|
589
600
|
},
|
|
590
601
|
'bracketed-content': {
|
|
591
602
|
patterns: [
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
603
|
+
delimitedContent('brackets', String.raw `\[`, String.raw `\]`, '#bracketed-content'),
|
|
604
|
+
delimitedContent('braces', String.raw `\{`, String.raw `\}`, '#braced-content'),
|
|
605
|
+
delimitedContent('parens', String.raw `\(`, String.raw `\)`, '#parenthesized-content'),
|
|
595
606
|
{ include: '#source' },
|
|
596
607
|
],
|
|
597
608
|
},
|
|
@@ -779,7 +790,7 @@ export function createMiraScriptDocGrammar() {
|
|
|
779
790
|
{
|
|
780
791
|
match: String.raw `${IDENTIFIER_START}(?:(pub)(\s+))?(fn)(\s+)(${IDENTIFIER})(?=\s*(?:<|\())`,
|
|
781
792
|
captures: {
|
|
782
|
-
1: { name: 'keyword.
|
|
793
|
+
1: { name: 'keyword.module.mira' },
|
|
783
794
|
3: { name: 'keyword.declaration.function.mira' },
|
|
784
795
|
5: { name: 'entity.name.function.mira' },
|
|
785
796
|
},
|