@mirascript/textmate 0.1.86 → 0.1.88
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 +6 -8
- package/dist/grammar.js.map +1 -1
- package/dist/mirascript-doc.tmLanguage.json +1 -1
- package/dist/mirascript-template.tmLanguage.json +158 -262
- package/dist/mirascript.tmLanguage.json +155 -257
- package/package.json +2 -2
- package/src/grammar.ts +6 -8
- package/tests/grammar/documentation-mode.ts +2 -2
- package/tests/grammar/language.ts +3 -1
- package/tests/grammar/strings.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/textmate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.88",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "TextMate grammars for MiraScript.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@shikijs/types": "^4.4.3",
|
|
29
|
-
"@mirascript/constants": "~0.1.
|
|
29
|
+
"@mirascript/constants": "~0.1.88"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"shiki": "^4.4.3",
|
package/src/grammar.ts
CHANGED
|
@@ -87,7 +87,7 @@ function interpolationPatterns(dollarCount: number) {
|
|
|
87
87
|
const dollars = String.raw`\$`.repeat(dollarCount);
|
|
88
88
|
return [
|
|
89
89
|
{
|
|
90
|
-
name: `meta.interpolation.simple.mira`,
|
|
90
|
+
name: `meta.embedded.interpolation.simple.mira`,
|
|
91
91
|
match: `(${dollars})(${IDENTIFIER})`,
|
|
92
92
|
captures: {
|
|
93
93
|
1: { name: `punctuation.definition.template-expression.begin.mira` },
|
|
@@ -95,19 +95,17 @@ function interpolationPatterns(dollarCount: number) {
|
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
|
-
name: `meta.interpolation.block.mira`,
|
|
98
|
+
name: `meta.embedded.interpolation.block.mira`,
|
|
99
99
|
begin: String.raw`(${dollars}\{)`,
|
|
100
100
|
beginCaptures: { 1: { name: `punctuation.definition.template-expression.begin.mira` } },
|
|
101
|
-
contentName: `meta.embedded.expression.mira`,
|
|
102
101
|
end: String.raw`\}`,
|
|
103
102
|
endCaptures: { 0: { name: `punctuation.definition.template-expression.end.mira` } },
|
|
104
103
|
patterns: [{ include: '#braced-content' }],
|
|
105
104
|
},
|
|
106
105
|
{
|
|
107
|
-
name: `meta.interpolation.expression.mira`,
|
|
106
|
+
name: `meta.embedded.interpolation.expression.mira`,
|
|
108
107
|
begin: String.raw`(${dollars}\()`,
|
|
109
108
|
beginCaptures: { 1: { name: `punctuation.definition.template-expression.begin.mira` } },
|
|
110
|
-
contentName: `meta.embedded.expression.mira`,
|
|
111
109
|
end: String.raw`\)`,
|
|
112
110
|
endCaptures: { 0: { name: `punctuation.definition.template-expression.end.mira` } },
|
|
113
111
|
patterns: [
|
|
@@ -327,7 +325,7 @@ function sourceRepository(): LanguageRegistration['repository'] {
|
|
|
327
325
|
keywordRule(CONTROL_KEYWORDS, 'keyword.control'),
|
|
328
326
|
keywordRule(wordOperators, 'keyword.operator.wordlike'),
|
|
329
327
|
keywordRule(declarationKeywords, 'keyword.declaration'),
|
|
330
|
-
keywordRule(moduleKeywords, 'keyword.
|
|
328
|
+
keywordRule(moduleKeywords, 'keyword.module'),
|
|
331
329
|
keywordRule(RESERVED_KEYWORDS, 'keyword.reserved'),
|
|
332
330
|
keywordRule(languageVariables, 'variable.language'),
|
|
333
331
|
keywordRule(otherKeywords, 'keyword.other'),
|
|
@@ -451,7 +449,7 @@ function sourceRepository(): LanguageRegistration['repository'] {
|
|
|
451
449
|
{
|
|
452
450
|
match: String.raw`${IDENTIFIER_START}(mod)(\s+)(${IDENTIFIER})`,
|
|
453
451
|
captures: {
|
|
454
|
-
1: { name: `keyword.
|
|
452
|
+
1: { name: `keyword.module.mira` },
|
|
455
453
|
3: { name: `entity.name.namespace.mira` },
|
|
456
454
|
},
|
|
457
455
|
},
|
|
@@ -822,7 +820,7 @@ export function createMiraScriptDocGrammar(): LanguageRegistration {
|
|
|
822
820
|
{
|
|
823
821
|
match: String.raw`${IDENTIFIER_START}(?:(pub)(\s+))?(fn)(\s+)(${IDENTIFIER})(?=\s*(?:<|\())`,
|
|
824
822
|
captures: {
|
|
825
|
-
1: { name: 'keyword.
|
|
823
|
+
1: { name: 'keyword.module.mira' },
|
|
826
824
|
3: { name: 'keyword.declaration.function.mira' },
|
|
827
825
|
5: { name: 'entity.name.function.mira' },
|
|
828
826
|
},
|
|
@@ -64,9 +64,9 @@ test('distinguishes doc declarations, globals, and nested function types', (t) =
|
|
|
64
64
|
].join('\n'),
|
|
65
65
|
'mirascript-doc',
|
|
66
66
|
);
|
|
67
|
-
expectScope(t, tokens, 'mod', 'keyword.
|
|
67
|
+
expectScope(t, tokens, 'mod', 'keyword.module.mira', 0);
|
|
68
68
|
expectScope(t, tokens, 'matrix', 'entity.name.namespace.mira', 0);
|
|
69
|
-
expectScope(t, tokens, 'pub', 'keyword.
|
|
69
|
+
expectScope(t, tokens, 'pub', 'keyword.module.mira');
|
|
70
70
|
expectScope(t, tokens, 'PI', 'variable.other.constant.mira', 0);
|
|
71
71
|
expectScope(t, tokens, 'PI', 'variable.other.constant.mira', 1);
|
|
72
72
|
expectScope(t, tokens, '(global)', 'entity.name.label.mira', 0);
|
|
@@ -3,9 +3,11 @@ import { tokenize, expectScope } from '../_engine.ts';
|
|
|
3
3
|
|
|
4
4
|
test('classifies declarations, parameters, properties, calls, and Unicode identifiers', (t) => {
|
|
5
5
|
const tokens = tokenize('mod 数学 { fn 加法(mut 左, ..其余) { 对象.方法(左).属性 } }');
|
|
6
|
-
expectScope(t, tokens, 'mod', 'keyword.
|
|
6
|
+
expectScope(t, tokens, 'mod', 'keyword.module.mira');
|
|
7
7
|
expectScope(t, tokens, '数学', 'entity.name.namespace.mira');
|
|
8
|
+
expectScope(t, tokens, 'fn', 'keyword.declaration.function.mira');
|
|
8
9
|
expectScope(t, tokens, '加法', 'entity.name.function.mira');
|
|
10
|
+
expectScope(t, tokens, 'mut', 'keyword.declaration.mutable.mira');
|
|
9
11
|
expectScope(t, tokens, '左', 'variable.emphasis.mira');
|
|
10
12
|
expectScope(t, tokens, '其余', 'variable.other.constant.emphasis.mira');
|
|
11
13
|
expectScope(t, tokens, '方法', 'entity.name.function.member.mira');
|
package/tests/grammar/strings.ts
CHANGED
|
@@ -14,7 +14,7 @@ test('scopes nested interpolation delimiters and strings', (t) => {
|
|
|
14
14
|
const tokens = tokenize('"$(len([1,2,3])) ${let a = "x${\'y\'}"; a}"');
|
|
15
15
|
expectScope(t, tokens, '(', 'punctuation.section.parens.begin.mira');
|
|
16
16
|
expectScope(t, tokens, '[', 'punctuation.section.brackets.begin.mira');
|
|
17
|
-
expectScope(t, tokens, ',', 'meta.embedded.expression.mira');
|
|
17
|
+
expectScope(t, tokens, ',', 'meta.embedded.interpolation.expression.mira');
|
|
18
18
|
expectScope(t, tokens, ']', 'punctuation.section.brackets.end.mira');
|
|
19
19
|
expectScope(t, tokens, ')', 'punctuation.section.parens.end.mira');
|
|
20
20
|
expectScope(t, tokens, '"', 'string.quoted.double.mira', 1);
|