@mirascript/textmate 0.1.83 → 0.1.84
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/.c8rc.json +6 -0
- package/ava.config.js +4 -0
- package/dist/grammar.d.ts.map +1 -1
- package/dist/grammar.js +206 -86
- package/dist/grammar.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mirascript-doc.tmLanguage.json +303 -84
- package/dist/mirascript-template.tmLanguage.json +1 -1
- package/dist/mirascript.tmLanguage.json +1 -1
- package/package.json +7 -7
- package/src/grammar.ts +210 -86
- package/src/index.ts +1 -1
- package/tests/_engine.ts +53 -0
- package/tests/grammar/documentation-comments.ts +157 -0
- package/tests/grammar/documentation-mode.ts +372 -0
- package/tests/grammar/language.ts +59 -0
- package/tests/grammar/strings.ts +35 -0
- package/tests/js-compatibility.ts +22 -0
- package/tests/language.ts +9 -0
- package/tests/tsconfig.json +3 -0
package/.c8rc.json
ADDED
package/ava.config.js
ADDED
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;AAknB3D;;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
|
@@ -2,6 +2,7 @@ import { CONSTANT_KEYWORDS, CONTROL_KEYWORDS, KEYWORDS, NUMERIC_KEYWORDS, REG_ID
|
|
|
2
2
|
import { mirascriptDocLanguage, mirascriptLanguage, mirascriptTemplateLanguage } from "./language.js";
|
|
3
3
|
const SCOPE_SUFFIX = 'mira';
|
|
4
4
|
const IDENTIFIER = REG_IDENTIFIER.source;
|
|
5
|
+
const IDENTIFIER_START = String.raw `(?<!\p{XID_Continue})`;
|
|
5
6
|
const IDENTIFIER_END = String.raw `(?!\p{XID_Continue})`;
|
|
6
7
|
const MAX_VERBATIM_LENGTH = 16;
|
|
7
8
|
const BUILT_IN_TYPES = [
|
|
@@ -9,6 +10,8 @@ const BUILT_IN_TYPES = [
|
|
|
9
10
|
'unknown',
|
|
10
11
|
'never',
|
|
11
12
|
'boolean',
|
|
13
|
+
'true',
|
|
14
|
+
'false',
|
|
12
15
|
'number',
|
|
13
16
|
'string',
|
|
14
17
|
'record',
|
|
@@ -18,6 +21,10 @@ const BUILT_IN_TYPES = [
|
|
|
18
21
|
'nil',
|
|
19
22
|
];
|
|
20
23
|
const DOC_CONSTANT_IDENTIFIER = String.raw `(?:@+\p{XID_Continue}+|\p{Lu}[\p{XID_Continue}]*)`;
|
|
24
|
+
const DOC_TAG_NAME = String.raw `[^>\r\n]*[^>\s]`;
|
|
25
|
+
const DOC_TAG_CONTENT = String.raw `(?:module|function|extern)(?:[ \t]+${DOC_TAG_NAME})?`;
|
|
26
|
+
const DOC_FIELD_NAME = String.raw `(?:${IDENTIFIER}|\d+|"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*')`;
|
|
27
|
+
const DOC_TAG_NUMBER = String.raw `\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?[\d_]*\d)?`;
|
|
21
28
|
/**
|
|
22
29
|
* Escape a literal value for insertion into an Oniguruma regular expression.
|
|
23
30
|
*/
|
|
@@ -33,17 +40,6 @@ function alternatives(values) {
|
|
|
33
40
|
.map(escapeRegex)
|
|
34
41
|
.join('|');
|
|
35
42
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Create a boundary-aware TextMate keyword rule.
|
|
38
|
-
*/
|
|
39
|
-
function keywordRule(values, name) {
|
|
40
|
-
if (values.length === 0)
|
|
41
|
-
return null;
|
|
42
|
-
return {
|
|
43
|
-
name: `${name}.${SCOPE_SUFFIX}`,
|
|
44
|
-
match: String.raw `(?<!\p{XID_Continue})(?:${alternatives(values)})${IDENTIFIER_END}`,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
43
|
const numericKeywordSet = new Set(NUMERIC_KEYWORDS);
|
|
48
44
|
const constantKeywords = CONSTANT_KEYWORDS.filter((keyword) => !numericKeywordSet.has(keyword));
|
|
49
45
|
const languageVariables = ['_', 'global'];
|
|
@@ -61,7 +57,7 @@ const classifiedKeywords = new Set([
|
|
|
61
57
|
'type',
|
|
62
58
|
]);
|
|
63
59
|
const otherKeywords = KEYWORDS.filter((keyword) => !classifiedKeywords.has(keyword));
|
|
64
|
-
const mirascriptFenceTags = alternatives([mirascriptLanguage.name, ...
|
|
60
|
+
const mirascriptFenceTags = alternatives([mirascriptLanguage.name, ...mirascriptLanguage.aliases]);
|
|
65
61
|
const documentationMiraFenceBegin = String.raw `^(\s*\*\s?)(\x60{3,})\s*((?i:${mirascriptFenceTags}))?\s*$`;
|
|
66
62
|
const documentationOtherFenceBegin = String.raw `^(\s*\*\s?)(\x60{3,})\s*(\S+)(?:\s+.*)?\s*$`;
|
|
67
63
|
const documentationFenceEnd = String.raw `^(?:(\s*\*\s?)(\2\x60*)\s*$)|(?=\*/)`;
|
|
@@ -279,6 +275,13 @@ function documentationRepository(sourceInclude = '#source') {
|
|
|
279
275
|
* Build the shared repository used by source and template grammars.
|
|
280
276
|
*/
|
|
281
277
|
function sourceRepository() {
|
|
278
|
+
/**
|
|
279
|
+
* Create a boundary-aware TextMate keyword rule.
|
|
280
|
+
*/
|
|
281
|
+
const keywordRule = (values, name) => ({
|
|
282
|
+
name: `${name}.${SCOPE_SUFFIX}`,
|
|
283
|
+
match: `${IDENTIFIER_START}(?:${alternatives(values)})${IDENTIFIER_END}`,
|
|
284
|
+
});
|
|
282
285
|
const keywordPatterns = [
|
|
283
286
|
keywordRule(NUMERIC_KEYWORDS, 'constant.numeric.language'),
|
|
284
287
|
keywordRule(constantKeywords, 'constant.language'),
|
|
@@ -289,7 +292,7 @@ function sourceRepository() {
|
|
|
289
292
|
keywordRule(RESERVED_KEYWORDS, 'keyword.reserved'),
|
|
290
293
|
keywordRule(languageVariables, 'variable.language'),
|
|
291
294
|
keywordRule(otherKeywords, 'keyword.other'),
|
|
292
|
-
]
|
|
295
|
+
];
|
|
293
296
|
return {
|
|
294
297
|
source: {
|
|
295
298
|
patterns: [
|
|
@@ -343,7 +346,7 @@ function sourceRepository() {
|
|
|
343
346
|
patterns: [
|
|
344
347
|
{
|
|
345
348
|
name: `meta.function.declaration.${SCOPE_SUFFIX}`,
|
|
346
|
-
begin: String.raw
|
|
349
|
+
begin: String.raw `${IDENTIFIER_START}(fn)(\s+)(${IDENTIFIER})(\s*)(\()`,
|
|
347
350
|
beginCaptures: {
|
|
348
351
|
1: { name: `keyword.declaration.function.${SCOPE_SUFFIX}` },
|
|
349
352
|
3: { name: `entity.name.function.${SCOPE_SUFFIX}` },
|
|
@@ -355,7 +358,7 @@ function sourceRepository() {
|
|
|
355
358
|
},
|
|
356
359
|
{
|
|
357
360
|
name: `meta.function.declaration.${SCOPE_SUFFIX}`,
|
|
358
|
-
match: String.raw
|
|
361
|
+
match: String.raw `${IDENTIFIER_START}(fn)(\s+)(${IDENTIFIER})`,
|
|
359
362
|
captures: {
|
|
360
363
|
1: { name: `keyword.declaration.function.${SCOPE_SUFFIX}` },
|
|
361
364
|
3: { name: `entity.name.function.${SCOPE_SUFFIX}` },
|
|
@@ -363,7 +366,7 @@ function sourceRepository() {
|
|
|
363
366
|
},
|
|
364
367
|
{
|
|
365
368
|
name: `meta.function.expression.parameters.${SCOPE_SUFFIX}`,
|
|
366
|
-
begin: String.raw
|
|
369
|
+
begin: String.raw `${IDENTIFIER_START}(fn)(\s*)(\()`,
|
|
367
370
|
beginCaptures: {
|
|
368
371
|
1: { name: `keyword.declaration.function.${SCOPE_SUFFIX}` },
|
|
369
372
|
3: { name: `punctuation.section.parameters.begin.${SCOPE_SUFFIX}` },
|
|
@@ -377,7 +380,7 @@ function sourceRepository() {
|
|
|
377
380
|
parameters: {
|
|
378
381
|
patterns: [
|
|
379
382
|
{
|
|
380
|
-
match: String.raw
|
|
383
|
+
match: String.raw `${IDENTIFIER_START}(mut)(\s+)(${IDENTIFIER})`,
|
|
381
384
|
captures: {
|
|
382
385
|
1: { name: `keyword.declaration.mutable.${SCOPE_SUFFIX}` },
|
|
383
386
|
3: { name: `variable.emphasis.${SCOPE_SUFFIX}` },
|
|
@@ -385,7 +388,7 @@ function sourceRepository() {
|
|
|
385
388
|
},
|
|
386
389
|
{
|
|
387
390
|
name: `keyword.declaration.mutable.${SCOPE_SUFFIX}`,
|
|
388
|
-
match:
|
|
391
|
+
match: `${IDENTIFIER_START}mut${IDENTIFIER_END}`,
|
|
389
392
|
},
|
|
390
393
|
{ name: `keyword.operator.spread.${SCOPE_SUFFIX}`, match: String.raw `\.\.` },
|
|
391
394
|
{ name: `variable.other.constant.emphasis.${SCOPE_SUFFIX}`, match: IDENTIFIER },
|
|
@@ -406,7 +409,7 @@ function sourceRepository() {
|
|
|
406
409
|
'module-declarations': {
|
|
407
410
|
patterns: [
|
|
408
411
|
{
|
|
409
|
-
match: String.raw
|
|
412
|
+
match: String.raw `${IDENTIFIER_START}(mod)(\s+)(${IDENTIFIER})`,
|
|
410
413
|
captures: {
|
|
411
414
|
1: { name: `keyword.control.module.${SCOPE_SUFFIX}` },
|
|
412
415
|
3: { name: `entity.name.namespace.${SCOPE_SUFFIX}` },
|
|
@@ -417,7 +420,7 @@ function sourceRepository() {
|
|
|
417
420
|
'for-bindings': {
|
|
418
421
|
patterns: [
|
|
419
422
|
{
|
|
420
|
-
match: String.raw
|
|
423
|
+
match: String.raw `${IDENTIFIER_START}(for)(\s+)(mut)(\s+)(${IDENTIFIER})(\s+)(in)${IDENTIFIER_END}`,
|
|
421
424
|
captures: {
|
|
422
425
|
1: { name: `keyword.control.loop.${SCOPE_SUFFIX}` },
|
|
423
426
|
3: { name: `keyword.declaration.mutable.${SCOPE_SUFFIX}` },
|
|
@@ -426,7 +429,7 @@ function sourceRepository() {
|
|
|
426
429
|
},
|
|
427
430
|
},
|
|
428
431
|
{
|
|
429
|
-
match: String.raw
|
|
432
|
+
match: String.raw `${IDENTIFIER_START}(for)(\s+)(${IDENTIFIER})(\s+)(in)${IDENTIFIER_END}`,
|
|
430
433
|
captures: {
|
|
431
434
|
1: { name: `keyword.control.loop.${SCOPE_SUFFIX}` },
|
|
432
435
|
3: { name: `variable.other.${SCOPE_SUFFIX}` },
|
|
@@ -487,7 +490,7 @@ function sourceRepository() {
|
|
|
487
490
|
patterns: [
|
|
488
491
|
{
|
|
489
492
|
name: `keyword.operator.expression.${SCOPE_SUFFIX}`,
|
|
490
|
-
match: String.raw
|
|
493
|
+
match: String.raw `${IDENTIFIER_START}type${IDENTIFIER_END}(?=\s*\(|\s+${IDENTIFIER})`,
|
|
491
494
|
},
|
|
492
495
|
],
|
|
493
496
|
},
|
|
@@ -639,27 +642,43 @@ export function createMiraScriptDocGrammar() {
|
|
|
639
642
|
...documentationRepository('source.mira#source'),
|
|
640
643
|
doc: {
|
|
641
644
|
patterns: [
|
|
645
|
+
{ include: '#tag' },
|
|
642
646
|
{ include: '#global-value' },
|
|
643
647
|
{ include: '#global-constants' },
|
|
644
648
|
{ include: '#inline-parameter' },
|
|
649
|
+
{ include: '#properties' },
|
|
645
650
|
{ include: '#inline-label' },
|
|
651
|
+
{ include: '#binding-value' },
|
|
646
652
|
{ include: '#bindings' },
|
|
647
653
|
{ include: '#function-signatures' },
|
|
648
|
-
{ include: '#properties' },
|
|
649
654
|
{ include: '#generic-types' },
|
|
650
655
|
{ include: '#parameters' },
|
|
651
656
|
{ include: '#return-type' },
|
|
652
|
-
{ include: '#
|
|
657
|
+
{ include: '#tag-comment' },
|
|
653
658
|
{ include: 'source.mira' },
|
|
654
659
|
],
|
|
655
660
|
},
|
|
661
|
+
tag: {
|
|
662
|
+
patterns: [
|
|
663
|
+
{
|
|
664
|
+
name: 'meta.documentation.tag.mira',
|
|
665
|
+
contentName: 'meta.documentation.tag.content.mira',
|
|
666
|
+
begin: `(<)(?=${DOC_TAG_CONTENT}>)`,
|
|
667
|
+
beginCaptures: { 1: { name: 'punctuation.definition.tag.begin.mira' } },
|
|
668
|
+
end: '(>)',
|
|
669
|
+
endCaptures: { 1: { name: 'punctuation.definition.tag.end.mira' } },
|
|
670
|
+
patterns: [{ include: '#tag-content' }],
|
|
671
|
+
},
|
|
672
|
+
],
|
|
673
|
+
},
|
|
656
674
|
'global-value': {
|
|
657
675
|
patterns: [
|
|
658
676
|
{
|
|
677
|
+
name: 'meta.documentation.global-value.mira',
|
|
659
678
|
begin: String.raw `^(\x00)?(\(global\))(\s+)(${IDENTIFIER})(\s*)(=)`,
|
|
660
679
|
beginCaptures: {
|
|
661
680
|
2: { name: 'entity.name.label.mira' },
|
|
662
|
-
4: { name: 'variable.other.
|
|
681
|
+
4: { name: 'variable.other.mira' },
|
|
663
682
|
6: { name: 'keyword.operator.assignment.mira' },
|
|
664
683
|
},
|
|
665
684
|
end: '$',
|
|
@@ -714,7 +733,7 @@ export function createMiraScriptDocGrammar() {
|
|
|
714
733
|
bindings: {
|
|
715
734
|
patterns: [
|
|
716
735
|
{
|
|
717
|
-
match: String.raw
|
|
736
|
+
match: String.raw `${IDENTIFIER_START}(let)(\s+)(mut)(\s+)(${IDENTIFIER})`,
|
|
718
737
|
captures: {
|
|
719
738
|
1: { name: 'keyword.declaration.variable.mira' },
|
|
720
739
|
3: { name: 'keyword.declaration.mutable.mira' },
|
|
@@ -722,7 +741,7 @@ export function createMiraScriptDocGrammar() {
|
|
|
722
741
|
},
|
|
723
742
|
},
|
|
724
743
|
{
|
|
725
|
-
match: String.raw
|
|
744
|
+
match: String.raw `${IDENTIFIER_START}(let|const)(\s+)(${IDENTIFIER})`,
|
|
726
745
|
captures: {
|
|
727
746
|
1: { name: 'keyword.declaration.variable.mira' },
|
|
728
747
|
3: { name: 'variable.other.constant.mira' },
|
|
@@ -730,10 +749,35 @@ export function createMiraScriptDocGrammar() {
|
|
|
730
749
|
},
|
|
731
750
|
],
|
|
732
751
|
},
|
|
752
|
+
'binding-value': {
|
|
753
|
+
patterns: [
|
|
754
|
+
{
|
|
755
|
+
begin: String.raw `${IDENTIFIER_START}(let)(\s+)(mut)(\s+)(${IDENTIFIER})(\s*)(=)`,
|
|
756
|
+
beginCaptures: {
|
|
757
|
+
1: { name: 'keyword.declaration.variable.mira' },
|
|
758
|
+
3: { name: 'keyword.declaration.mutable.mira' },
|
|
759
|
+
5: { name: 'variable.other.readwrite.mira' },
|
|
760
|
+
7: { name: 'keyword.operator.assignment.mira' },
|
|
761
|
+
},
|
|
762
|
+
end: '$',
|
|
763
|
+
patterns: [{ include: '#doc-value' }],
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
begin: String.raw `${IDENTIFIER_START}(let|const)(\s+)(${IDENTIFIER})(\s*)(=)`,
|
|
767
|
+
beginCaptures: {
|
|
768
|
+
1: { name: 'keyword.declaration.variable.mira' },
|
|
769
|
+
3: { name: 'variable.other.constant.mira' },
|
|
770
|
+
5: { name: 'keyword.operator.assignment.mira' },
|
|
771
|
+
},
|
|
772
|
+
end: '$',
|
|
773
|
+
patterns: [{ include: '#doc-value' }],
|
|
774
|
+
},
|
|
775
|
+
],
|
|
776
|
+
},
|
|
733
777
|
'function-signatures': {
|
|
734
778
|
patterns: [
|
|
735
779
|
{
|
|
736
|
-
match: String.raw
|
|
780
|
+
match: String.raw `${IDENTIFIER_START}(?:(pub)(\s+))?(fn)(\s+)(${IDENTIFIER})(?=\s*(?:<|\())`,
|
|
737
781
|
captures: {
|
|
738
782
|
1: { name: 'keyword.control.module.mira' },
|
|
739
783
|
3: { name: 'keyword.declaration.function.mira' },
|
|
@@ -745,22 +789,65 @@ export function createMiraScriptDocGrammar() {
|
|
|
745
789
|
properties: {
|
|
746
790
|
patterns: [
|
|
747
791
|
{
|
|
748
|
-
|
|
792
|
+
name: 'meta.documentation.field.mira',
|
|
793
|
+
begin: String.raw `^(\x00)?(?:(\(field\))(\s+))?(${DOC_FIELD_NAME})(\s*)(\??:)(?=[ \t]*/\*[ \t]*<extern[ \t]+(?:(?:async[ \t]+)?function\*?)(?:[ \t]+${DOC_TAG_NAME})?>[ \t]*\*/)`,
|
|
749
794
|
beginCaptures: {
|
|
750
|
-
|
|
751
|
-
|
|
795
|
+
2: { name: 'entity.name.label.mira' },
|
|
796
|
+
4: { name: 'entity.name.function.mira' },
|
|
797
|
+
6: { name: 'punctuation.separator.type.mira' },
|
|
752
798
|
},
|
|
753
799
|
end: '$',
|
|
754
|
-
patterns: [
|
|
800
|
+
patterns: [
|
|
801
|
+
{ include: '#tag-comment' },
|
|
802
|
+
{ include: '#tag' },
|
|
803
|
+
{ include: '#doc-record-value' },
|
|
804
|
+
{ include: '#doc-array-value' },
|
|
805
|
+
{ include: '#type-context' },
|
|
806
|
+
],
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
name: 'meta.documentation.field.mira',
|
|
810
|
+
begin: String.raw `^(\x00)?(?:(\(field\))(\s+))?(${DOC_FIELD_NAME})(\s*)(\??:)(?=[ \t]*/\*[ \t]*<extern[ \t]+class(?:[ \t]+${DOC_TAG_NAME})?>[ \t]*\*/)`,
|
|
811
|
+
beginCaptures: {
|
|
812
|
+
2: { name: 'entity.name.label.mira' },
|
|
813
|
+
4: { name: 'entity.name.type.mira' },
|
|
814
|
+
6: { name: 'punctuation.separator.type.mira' },
|
|
815
|
+
},
|
|
816
|
+
end: '$',
|
|
817
|
+
patterns: [
|
|
818
|
+
{ include: '#tag-comment' },
|
|
819
|
+
{ include: '#tag' },
|
|
820
|
+
{ include: '#doc-record-value' },
|
|
821
|
+
{ include: '#doc-array-value' },
|
|
822
|
+
{ include: '#type-context' },
|
|
823
|
+
],
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
name: 'meta.documentation.field.mira',
|
|
827
|
+
begin: String.raw `^(\x00)?(?:(\(field\))(\s+))?(${DOC_FIELD_NAME})(\s*)(\??:)`,
|
|
828
|
+
beginCaptures: {
|
|
829
|
+
2: { name: 'entity.name.label.mira' },
|
|
830
|
+
4: { name: 'variable.other.property.mira' },
|
|
831
|
+
6: { name: 'punctuation.separator.type.mira' },
|
|
832
|
+
},
|
|
833
|
+
end: '$',
|
|
834
|
+
patterns: [
|
|
835
|
+
{ include: '#tag-comment' },
|
|
836
|
+
{ include: '#tag' },
|
|
837
|
+
{ include: '#doc-record-value' },
|
|
838
|
+
{ include: '#doc-array-value' },
|
|
839
|
+
{ include: '#type-context' },
|
|
840
|
+
],
|
|
755
841
|
},
|
|
756
842
|
],
|
|
757
843
|
},
|
|
758
844
|
'doc-value': {
|
|
759
845
|
patterns: [
|
|
760
|
-
{ include: '#
|
|
761
|
-
{ include: '#
|
|
762
|
-
{ include: '#
|
|
846
|
+
{ include: '#tag-properties' },
|
|
847
|
+
{ include: '#tag-comment' },
|
|
848
|
+
{ include: '#tag' },
|
|
763
849
|
{ include: '#doc-record-value' },
|
|
850
|
+
{ include: '#doc-array-value' },
|
|
764
851
|
{ include: 'source.mira' },
|
|
765
852
|
],
|
|
766
853
|
},
|
|
@@ -775,21 +862,28 @@ export function createMiraScriptDocGrammar() {
|
|
|
775
862
|
},
|
|
776
863
|
],
|
|
777
864
|
},
|
|
778
|
-
'
|
|
865
|
+
'doc-array-value': {
|
|
779
866
|
patterns: [
|
|
780
867
|
{
|
|
781
|
-
|
|
868
|
+
begin: String.raw `\[`,
|
|
869
|
+
beginCaptures: { 0: { name: 'punctuation.section.brackets.begin.mira' } },
|
|
870
|
+
end: String.raw `\]`,
|
|
871
|
+
endCaptures: { 0: { name: 'punctuation.section.brackets.end.mira' } },
|
|
872
|
+
patterns: [{ include: '#doc-value' }],
|
|
873
|
+
},
|
|
874
|
+
],
|
|
875
|
+
},
|
|
876
|
+
'tag-properties': {
|
|
877
|
+
patterns: [
|
|
878
|
+
{
|
|
879
|
+
match: String.raw `(${DOC_FIELD_NAME})(\s*)(:)(?=[ \t]*/\*[ \t]*<extern[ \t]+(?:(?:async[ \t]+)?function\*?)(?:[ \t]+${DOC_TAG_NAME})?>[ \t]*\*/)`,
|
|
782
880
|
captures: {
|
|
783
881
|
1: { name: 'entity.name.function.mira' },
|
|
784
882
|
3: { name: 'punctuation.separator.key-value.mira' },
|
|
785
883
|
},
|
|
786
884
|
},
|
|
787
|
-
],
|
|
788
|
-
},
|
|
789
|
-
'extern-class-properties': {
|
|
790
|
-
patterns: [
|
|
791
885
|
{
|
|
792
|
-
match: String.raw `(${
|
|
886
|
+
match: String.raw `(${DOC_FIELD_NAME})(\s*)(:)(?=[ \t]*/\*[ \t]*<extern[ \t]+class(?:[ \t]+${DOC_TAG_NAME})?>[ \t]*\*/)`,
|
|
793
887
|
captures: {
|
|
794
888
|
1: { name: 'entity.name.type.mira' },
|
|
795
889
|
3: { name: 'punctuation.separator.key-value.mira' },
|
|
@@ -797,54 +891,84 @@ export function createMiraScriptDocGrammar() {
|
|
|
797
891
|
},
|
|
798
892
|
],
|
|
799
893
|
},
|
|
800
|
-
|
|
894
|
+
'tag-comment': {
|
|
801
895
|
patterns: [
|
|
802
896
|
{
|
|
803
897
|
name: 'comment.block.mira',
|
|
804
|
-
contentName: 'meta.documentation.
|
|
805
|
-
begin: String.raw
|
|
806
|
-
beginCaptures: {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
},
|
|
828
|
-
{
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
},
|
|
835
|
-
{ name: '
|
|
836
|
-
{ name: '
|
|
837
|
-
|
|
838
|
-
|
|
898
|
+
contentName: 'meta.documentation.tag.mira',
|
|
899
|
+
begin: String.raw `(/\*)([ \t]*)(<)(?=${DOC_TAG_CONTENT}>[ \t]*\*/)`,
|
|
900
|
+
beginCaptures: {
|
|
901
|
+
1: { name: 'punctuation.definition.comment.begin.mira' },
|
|
902
|
+
3: { name: 'punctuation.definition.tag.begin.mira' },
|
|
903
|
+
},
|
|
904
|
+
end: String.raw `(>)([ \t]*)(\*/)`,
|
|
905
|
+
endCaptures: {
|
|
906
|
+
1: { name: 'punctuation.definition.tag.end.mira' },
|
|
907
|
+
3: { name: 'punctuation.definition.comment.end.mira' },
|
|
908
|
+
},
|
|
909
|
+
patterns: [{ include: '#tag-content' }],
|
|
910
|
+
},
|
|
911
|
+
],
|
|
912
|
+
},
|
|
913
|
+
'tag-content': {
|
|
914
|
+
patterns: [
|
|
915
|
+
{
|
|
916
|
+
match: String.raw `(extern)([ \t]+)(?:(async)([ \t]+))?(function)(\*)?(?:([ \t]+)(${DOC_TAG_NAME}))?(?=>)`,
|
|
917
|
+
captures: {
|
|
918
|
+
1: { name: 'keyword.declaration.extern.mira' },
|
|
919
|
+
3: { name: 'keyword.js' },
|
|
920
|
+
5: { name: 'keyword.js' },
|
|
921
|
+
6: { name: 'keyword.operator.generator.js' },
|
|
922
|
+
8: { name: 'entity.name.function.js' },
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
match: String.raw `(extern)([ \t]+)(class)(?:([ \t]+)(${DOC_TAG_NAME}))?(?=>)`,
|
|
927
|
+
captures: {
|
|
928
|
+
1: { name: 'keyword.declaration.extern.mira' },
|
|
929
|
+
3: { name: 'keyword.js' },
|
|
930
|
+
5: { name: 'entity.name.type.js' },
|
|
931
|
+
},
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
match: String.raw `(extern)([ \t]+)(${DOC_TAG_NAME})(\()(${DOC_TAG_NUMBER})(\))(?=>)`,
|
|
935
|
+
captures: {
|
|
936
|
+
1: { name: 'keyword.declaration.extern.mira' },
|
|
937
|
+
3: { name: 'entity.name.type.js' },
|
|
938
|
+
4: { name: 'punctuation.section.parens.begin.mira' },
|
|
939
|
+
5: { name: 'constant.numeric.mira' },
|
|
940
|
+
6: { name: 'punctuation.section.parens.end.mira' },
|
|
941
|
+
},
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
match: String.raw `(extern)(?:([ \t]+)(${DOC_TAG_NAME}))?(?=>)`,
|
|
945
|
+
captures: {
|
|
946
|
+
1: { name: 'keyword.declaration.extern.mira' },
|
|
947
|
+
3: { name: 'entity.name.type.js' },
|
|
948
|
+
},
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
match: String.raw `(module)(?:([ \t]+)(${DOC_TAG_NAME}))?(?=>)`,
|
|
952
|
+
captures: {
|
|
953
|
+
1: { name: 'keyword.declaration.module.mira' },
|
|
954
|
+
3: { name: 'entity.name.namespace.mira' },
|
|
955
|
+
},
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
match: String.raw `(function)(?:([ \t]+)(${DOC_TAG_NAME}))?(?=>)`,
|
|
959
|
+
captures: {
|
|
960
|
+
1: { name: 'keyword.declaration.function.mira' },
|
|
961
|
+
3: { name: 'entity.name.function.mira' },
|
|
962
|
+
},
|
|
839
963
|
},
|
|
840
964
|
],
|
|
841
965
|
},
|
|
842
966
|
'reflection-type': {
|
|
843
967
|
patterns: [
|
|
844
968
|
{
|
|
845
|
-
match: String.raw
|
|
969
|
+
match: String.raw `${IDENTIFIER_START}(type)(\s*)(\()(\s*)(${IDENTIFIER})(\s*)(\))`,
|
|
846
970
|
captures: {
|
|
847
|
-
1: { name: '
|
|
971
|
+
1: { name: 'support.type.type.mira' },
|
|
848
972
|
3: { name: 'punctuation.section.parens.begin.mira' },
|
|
849
973
|
5: { name: 'variable.other.mira' },
|
|
850
974
|
7: { name: 'punctuation.section.parens.end.mira' },
|
|
@@ -865,7 +989,7 @@ export function createMiraScriptDocGrammar() {
|
|
|
865
989
|
'function-type': {
|
|
866
990
|
patterns: [
|
|
867
991
|
{
|
|
868
|
-
begin: String.raw
|
|
992
|
+
begin: String.raw `${IDENTIFIER_START}(fn)${IDENTIFIER_END}(?=\s*(?:<|\())`,
|
|
869
993
|
beginCaptures: { 1: { name: 'support.type.function.mira' } },
|
|
870
994
|
end: String.raw `(?=\s*(?:,|\)|$))`,
|
|
871
995
|
patterns: [
|
|
@@ -988,11 +1112,7 @@ export function createMiraScriptDocGrammar() {
|
|
|
988
1112
|
{ include: '#reflection-type' },
|
|
989
1113
|
{
|
|
990
1114
|
name: 'support.type.builtin.mira',
|
|
991
|
-
match:
|
|
992
|
-
},
|
|
993
|
-
{
|
|
994
|
-
name: 'constant.language.boolean.mira',
|
|
995
|
-
match: String.raw `(?<!\p{XID_Continue})(?:true|false)${IDENTIFIER_END}`,
|
|
1115
|
+
match: `${IDENTIFIER_START}(?:${alternatives(BUILT_IN_TYPES)})${IDENTIFIER_END}`,
|
|
996
1116
|
},
|
|
997
1117
|
{ name: 'keyword.operator.type.mira', match: '[&|]' },
|
|
998
1118
|
{ name: 'keyword.operator.spread.mira', match: String.raw `\.\.` },
|