@codingame/monaco-vscode-editor-api 25.1.2 → 26.0.0
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/package.json +2 -2
- package/vscode/src/vs/editor/editor.api.d.ts +27 -2
- package/vscode/src/vs/editor/standalone/browser/colorizer.js +26 -20
- package/vscode/src/vs/editor/standalone/browser/standaloneEditor.js +46 -23
- package/vscode/src/vs/editor/standalone/browser/standaloneLanguages.js +32 -30
- package/vscode/src/vs/editor/standalone/browser/standaloneWebWorker.js +6 -7
- package/vscode/src/vs/editor/standalone/common/monarch/monarchCommon.js +15 -17
- package/vscode/src/vs/editor/standalone/common/monarch/monarchCompile.js +232 -167
- package/vscode/src/vs/editor/standalone/common/monarch/monarchLexer.js +148 -109
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { escapeRegExpCharacters } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
3
3
|
|
|
4
4
|
var MonarchBracket;
|
|
5
|
-
(function
|
|
5
|
+
(function(MonarchBracket) {
|
|
6
6
|
MonarchBracket[MonarchBracket["None"] = 0] = "None";
|
|
7
7
|
MonarchBracket[MonarchBracket["Open"] = 1] = "Open";
|
|
8
8
|
MonarchBracket[MonarchBracket["Close"] = -1] = "Close";
|
|
@@ -14,7 +14,7 @@ function isFuzzyAction(what) {
|
|
|
14
14
|
return !isFuzzyActionArr(what);
|
|
15
15
|
}
|
|
16
16
|
function isString(what) {
|
|
17
|
-
return (typeof what ===
|
|
17
|
+
return (typeof what === "string");
|
|
18
18
|
}
|
|
19
19
|
function isIAction(what) {
|
|
20
20
|
return !isString(what);
|
|
@@ -26,7 +26,7 @@ function fixCase(lexer, str) {
|
|
|
26
26
|
return (lexer.ignoreCase && str ? str.toLowerCase() : str);
|
|
27
27
|
}
|
|
28
28
|
function sanitize(s) {
|
|
29
|
-
return s.replace(/[&<>'"_]/g,
|
|
29
|
+
return s.replace(/[&<>'"_]/g, "-");
|
|
30
30
|
}
|
|
31
31
|
function log(lexer, msg) {
|
|
32
32
|
console.log(`${lexer.languageId}: ${msg}`);
|
|
@@ -37,9 +37,9 @@ function createError(lexer, msg) {
|
|
|
37
37
|
function substituteMatches(lexer, str, id, matches, state) {
|
|
38
38
|
const re = /\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;
|
|
39
39
|
let stateMatches = null;
|
|
40
|
-
return str.replace(re, function
|
|
40
|
+
return str.replace(re, function(full, sub, dollar, hash, n, s, attr, ofs, total) {
|
|
41
41
|
if (!empty(dollar)) {
|
|
42
|
-
return
|
|
42
|
+
return "$";
|
|
43
43
|
}
|
|
44
44
|
if (!empty(hash)) {
|
|
45
45
|
return fixCase(lexer, id);
|
|
@@ -47,31 +47,31 @@ function substituteMatches(lexer, str, id, matches, state) {
|
|
|
47
47
|
if (!empty(n) && n < matches.length) {
|
|
48
48
|
return fixCase(lexer, matches[n]);
|
|
49
49
|
}
|
|
50
|
-
if (!empty(attr) && lexer && typeof (lexer[attr]) ===
|
|
50
|
+
if (!empty(attr) && lexer && typeof (lexer[attr]) === "string") {
|
|
51
51
|
return lexer[attr];
|
|
52
52
|
}
|
|
53
53
|
if (stateMatches === null) {
|
|
54
|
-
stateMatches = state.split(
|
|
54
|
+
stateMatches = state.split(".");
|
|
55
55
|
stateMatches.unshift(state);
|
|
56
56
|
}
|
|
57
57
|
if (!empty(s) && s < stateMatches.length) {
|
|
58
58
|
return fixCase(lexer, stateMatches[s]);
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return "";
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
function substituteMatchesRe(lexer, str, state) {
|
|
64
64
|
const re = /\$[sS](\d\d?)/g;
|
|
65
65
|
let stateMatches = null;
|
|
66
|
-
return str.replace(re, function
|
|
66
|
+
return str.replace(re, function(full, s) {
|
|
67
67
|
if (stateMatches === null) {
|
|
68
|
-
stateMatches = state.split(
|
|
68
|
+
stateMatches = state.split(".");
|
|
69
69
|
stateMatches.unshift(state);
|
|
70
70
|
}
|
|
71
71
|
if (!empty(s) && s < stateMatches.length) {
|
|
72
72
|
return escapeRegExpCharacters(fixCase(lexer, stateMatches[s]));
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return "";
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
function findRules(lexer, inState) {
|
|
@@ -81,11 +81,10 @@ function findRules(lexer, inState) {
|
|
|
81
81
|
if (rules) {
|
|
82
82
|
return rules;
|
|
83
83
|
}
|
|
84
|
-
const idx = state.lastIndexOf(
|
|
84
|
+
const idx = state.lastIndexOf(".");
|
|
85
85
|
if (idx < 0) {
|
|
86
86
|
state = null;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
87
|
+
} else {
|
|
89
88
|
state = state.substr(0, idx);
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -98,11 +97,10 @@ function stateExists(lexer, inState) {
|
|
|
98
97
|
if (exist) {
|
|
99
98
|
return true;
|
|
100
99
|
}
|
|
101
|
-
const idx = state.lastIndexOf(
|
|
100
|
+
const idx = state.lastIndexOf(".");
|
|
102
101
|
if (idx < 0) {
|
|
103
102
|
state = null;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
103
|
+
} else {
|
|
106
104
|
state = state.substr(0, idx);
|
|
107
105
|
}
|
|
108
106
|
}
|