@codingame/monaco-vscode-api 1.76.1 → 1.76.3-next.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/README.md +2 -1
- package/dist/api.js +3 -860
- package/dist/{extHost.js → api2.js} +16555 -13467
- package/dist/async.js +107 -2
- package/dist/audioCue.js +105 -103
- package/dist/button.js +1 -1
- package/dist/cancellation.js +3 -0
- package/dist/configuration.js +7 -344
- package/dist/configuration2.js +339 -0
- package/dist/configurationRegistry.js +441 -0
- package/dist/contextkeys.js +211 -0
- package/dist/debug.d.ts +22 -0
- package/dist/debug.js +15842 -0
- package/dist/dialogs.js +855 -9
- package/dist/extensionResourceLoader.js +96 -0
- package/dist/extensions.d.ts +491 -0
- package/dist/extensions.js +70 -0
- package/dist/{tools.js → extensionsRegistry.js} +2 -30
- package/dist/files.js +1407 -334
- package/dist/iconv.js +43 -0
- package/dist/injection.js +1 -1
- package/dist/jschardet.js +7 -0
- package/dist/keybindings.d.ts +1 -485
- package/dist/keybindings.js +666 -679
- package/dist/labels.js +14 -0
- package/dist/languageConfiguration.d.ts +1 -2
- package/dist/languageConfiguration.js +9 -16
- package/dist/languageService.js +112 -8
- package/dist/languages.d.ts +1 -473
- package/dist/languages.js +2 -12
- package/dist/layout.js +4 -3
- package/dist/layoutService.js +1 -1
- package/dist/missing-services.js +4710 -74
- package/dist/modelEditor.d.ts +324 -2
- package/dist/modelEditor.js +15 -228
- package/dist/monaco.js +7 -72
- package/dist/notifications.js +75 -232
- package/dist/polyfill.js +10715 -2459
- package/dist/resources.js +197 -0
- package/dist/services.d.ts +924 -3
- package/dist/services.js +1 -2
- package/dist/services2.js +2436 -18
- package/dist/snippets.d.ts +1 -473
- package/dist/snippets.js +8 -867
- package/dist/snippetsService.js +868 -0
- package/dist/textFileEditorModel.js +2985 -0
- package/dist/textmate.d.ts +3 -475
- package/dist/textmate.js +19 -29
- package/dist/theme.d.ts +1 -3
- package/dist/theme.js +24 -70
- package/dist/tokenClassification.d.ts +1 -475
- package/dist/tokenClassification.js +11 -37
- package/dist/tokenClassificationRegistry.js +8 -4
- package/dist/variableResolver.js +1711 -0
- package/dist/workbenchThemeService.js +1 -1
- package/dist/workspaceContext.js +1 -3
- package/package.json +27 -12
- package/dist/contextkey.js +0 -419
- package/dist/dialog.web.contribution.js +0 -945
package/dist/services2.js
CHANGED
|
@@ -1,23 +1,1957 @@
|
|
|
1
1
|
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
2
2
|
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
4
|
+
import { isMacintosh, isLinux, isWindows, isWeb, isEdge, isFirefox, isChrome, isSafari, OS } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
5
|
+
import { joinPath, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
6
|
+
import { win32, posix } from 'monaco-editor/esm/vs/base/common/path.js';
|
|
7
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
8
|
+
import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
4
9
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
5
10
|
import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
|
|
11
|
+
import { isString, isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
12
|
+
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
13
|
+
import { RawContextKey as RawContextKey$1 } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
14
|
+
import { PauseableEmitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
15
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
|
|
6
16
|
import { Disposable, MutableDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
7
17
|
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
8
|
-
import {
|
|
9
|
-
import { isString, isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
10
|
-
import { escapeRegExpCharacters } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
18
|
+
import { escapeRegExpCharacters, isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
11
19
|
import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
|
|
12
20
|
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
13
21
|
import { Promises, RunOnceScheduler, runWhenIdle } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
14
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
15
|
-
import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
16
22
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
17
|
-
import {
|
|
23
|
+
import { illegalArgument, illegalState } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
24
|
+
const Emitter = monaco.Emitter;
|
|
18
25
|
function refineServiceDecorator(serviceIdentifier) {
|
|
19
26
|
return serviceIdentifier;
|
|
20
27
|
}
|
|
28
|
+
const WINDOWS_INVALID_FILE_CHARS = /[\\/:\*\?"<>\|]/g;
|
|
29
|
+
const UNIX_INVALID_FILE_CHARS = /[\\/]/g;
|
|
30
|
+
const WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;
|
|
31
|
+
function isValidBasename(name, isWindowsOS = isWindows) {
|
|
32
|
+
const invalidFileChars = isWindowsOS ? WINDOWS_INVALID_FILE_CHARS : UNIX_INVALID_FILE_CHARS;
|
|
33
|
+
if (!name || name.length === 0 || /^\s+$/.test(name)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
invalidFileChars.lastIndex = 0;
|
|
37
|
+
if (invalidFileChars.test(name)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (isWindowsOS && WINDOWS_FORBIDDEN_NAMES.test(name)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (name === '.' || name === '..') {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (isWindowsOS && name[name.length - 1] === '.') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (isWindowsOS && name.length !== name.trim().length) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (name.length > 255) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
var NeverShowAgainScope;
|
|
58
|
+
( ((function(NeverShowAgainScope) {
|
|
59
|
+
NeverShowAgainScope[NeverShowAgainScope["WORKSPACE"] = 0] = "WORKSPACE";
|
|
60
|
+
NeverShowAgainScope[NeverShowAgainScope["PROFILE"] = 1] = "PROFILE";
|
|
61
|
+
NeverShowAgainScope[NeverShowAgainScope["APPLICATION"] = 2] = "APPLICATION";
|
|
62
|
+
})(NeverShowAgainScope || (NeverShowAgainScope = {}))));
|
|
63
|
+
var NotificationsFilter;
|
|
64
|
+
( ((function(NotificationsFilter) {
|
|
65
|
+
NotificationsFilter[NotificationsFilter["OFF"] = 0] = "OFF";
|
|
66
|
+
NotificationsFilter[NotificationsFilter["SILENT"] = 1] = "SILENT";
|
|
67
|
+
NotificationsFilter[NotificationsFilter["ERROR"] = 2] = "ERROR";
|
|
68
|
+
})(NotificationsFilter || (NotificationsFilter = {}))));
|
|
69
|
+
class NoOpNotification {
|
|
70
|
+
constructor() {
|
|
71
|
+
this.progress = ( (new NoOpProgress()));
|
|
72
|
+
this.onDidClose = Event.None;
|
|
73
|
+
this.onDidChangeVisibility = Event.None;
|
|
74
|
+
}
|
|
75
|
+
updateSeverity(severity) { }
|
|
76
|
+
updateMessage(message) { }
|
|
77
|
+
updateActions(actions) { }
|
|
78
|
+
close() { }
|
|
79
|
+
}
|
|
80
|
+
class NoOpProgress {
|
|
81
|
+
infinite() { }
|
|
82
|
+
done() { }
|
|
83
|
+
total(value) { }
|
|
84
|
+
worked(value) { }
|
|
85
|
+
}
|
|
86
|
+
function __decorate(decorators, target, key, desc) {
|
|
87
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
88
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
89
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
90
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
91
|
+
}
|
|
92
|
+
function __param(paramIndex, decorator) {
|
|
93
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
94
|
+
}
|
|
95
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
96
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
97
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
98
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
99
|
+
}
|
|
100
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
101
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
102
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
103
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
104
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
105
|
+
}
|
|
106
|
+
class Scanner {
|
|
107
|
+
constructor() {
|
|
108
|
+
this._input = '';
|
|
109
|
+
this._start = 0;
|
|
110
|
+
this._current = 0;
|
|
111
|
+
this._tokens = [];
|
|
112
|
+
this._errorTokens = [];
|
|
113
|
+
this.stringRe = /[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy;
|
|
114
|
+
}
|
|
115
|
+
static reportError(token) {
|
|
116
|
+
if (token.type !== 19 ) {
|
|
117
|
+
throw illegalArgument(`expected an error token but got ${JSON.stringify(token)}`);
|
|
118
|
+
}
|
|
119
|
+
switch (token.lexeme) {
|
|
120
|
+
case '=': return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you mean '==' or '=~'?`;
|
|
121
|
+
case '&': return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you mean '&&'?`;
|
|
122
|
+
case '|': return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you mean '||'?`;
|
|
123
|
+
default: {
|
|
124
|
+
const lexeme = token.lexeme;
|
|
125
|
+
if (lexeme && lexeme.length > 1 && lexeme.startsWith(`'`)) {
|
|
126
|
+
return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you forget to close the string?`;
|
|
127
|
+
}
|
|
128
|
+
if (lexeme && lexeme.length > 1 && lexeme.endsWith(`'`)) {
|
|
129
|
+
return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you forget to open the string?`;
|
|
130
|
+
}
|
|
131
|
+
return `Unexpected token '${token.lexeme}' at offset ${token.offset}`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
static getLexeme(token) {
|
|
136
|
+
switch (token.type) {
|
|
137
|
+
case 0 :
|
|
138
|
+
return '(';
|
|
139
|
+
case 1 :
|
|
140
|
+
return ')';
|
|
141
|
+
case 2 :
|
|
142
|
+
return '!';
|
|
143
|
+
case 3 :
|
|
144
|
+
return '==';
|
|
145
|
+
case 4 :
|
|
146
|
+
return '!=';
|
|
147
|
+
case 5 :
|
|
148
|
+
return '<';
|
|
149
|
+
case 6 :
|
|
150
|
+
return '<=';
|
|
151
|
+
case 7 :
|
|
152
|
+
return '>=';
|
|
153
|
+
case 8 :
|
|
154
|
+
return '>=';
|
|
155
|
+
case 9 :
|
|
156
|
+
return '=~';
|
|
157
|
+
case 10 :
|
|
158
|
+
return token.lexeme;
|
|
159
|
+
case 11 :
|
|
160
|
+
return 'true';
|
|
161
|
+
case 12 :
|
|
162
|
+
return 'false';
|
|
163
|
+
case 13 :
|
|
164
|
+
return 'in';
|
|
165
|
+
case 14 :
|
|
166
|
+
return 'not';
|
|
167
|
+
case 15 :
|
|
168
|
+
return '&&';
|
|
169
|
+
case 16 :
|
|
170
|
+
return '||';
|
|
171
|
+
case 17 :
|
|
172
|
+
return token.lexeme;
|
|
173
|
+
case 18 :
|
|
174
|
+
return token.lexeme;
|
|
175
|
+
case 19 :
|
|
176
|
+
return token.lexeme;
|
|
177
|
+
case 20 :
|
|
178
|
+
return 'EOF';
|
|
179
|
+
default:
|
|
180
|
+
throw illegalState(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
get errorTokens() {
|
|
184
|
+
return this._errorTokens;
|
|
185
|
+
}
|
|
186
|
+
reset(value) {
|
|
187
|
+
this._input = value;
|
|
188
|
+
this._start = 0;
|
|
189
|
+
this._current = 0;
|
|
190
|
+
this._tokens = [];
|
|
191
|
+
this._errorTokens = [];
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
scan() {
|
|
195
|
+
while (!this._isAtEnd()) {
|
|
196
|
+
this._start = this._current;
|
|
197
|
+
const ch = this._advance();
|
|
198
|
+
switch (ch) {
|
|
199
|
+
case 40 :
|
|
200
|
+
this._addToken(0 );
|
|
201
|
+
break;
|
|
202
|
+
case 41 :
|
|
203
|
+
this._addToken(1 );
|
|
204
|
+
break;
|
|
205
|
+
case 33 :
|
|
206
|
+
this._addToken(this._match(61 ) ? 4 : 2 );
|
|
207
|
+
break;
|
|
208
|
+
case 39 :
|
|
209
|
+
this._quotedString();
|
|
210
|
+
break;
|
|
211
|
+
case 47 :
|
|
212
|
+
this._regex();
|
|
213
|
+
break;
|
|
214
|
+
case 61 :
|
|
215
|
+
if (this._match(61 )) {
|
|
216
|
+
this._addToken(3 );
|
|
217
|
+
}
|
|
218
|
+
else if (this._match(126 )) {
|
|
219
|
+
this._addToken(9 );
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this._error();
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case 60 :
|
|
226
|
+
this._addToken(this._match(61 ) ? 6 : 5 );
|
|
227
|
+
break;
|
|
228
|
+
case 62 :
|
|
229
|
+
this._addToken(this._match(61 ) ? 8 : 7 );
|
|
230
|
+
break;
|
|
231
|
+
case 38 :
|
|
232
|
+
if (this._match(38 )) {
|
|
233
|
+
this._addToken(15 );
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
this._error();
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
case 124 :
|
|
240
|
+
if (this._match(124 )) {
|
|
241
|
+
this._addToken(16 );
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
this._error();
|
|
245
|
+
}
|
|
246
|
+
break;
|
|
247
|
+
case 32 :
|
|
248
|
+
case 13 :
|
|
249
|
+
case 9 :
|
|
250
|
+
case 10 :
|
|
251
|
+
case 160 :
|
|
252
|
+
break;
|
|
253
|
+
default:
|
|
254
|
+
this._string();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
this._start = this._current;
|
|
258
|
+
this._addToken(20 );
|
|
259
|
+
return Array.from(this._tokens);
|
|
260
|
+
}
|
|
261
|
+
_match(expected) {
|
|
262
|
+
if (this._isAtEnd()) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
if (this._input.charCodeAt(this._current) !== expected) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
this._current++;
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
_advance() {
|
|
272
|
+
return this._input.charCodeAt(this._current++);
|
|
273
|
+
}
|
|
274
|
+
_peek() {
|
|
275
|
+
return this._isAtEnd() ? 0 : this._input.charCodeAt(this._current);
|
|
276
|
+
}
|
|
277
|
+
_addToken(type) {
|
|
278
|
+
this._tokens.push({ type, offset: this._start });
|
|
279
|
+
}
|
|
280
|
+
_error() {
|
|
281
|
+
const errToken = { type: 19 , offset: this._start, lexeme: this._input.substring(this._start, this._current) };
|
|
282
|
+
this._errorTokens.push(errToken);
|
|
283
|
+
this._tokens.push(errToken);
|
|
284
|
+
}
|
|
285
|
+
_string() {
|
|
286
|
+
this.stringRe.lastIndex = this._start;
|
|
287
|
+
const match = this.stringRe.exec(this._input);
|
|
288
|
+
if (match) {
|
|
289
|
+
this._current = this._start + match[0].length;
|
|
290
|
+
const lexeme = this._input.substring(this._start, this._current);
|
|
291
|
+
const keyword = Scanner._keywords.get(lexeme);
|
|
292
|
+
if (keyword) {
|
|
293
|
+
this._addToken(keyword);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this._tokens.push({ type: 17 , lexeme, offset: this._start });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
_quotedString() {
|
|
301
|
+
while (this._peek() !== 39 && !this._isAtEnd()) {
|
|
302
|
+
this._advance();
|
|
303
|
+
}
|
|
304
|
+
if (this._isAtEnd()) {
|
|
305
|
+
this._error();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
this._advance();
|
|
309
|
+
this._tokens.push({ type: 18 , lexeme: this._input.substring(this._start + 1, this._current - 1), offset: this._start + 1 });
|
|
310
|
+
}
|
|
311
|
+
_regex() {
|
|
312
|
+
let p = this._current;
|
|
313
|
+
let inEscape = false;
|
|
314
|
+
let inCharacterClass = false;
|
|
315
|
+
while (true) {
|
|
316
|
+
if (p >= this._input.length) {
|
|
317
|
+
this._current = p;
|
|
318
|
+
this._error();
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const ch = this._input.charCodeAt(p);
|
|
322
|
+
if (inEscape) {
|
|
323
|
+
inEscape = false;
|
|
324
|
+
}
|
|
325
|
+
else if (ch === 47 && !inCharacterClass) {
|
|
326
|
+
p++;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
else if (ch === 91 ) {
|
|
330
|
+
inCharacterClass = true;
|
|
331
|
+
}
|
|
332
|
+
else if (ch === 92 ) {
|
|
333
|
+
inEscape = true;
|
|
334
|
+
}
|
|
335
|
+
else if (ch === 93 ) {
|
|
336
|
+
inCharacterClass = false;
|
|
337
|
+
}
|
|
338
|
+
p++;
|
|
339
|
+
}
|
|
340
|
+
while (p < this._input.length && Scanner._regexFlags.has(this._input.charCodeAt(p))) {
|
|
341
|
+
p++;
|
|
342
|
+
}
|
|
343
|
+
this._current = p;
|
|
344
|
+
const lexeme = this._input.substring(this._start, this._current);
|
|
345
|
+
this._tokens.push({ type: 10 , lexeme, offset: this._start });
|
|
346
|
+
}
|
|
347
|
+
_isAtEnd() {
|
|
348
|
+
return this._current >= this._input.length;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
Scanner._regexFlags = ( (new Set( (['i', 'g', 's', 'm', 'y', 'u'].map(ch => ch.charCodeAt(0))))));
|
|
352
|
+
Scanner._keywords = ( (new Map([
|
|
353
|
+
['not', 14 ],
|
|
354
|
+
['in', 13 ],
|
|
355
|
+
['false', 12 ],
|
|
356
|
+
['true', 11 ],
|
|
357
|
+
])));
|
|
358
|
+
const CONSTANT_VALUES = ( (new Map()));
|
|
359
|
+
CONSTANT_VALUES.set('false', false);
|
|
360
|
+
CONSTANT_VALUES.set('true', true);
|
|
361
|
+
CONSTANT_VALUES.set('isMac', isMacintosh);
|
|
362
|
+
CONSTANT_VALUES.set('isLinux', isLinux);
|
|
363
|
+
CONSTANT_VALUES.set('isWindows', isWindows);
|
|
364
|
+
CONSTANT_VALUES.set('isWeb', isWeb);
|
|
365
|
+
CONSTANT_VALUES.set('isMacNative', isMacintosh && !isWeb);
|
|
366
|
+
CONSTANT_VALUES.set('isEdge', isEdge);
|
|
367
|
+
CONSTANT_VALUES.set('isFirefox', isFirefox);
|
|
368
|
+
CONSTANT_VALUES.set('isChrome', isChrome);
|
|
369
|
+
CONSTANT_VALUES.set('isSafari', isSafari);
|
|
370
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
371
|
+
var ContextKeyExprType;
|
|
372
|
+
( ((function(ContextKeyExprType) {
|
|
373
|
+
ContextKeyExprType[ContextKeyExprType["False"] = 0] = "False";
|
|
374
|
+
ContextKeyExprType[ContextKeyExprType["True"] = 1] = "True";
|
|
375
|
+
ContextKeyExprType[ContextKeyExprType["Defined"] = 2] = "Defined";
|
|
376
|
+
ContextKeyExprType[ContextKeyExprType["Not"] = 3] = "Not";
|
|
377
|
+
ContextKeyExprType[ContextKeyExprType["Equals"] = 4] = "Equals";
|
|
378
|
+
ContextKeyExprType[ContextKeyExprType["NotEquals"] = 5] = "NotEquals";
|
|
379
|
+
ContextKeyExprType[ContextKeyExprType["And"] = 6] = "And";
|
|
380
|
+
ContextKeyExprType[ContextKeyExprType["Regex"] = 7] = "Regex";
|
|
381
|
+
ContextKeyExprType[ContextKeyExprType["NotRegex"] = 8] = "NotRegex";
|
|
382
|
+
ContextKeyExprType[ContextKeyExprType["Or"] = 9] = "Or";
|
|
383
|
+
ContextKeyExprType[ContextKeyExprType["In"] = 10] = "In";
|
|
384
|
+
ContextKeyExprType[ContextKeyExprType["NotIn"] = 11] = "NotIn";
|
|
385
|
+
ContextKeyExprType[ContextKeyExprType["Greater"] = 12] = "Greater";
|
|
386
|
+
ContextKeyExprType[ContextKeyExprType["GreaterEquals"] = 13] = "GreaterEquals";
|
|
387
|
+
ContextKeyExprType[ContextKeyExprType["Smaller"] = 14] = "Smaller";
|
|
388
|
+
ContextKeyExprType[ContextKeyExprType["SmallerEquals"] = 15] = "SmallerEquals";
|
|
389
|
+
})(ContextKeyExprType || (ContextKeyExprType = {}))));
|
|
390
|
+
class ContextKeyExpr {
|
|
391
|
+
static false() {
|
|
392
|
+
return ContextKeyFalseExpr.INSTANCE;
|
|
393
|
+
}
|
|
394
|
+
static true() {
|
|
395
|
+
return ContextKeyTrueExpr.INSTANCE;
|
|
396
|
+
}
|
|
397
|
+
static has(key) {
|
|
398
|
+
return (
|
|
399
|
+
(ContextKeyDefinedExpr.create(key))
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
static equals(key, value) {
|
|
403
|
+
return ContextKeyEqualsExpr.create(key, value);
|
|
404
|
+
}
|
|
405
|
+
static notEquals(key, value) {
|
|
406
|
+
return ContextKeyNotEqualsExpr.create(key, value);
|
|
407
|
+
}
|
|
408
|
+
static regex(key, value) {
|
|
409
|
+
return ContextKeyRegexExpr.create(key, value);
|
|
410
|
+
}
|
|
411
|
+
static in(key, value) {
|
|
412
|
+
return ContextKeyInExpr.create(key, value);
|
|
413
|
+
}
|
|
414
|
+
static notIn(key, value) {
|
|
415
|
+
return ContextKeyNotInExpr.create(key, value);
|
|
416
|
+
}
|
|
417
|
+
static not(key) {
|
|
418
|
+
return (
|
|
419
|
+
(ContextKeyNotExpr.create(key))
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
static and(...expr) {
|
|
423
|
+
return ContextKeyAndExpr.create(expr, null, true);
|
|
424
|
+
}
|
|
425
|
+
static or(...expr) {
|
|
426
|
+
return ContextKeyOrExpr.create(expr, null, true);
|
|
427
|
+
}
|
|
428
|
+
static greater(key, value) {
|
|
429
|
+
return ContextKeyGreaterExpr.create(key, value);
|
|
430
|
+
}
|
|
431
|
+
static greaterEquals(key, value) {
|
|
432
|
+
return ContextKeyGreaterEqualsExpr.create(key, value);
|
|
433
|
+
}
|
|
434
|
+
static smaller(key, value) {
|
|
435
|
+
return ContextKeySmallerExpr.create(key, value);
|
|
436
|
+
}
|
|
437
|
+
static smallerEquals(key, value) {
|
|
438
|
+
return ContextKeySmallerEqualsExpr.create(key, value);
|
|
439
|
+
}
|
|
440
|
+
static deserializeOrErrorNew(serialized) {
|
|
441
|
+
if (!serialized) {
|
|
442
|
+
return { type: 'error', lexingErrors: [], parsingErrors: [] };
|
|
443
|
+
}
|
|
444
|
+
const parser = ( (new Parser()));
|
|
445
|
+
const expr = parser.parse(serialized);
|
|
446
|
+
if (expr === undefined) {
|
|
447
|
+
return { type: 'error', lexingErrors: ( (parser.lexingErrors.map(token => Scanner.reportError(token)))), parsingErrors: parser.parsingErrors };
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
return { type: 'ok', expr };
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
static deserialize(serialized) {
|
|
454
|
+
if (!serialized) {
|
|
455
|
+
return undefined;
|
|
456
|
+
}
|
|
457
|
+
return this._deserializeOrExpression(serialized);
|
|
458
|
+
}
|
|
459
|
+
static _deserializeOrExpression(serialized) {
|
|
460
|
+
const pieces = serialized.split('||');
|
|
461
|
+
return ContextKeyOrExpr.create(( (pieces.map(p => this._deserializeAndExpression(p)))), null, true);
|
|
462
|
+
}
|
|
463
|
+
static _deserializeAndExpression(serialized) {
|
|
464
|
+
const pieces = serialized.split('&&');
|
|
465
|
+
return ContextKeyAndExpr.create(( (pieces.map(p => this._deserializeOne(p)))), null, true);
|
|
466
|
+
}
|
|
467
|
+
static _deserializeOne(serializedOne) {
|
|
468
|
+
serializedOne = serializedOne.trim();
|
|
469
|
+
if (serializedOne.indexOf('!=') >= 0) {
|
|
470
|
+
const pieces = serializedOne.split('!=');
|
|
471
|
+
return ContextKeyNotEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
|
|
472
|
+
}
|
|
473
|
+
if (serializedOne.indexOf('==') >= 0) {
|
|
474
|
+
const pieces = serializedOne.split('==');
|
|
475
|
+
return ContextKeyEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
|
|
476
|
+
}
|
|
477
|
+
if (serializedOne.indexOf('=~') >= 0) {
|
|
478
|
+
const pieces = serializedOne.split('=~');
|
|
479
|
+
return ContextKeyRegexExpr.create(pieces[0].trim(), this._deserializeRegexValue(pieces[1]));
|
|
480
|
+
}
|
|
481
|
+
if (serializedOne.indexOf(' not in ') >= 0) {
|
|
482
|
+
const pieces = serializedOne.split(' not in ');
|
|
483
|
+
return ContextKeyNotInExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
|
|
484
|
+
}
|
|
485
|
+
if (serializedOne.indexOf(' in ') >= 0) {
|
|
486
|
+
const pieces = serializedOne.split(' in ');
|
|
487
|
+
return ContextKeyInExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
|
|
488
|
+
}
|
|
489
|
+
if (/^[^<=>]+>=[^<=>]+$/.test(serializedOne)) {
|
|
490
|
+
const pieces = serializedOne.split('>=');
|
|
491
|
+
return ContextKeyGreaterEqualsExpr.create(pieces[0].trim(), pieces[1].trim());
|
|
492
|
+
}
|
|
493
|
+
if (/^[^<=>]+>[^<=>]+$/.test(serializedOne)) {
|
|
494
|
+
const pieces = serializedOne.split('>');
|
|
495
|
+
return ContextKeyGreaterExpr.create(pieces[0].trim(), pieces[1].trim());
|
|
496
|
+
}
|
|
497
|
+
if (/^[^<=>]+<=[^<=>]+$/.test(serializedOne)) {
|
|
498
|
+
const pieces = serializedOne.split('<=');
|
|
499
|
+
return ContextKeySmallerEqualsExpr.create(pieces[0].trim(), pieces[1].trim());
|
|
500
|
+
}
|
|
501
|
+
if (/^[^<=>]+<[^<=>]+$/.test(serializedOne)) {
|
|
502
|
+
const pieces = serializedOne.split('<');
|
|
503
|
+
return ContextKeySmallerExpr.create(pieces[0].trim(), pieces[1].trim());
|
|
504
|
+
}
|
|
505
|
+
if (/^\!\s*/.test(serializedOne)) {
|
|
506
|
+
return (
|
|
507
|
+
(ContextKeyNotExpr.create(serializedOne.substr(1).trim()))
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
return (
|
|
511
|
+
(ContextKeyDefinedExpr.create(serializedOne))
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
static _deserializeValue(serializedValue) {
|
|
515
|
+
serializedValue = serializedValue.trim();
|
|
516
|
+
if (serializedValue === 'true') {
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
if (serializedValue === 'false') {
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
const m = /^'([^']*)'$/.exec(serializedValue);
|
|
523
|
+
if (m) {
|
|
524
|
+
return m[1].trim();
|
|
525
|
+
}
|
|
526
|
+
return serializedValue;
|
|
527
|
+
}
|
|
528
|
+
static _deserializeRegexValue(serializedValue) {
|
|
529
|
+
if (isFalsyOrWhitespace(serializedValue)) {
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
const start = serializedValue.indexOf('/');
|
|
533
|
+
const end = serializedValue.lastIndexOf('/');
|
|
534
|
+
if (start === end || start < 0) {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
const value = serializedValue.slice(start + 1, end);
|
|
538
|
+
const caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';
|
|
539
|
+
try {
|
|
540
|
+
return (
|
|
541
|
+
(new RegExp(value, caseIgnoreFlag))
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
catch (_e) {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
class ParseError extends Error {
|
|
550
|
+
}
|
|
551
|
+
class Parser {
|
|
552
|
+
constructor() {
|
|
553
|
+
this._scanner = ( (new Scanner()));
|
|
554
|
+
this._tokens = [];
|
|
555
|
+
this._current = 0;
|
|
556
|
+
this._parsingErrors = [];
|
|
557
|
+
}
|
|
558
|
+
get lexingErrors() {
|
|
559
|
+
return this._scanner.errorTokens;
|
|
560
|
+
}
|
|
561
|
+
get parsingErrors() {
|
|
562
|
+
return this._parsingErrors;
|
|
563
|
+
}
|
|
564
|
+
parse(input) {
|
|
565
|
+
if (input === '') {
|
|
566
|
+
this._parsingErrors.push('Expected an expression but got an empty string');
|
|
567
|
+
return undefined;
|
|
568
|
+
}
|
|
569
|
+
this._tokens = this._scanner.reset(input).scan();
|
|
570
|
+
this._current = 0;
|
|
571
|
+
this._parsingErrors = [];
|
|
572
|
+
try {
|
|
573
|
+
const expr = this._expr();
|
|
574
|
+
if (!this._isAtEnd()) {
|
|
575
|
+
throw this._errUnexpected(this._peek());
|
|
576
|
+
}
|
|
577
|
+
return expr;
|
|
578
|
+
}
|
|
579
|
+
catch (e) {
|
|
580
|
+
if (!(e instanceof ParseError)) {
|
|
581
|
+
const token = this._peek();
|
|
582
|
+
this._parsingErrors.push(`Unexpected error: ${e} for token ${Scanner.getLexeme(token)} at offset ${token.offset}.`);
|
|
583
|
+
}
|
|
584
|
+
return undefined;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
_expr() {
|
|
588
|
+
return this._or();
|
|
589
|
+
}
|
|
590
|
+
_or() {
|
|
591
|
+
const expr = [this._and()];
|
|
592
|
+
while (this._matchOne(16 )) {
|
|
593
|
+
const right = this._and();
|
|
594
|
+
expr.push(right);
|
|
595
|
+
}
|
|
596
|
+
return expr.length === 1 ? expr[0] : ( (ContextKeyExpr.or(...expr)));
|
|
597
|
+
}
|
|
598
|
+
_and() {
|
|
599
|
+
const expr = [this._term()];
|
|
600
|
+
while (this._matchOne(15 )) {
|
|
601
|
+
const right = this._term();
|
|
602
|
+
expr.push(right);
|
|
603
|
+
}
|
|
604
|
+
return expr.length === 1 ? expr[0] : ( (ContextKeyExpr.and(...expr)));
|
|
605
|
+
}
|
|
606
|
+
_term() {
|
|
607
|
+
if (this._matchOne(2 )) {
|
|
608
|
+
const expr = this._peek();
|
|
609
|
+
switch (expr.type) {
|
|
610
|
+
case 17 :
|
|
611
|
+
this._advance();
|
|
612
|
+
return ContextKeyExpr.not(expr.lexeme);
|
|
613
|
+
case 11 :
|
|
614
|
+
this._advance();
|
|
615
|
+
return ContextKeyExpr.false();
|
|
616
|
+
case 12 :
|
|
617
|
+
this._advance();
|
|
618
|
+
return ContextKeyExpr.true();
|
|
619
|
+
default:
|
|
620
|
+
throw this._errExpectedButGot(`KEY, 'true', or 'false'`, expr);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return this._primary();
|
|
624
|
+
}
|
|
625
|
+
_primary() {
|
|
626
|
+
const peek = this._peek();
|
|
627
|
+
switch (peek.type) {
|
|
628
|
+
case 11 :
|
|
629
|
+
this._advance();
|
|
630
|
+
return ContextKeyExpr.true();
|
|
631
|
+
case 12 :
|
|
632
|
+
this._advance();
|
|
633
|
+
return ContextKeyExpr.false();
|
|
634
|
+
case 0 : {
|
|
635
|
+
this._advance();
|
|
636
|
+
const expr = this._expr();
|
|
637
|
+
this._consume(1 , `')'`);
|
|
638
|
+
return expr;
|
|
639
|
+
}
|
|
640
|
+
case 17 : {
|
|
641
|
+
const key = peek.lexeme;
|
|
642
|
+
this._advance();
|
|
643
|
+
if (this._matchOne(9 )) {
|
|
644
|
+
const expr = this._peek();
|
|
645
|
+
switch (expr.type) {
|
|
646
|
+
case 10 :
|
|
647
|
+
case 19 : {
|
|
648
|
+
const lexemeReconstruction = [expr.lexeme];
|
|
649
|
+
this._advance();
|
|
650
|
+
let followingToken = this._peek();
|
|
651
|
+
let parenBalance = 0;
|
|
652
|
+
for (let i = 0; i < expr.lexeme.length; i++) {
|
|
653
|
+
if (expr.lexeme.charCodeAt(i) === 40 ) {
|
|
654
|
+
parenBalance++;
|
|
655
|
+
}
|
|
656
|
+
else if (expr.lexeme.charCodeAt(i) === 41 ) {
|
|
657
|
+
parenBalance--;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
while (!this._isAtEnd() && followingToken.type !== 15 && followingToken.type !== 16 ) {
|
|
661
|
+
switch (followingToken.type) {
|
|
662
|
+
case 0 :
|
|
663
|
+
parenBalance++;
|
|
664
|
+
break;
|
|
665
|
+
case 1 :
|
|
666
|
+
parenBalance--;
|
|
667
|
+
break;
|
|
668
|
+
case 10 :
|
|
669
|
+
case 18 :
|
|
670
|
+
for (let i = 0; i < followingToken.lexeme.length; i++) {
|
|
671
|
+
if (followingToken.lexeme.charCodeAt(i) === 40 ) {
|
|
672
|
+
parenBalance++;
|
|
673
|
+
}
|
|
674
|
+
else if (expr.lexeme.charCodeAt(i) === 41 ) {
|
|
675
|
+
parenBalance--;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (parenBalance < 0) {
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
lexemeReconstruction.push(Scanner.getLexeme(followingToken));
|
|
683
|
+
this._advance();
|
|
684
|
+
followingToken = this._peek();
|
|
685
|
+
}
|
|
686
|
+
const regexLexeme = lexemeReconstruction.join('');
|
|
687
|
+
const closingSlashIndex = regexLexeme.lastIndexOf('/');
|
|
688
|
+
const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : regexLexeme.substring(closingSlashIndex + 1);
|
|
689
|
+
const regexp = ( (new RegExp(regexLexeme.substring(1, closingSlashIndex), flags)));
|
|
690
|
+
return ContextKeyExpr.regex(key, regexp);
|
|
691
|
+
}
|
|
692
|
+
case 18 : {
|
|
693
|
+
const serializedValue = expr.lexeme;
|
|
694
|
+
this._advance();
|
|
695
|
+
let regex = null;
|
|
696
|
+
if (!isFalsyOrWhitespace(serializedValue)) {
|
|
697
|
+
const start = serializedValue.indexOf('/');
|
|
698
|
+
const end = serializedValue.lastIndexOf('/');
|
|
699
|
+
if (start !== end && start >= 0) {
|
|
700
|
+
const value = serializedValue.slice(start + 1, end);
|
|
701
|
+
const caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';
|
|
702
|
+
try {
|
|
703
|
+
regex = ( (new RegExp(value, caseIgnoreFlag)));
|
|
704
|
+
}
|
|
705
|
+
catch (_e) { }
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
if (regex === null) {
|
|
709
|
+
throw this._errExpectedButGot('REGEX', expr);
|
|
710
|
+
}
|
|
711
|
+
return ContextKeyRegexExpr.create(key, regex);
|
|
712
|
+
}
|
|
713
|
+
default:
|
|
714
|
+
throw this._errExpectedButGot('REGEX', this._peek());
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (this._matchOne(14 )) {
|
|
718
|
+
this._consume(13 , `'in' after 'not'`);
|
|
719
|
+
const right = this._value();
|
|
720
|
+
return ContextKeyExpr.notIn(key, right);
|
|
721
|
+
}
|
|
722
|
+
const maybeOp = this._peek().type;
|
|
723
|
+
switch (maybeOp) {
|
|
724
|
+
case 3 : {
|
|
725
|
+
this._advance();
|
|
726
|
+
const right = this._value();
|
|
727
|
+
switch (right) {
|
|
728
|
+
case 'true':
|
|
729
|
+
return ContextKeyExpr.has(key);
|
|
730
|
+
case 'false':
|
|
731
|
+
return ContextKeyExpr.not(key);
|
|
732
|
+
default:
|
|
733
|
+
return ContextKeyExpr.equals(key, right);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
case 4 : {
|
|
737
|
+
this._advance();
|
|
738
|
+
const right = this._value();
|
|
739
|
+
switch (right) {
|
|
740
|
+
case 'true':
|
|
741
|
+
return ContextKeyExpr.not(key);
|
|
742
|
+
case 'false':
|
|
743
|
+
return ContextKeyExpr.has(key);
|
|
744
|
+
default:
|
|
745
|
+
return (
|
|
746
|
+
(ContextKeyExpr.notEquals(key, right))
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
case 5 :
|
|
751
|
+
this._advance();
|
|
752
|
+
return ContextKeySmallerExpr.create(key, this._value());
|
|
753
|
+
case 6 :
|
|
754
|
+
this._advance();
|
|
755
|
+
return ContextKeySmallerEqualsExpr.create(key, this._value());
|
|
756
|
+
case 7 :
|
|
757
|
+
this._advance();
|
|
758
|
+
return ContextKeyGreaterExpr.create(key, this._value());
|
|
759
|
+
case 8 :
|
|
760
|
+
this._advance();
|
|
761
|
+
return ContextKeyGreaterEqualsExpr.create(key, this._value());
|
|
762
|
+
case 13 :
|
|
763
|
+
this._advance();
|
|
764
|
+
return ContextKeyExpr.in(key, this._value());
|
|
765
|
+
default:
|
|
766
|
+
return ContextKeyExpr.has(key);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
default:
|
|
770
|
+
throw this._errExpectedButGot(`'true', 'false', '(', KEY, KEY '=~' regex, KEY [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value ]`, this._peek());
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
_value() {
|
|
774
|
+
const token = this._peek();
|
|
775
|
+
switch (token.type) {
|
|
776
|
+
case 17 :
|
|
777
|
+
case 18 :
|
|
778
|
+
this._advance();
|
|
779
|
+
return token.lexeme;
|
|
780
|
+
case 11 :
|
|
781
|
+
this._advance();
|
|
782
|
+
return 'true';
|
|
783
|
+
case 12 :
|
|
784
|
+
this._advance();
|
|
785
|
+
return 'false';
|
|
786
|
+
case 13 :
|
|
787
|
+
this._advance();
|
|
788
|
+
return 'in';
|
|
789
|
+
default:
|
|
790
|
+
return '';
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
_previous() {
|
|
794
|
+
return this._tokens[this._current - 1];
|
|
795
|
+
}
|
|
796
|
+
_matchOne(token) {
|
|
797
|
+
if (this._check(token)) {
|
|
798
|
+
this._advance();
|
|
799
|
+
return true;
|
|
800
|
+
}
|
|
801
|
+
return false;
|
|
802
|
+
}
|
|
803
|
+
_advance() {
|
|
804
|
+
if (!this._isAtEnd()) {
|
|
805
|
+
this._current++;
|
|
806
|
+
}
|
|
807
|
+
return this._previous();
|
|
808
|
+
}
|
|
809
|
+
_consume(type, message) {
|
|
810
|
+
if (this._check(type)) {
|
|
811
|
+
return this._advance();
|
|
812
|
+
}
|
|
813
|
+
throw this._errExpectedButGot(message, this._peek());
|
|
814
|
+
}
|
|
815
|
+
_errExpectedButGot(expected, got) {
|
|
816
|
+
return this._error(`Expected ${expected} but got '${Scanner.getLexeme(got)}' at offset ${got.offset}.`);
|
|
817
|
+
}
|
|
818
|
+
_errUnexpected(token) {
|
|
819
|
+
return this._error(`Unexpected '${Scanner.getLexeme(token)}' at offset ${token.offset}.`);
|
|
820
|
+
}
|
|
821
|
+
_error(errMsg) {
|
|
822
|
+
this._parsingErrors.push(errMsg);
|
|
823
|
+
return (
|
|
824
|
+
(new ParseError())
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
_check(type) {
|
|
828
|
+
return this._peek().type === type;
|
|
829
|
+
}
|
|
830
|
+
_peek() {
|
|
831
|
+
return this._tokens[this._current];
|
|
832
|
+
}
|
|
833
|
+
_isAtEnd() {
|
|
834
|
+
return this._peek().type === 20 ;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
function cmp(a, b) {
|
|
838
|
+
return a.cmp(b);
|
|
839
|
+
}
|
|
840
|
+
class ContextKeyFalseExpr {
|
|
841
|
+
constructor() {
|
|
842
|
+
this.type = 0 ;
|
|
843
|
+
}
|
|
844
|
+
cmp(other) {
|
|
845
|
+
return this.type - other.type;
|
|
846
|
+
}
|
|
847
|
+
equals(other) {
|
|
848
|
+
return (other.type === this.type);
|
|
849
|
+
}
|
|
850
|
+
substituteConstants() {
|
|
851
|
+
return this;
|
|
852
|
+
}
|
|
853
|
+
evaluate(context) {
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
serialize() {
|
|
857
|
+
return 'false';
|
|
858
|
+
}
|
|
859
|
+
keys() {
|
|
860
|
+
return [];
|
|
861
|
+
}
|
|
862
|
+
map(mapFnc) {
|
|
863
|
+
return this;
|
|
864
|
+
}
|
|
865
|
+
negate() {
|
|
866
|
+
return ContextKeyTrueExpr.INSTANCE;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
ContextKeyFalseExpr.INSTANCE = ( (new ContextKeyFalseExpr()));
|
|
870
|
+
class ContextKeyTrueExpr {
|
|
871
|
+
constructor() {
|
|
872
|
+
this.type = 1 ;
|
|
873
|
+
}
|
|
874
|
+
cmp(other) {
|
|
875
|
+
return this.type - other.type;
|
|
876
|
+
}
|
|
877
|
+
equals(other) {
|
|
878
|
+
return (other.type === this.type);
|
|
879
|
+
}
|
|
880
|
+
substituteConstants() {
|
|
881
|
+
return this;
|
|
882
|
+
}
|
|
883
|
+
evaluate(context) {
|
|
884
|
+
return true;
|
|
885
|
+
}
|
|
886
|
+
serialize() {
|
|
887
|
+
return 'true';
|
|
888
|
+
}
|
|
889
|
+
keys() {
|
|
890
|
+
return [];
|
|
891
|
+
}
|
|
892
|
+
map(mapFnc) {
|
|
893
|
+
return this;
|
|
894
|
+
}
|
|
895
|
+
negate() {
|
|
896
|
+
return ContextKeyFalseExpr.INSTANCE;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
ContextKeyTrueExpr.INSTANCE = ( (new ContextKeyTrueExpr()));
|
|
900
|
+
class ContextKeyDefinedExpr {
|
|
901
|
+
static create(key, negated = null) {
|
|
902
|
+
const constantValue = CONSTANT_VALUES.get(key);
|
|
903
|
+
if (typeof constantValue === 'boolean') {
|
|
904
|
+
return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
|
|
905
|
+
}
|
|
906
|
+
return (
|
|
907
|
+
(new ContextKeyDefinedExpr(key, negated))
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
constructor(key, negated) {
|
|
911
|
+
this.key = key;
|
|
912
|
+
this.negated = negated;
|
|
913
|
+
this.type = 2 ;
|
|
914
|
+
}
|
|
915
|
+
cmp(other) {
|
|
916
|
+
if (other.type !== this.type) {
|
|
917
|
+
return this.type - other.type;
|
|
918
|
+
}
|
|
919
|
+
return cmp1(this.key, other.key);
|
|
920
|
+
}
|
|
921
|
+
equals(other) {
|
|
922
|
+
if (other.type === this.type) {
|
|
923
|
+
return (this.key === other.key);
|
|
924
|
+
}
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
substituteConstants() {
|
|
928
|
+
const constantValue = CONSTANT_VALUES.get(this.key);
|
|
929
|
+
if (typeof constantValue === 'boolean') {
|
|
930
|
+
return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
|
|
931
|
+
}
|
|
932
|
+
return this;
|
|
933
|
+
}
|
|
934
|
+
evaluate(context) {
|
|
935
|
+
return (!!context.getValue(this.key));
|
|
936
|
+
}
|
|
937
|
+
serialize() {
|
|
938
|
+
return this.key;
|
|
939
|
+
}
|
|
940
|
+
keys() {
|
|
941
|
+
return [this.key];
|
|
942
|
+
}
|
|
943
|
+
map(mapFnc) {
|
|
944
|
+
return mapFnc.mapDefined(this.key);
|
|
945
|
+
}
|
|
946
|
+
negate() {
|
|
947
|
+
if (!this.negated) {
|
|
948
|
+
this.negated = ( (ContextKeyNotExpr.create(this.key, this)));
|
|
949
|
+
}
|
|
950
|
+
return this.negated;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
class ContextKeyEqualsExpr {
|
|
954
|
+
static create(key, value, negated = null) {
|
|
955
|
+
if (typeof value === 'boolean') {
|
|
956
|
+
return (value ? (ContextKeyDefinedExpr.create(key, negated)) : (ContextKeyNotExpr.create(key, negated)));
|
|
957
|
+
}
|
|
958
|
+
const constantValue = CONSTANT_VALUES.get(key);
|
|
959
|
+
if (typeof constantValue === 'boolean') {
|
|
960
|
+
const trueValue = constantValue ? 'true' : 'false';
|
|
961
|
+
return (value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);
|
|
962
|
+
}
|
|
963
|
+
return (
|
|
964
|
+
(new ContextKeyEqualsExpr(key, value, negated))
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
constructor(key, value, negated) {
|
|
968
|
+
this.key = key;
|
|
969
|
+
this.value = value;
|
|
970
|
+
this.negated = negated;
|
|
971
|
+
this.type = 4 ;
|
|
972
|
+
}
|
|
973
|
+
cmp(other) {
|
|
974
|
+
if (other.type !== this.type) {
|
|
975
|
+
return this.type - other.type;
|
|
976
|
+
}
|
|
977
|
+
return cmp2(this.key, this.value, other.key, other.value);
|
|
978
|
+
}
|
|
979
|
+
equals(other) {
|
|
980
|
+
if (other.type === this.type) {
|
|
981
|
+
return (this.key === other.key && this.value === other.value);
|
|
982
|
+
}
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
substituteConstants() {
|
|
986
|
+
const constantValue = CONSTANT_VALUES.get(this.key);
|
|
987
|
+
if (typeof constantValue === 'boolean') {
|
|
988
|
+
const trueValue = constantValue ? 'true' : 'false';
|
|
989
|
+
return (this.value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);
|
|
990
|
+
}
|
|
991
|
+
return this;
|
|
992
|
+
}
|
|
993
|
+
evaluate(context) {
|
|
994
|
+
return (context.getValue(this.key) == this.value);
|
|
995
|
+
}
|
|
996
|
+
serialize() {
|
|
997
|
+
return `${this.key} == '${this.value}'`;
|
|
998
|
+
}
|
|
999
|
+
keys() {
|
|
1000
|
+
return [this.key];
|
|
1001
|
+
}
|
|
1002
|
+
map(mapFnc) {
|
|
1003
|
+
return mapFnc.mapEquals(this.key, this.value);
|
|
1004
|
+
}
|
|
1005
|
+
negate() {
|
|
1006
|
+
if (!this.negated) {
|
|
1007
|
+
this.negated = ContextKeyNotEqualsExpr.create(this.key, this.value, this);
|
|
1008
|
+
}
|
|
1009
|
+
return this.negated;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
class ContextKeyInExpr {
|
|
1013
|
+
static create(key, valueKey) {
|
|
1014
|
+
return (
|
|
1015
|
+
(new ContextKeyInExpr(key, valueKey))
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
constructor(key, valueKey) {
|
|
1019
|
+
this.key = key;
|
|
1020
|
+
this.valueKey = valueKey;
|
|
1021
|
+
this.type = 10 ;
|
|
1022
|
+
this.negated = null;
|
|
1023
|
+
}
|
|
1024
|
+
cmp(other) {
|
|
1025
|
+
if (other.type !== this.type) {
|
|
1026
|
+
return this.type - other.type;
|
|
1027
|
+
}
|
|
1028
|
+
return cmp2(this.key, this.valueKey, other.key, other.valueKey);
|
|
1029
|
+
}
|
|
1030
|
+
equals(other) {
|
|
1031
|
+
if (other.type === this.type) {
|
|
1032
|
+
return (this.key === other.key && this.valueKey === other.valueKey);
|
|
1033
|
+
}
|
|
1034
|
+
return false;
|
|
1035
|
+
}
|
|
1036
|
+
substituteConstants() {
|
|
1037
|
+
return this;
|
|
1038
|
+
}
|
|
1039
|
+
evaluate(context) {
|
|
1040
|
+
const source = context.getValue(this.valueKey);
|
|
1041
|
+
const item = context.getValue(this.key);
|
|
1042
|
+
if (Array.isArray(source)) {
|
|
1043
|
+
return source.includes(item);
|
|
1044
|
+
}
|
|
1045
|
+
if (typeof item === 'string' && typeof source === 'object' && source !== null) {
|
|
1046
|
+
return hasOwnProperty.call(source, item);
|
|
1047
|
+
}
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
serialize() {
|
|
1051
|
+
return `${this.key} in '${this.valueKey}'`;
|
|
1052
|
+
}
|
|
1053
|
+
keys() {
|
|
1054
|
+
return [this.key, this.valueKey];
|
|
1055
|
+
}
|
|
1056
|
+
map(mapFnc) {
|
|
1057
|
+
return mapFnc.mapIn(this.key, this.valueKey);
|
|
1058
|
+
}
|
|
1059
|
+
negate() {
|
|
1060
|
+
if (!this.negated) {
|
|
1061
|
+
this.negated = ContextKeyNotInExpr.create(this.key, this.valueKey);
|
|
1062
|
+
}
|
|
1063
|
+
return this.negated;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
class ContextKeyNotInExpr {
|
|
1067
|
+
static create(key, valueKey) {
|
|
1068
|
+
return (
|
|
1069
|
+
(new ContextKeyNotInExpr(key, valueKey))
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
constructor(key, valueKey) {
|
|
1073
|
+
this.key = key;
|
|
1074
|
+
this.valueKey = valueKey;
|
|
1075
|
+
this.type = 11 ;
|
|
1076
|
+
this._negated = ContextKeyInExpr.create(key, valueKey);
|
|
1077
|
+
}
|
|
1078
|
+
cmp(other) {
|
|
1079
|
+
if (other.type !== this.type) {
|
|
1080
|
+
return this.type - other.type;
|
|
1081
|
+
}
|
|
1082
|
+
return this._negated.cmp(other._negated);
|
|
1083
|
+
}
|
|
1084
|
+
equals(other) {
|
|
1085
|
+
if (other.type === this.type) {
|
|
1086
|
+
return this._negated.equals(other._negated);
|
|
1087
|
+
}
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
1090
|
+
substituteConstants() {
|
|
1091
|
+
return this;
|
|
1092
|
+
}
|
|
1093
|
+
evaluate(context) {
|
|
1094
|
+
return !this._negated.evaluate(context);
|
|
1095
|
+
}
|
|
1096
|
+
serialize() {
|
|
1097
|
+
return `${this.key} not in '${this.valueKey}'`;
|
|
1098
|
+
}
|
|
1099
|
+
keys() {
|
|
1100
|
+
return (
|
|
1101
|
+
(this._negated.keys())
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
map(mapFnc) {
|
|
1105
|
+
return mapFnc.mapNotIn(this.key, this.valueKey);
|
|
1106
|
+
}
|
|
1107
|
+
negate() {
|
|
1108
|
+
return this._negated;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
class ContextKeyNotEqualsExpr {
|
|
1112
|
+
static create(key, value, negated = null) {
|
|
1113
|
+
if (typeof value === 'boolean') {
|
|
1114
|
+
if (value) {
|
|
1115
|
+
return (
|
|
1116
|
+
(ContextKeyNotExpr.create(key, negated))
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1119
|
+
return (
|
|
1120
|
+
(ContextKeyDefinedExpr.create(key, negated))
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
const constantValue = CONSTANT_VALUES.get(key);
|
|
1124
|
+
if (typeof constantValue === 'boolean') {
|
|
1125
|
+
const falseValue = constantValue ? 'true' : 'false';
|
|
1126
|
+
return (value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
|
|
1127
|
+
}
|
|
1128
|
+
return (
|
|
1129
|
+
(new ContextKeyNotEqualsExpr(key, value, negated))
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
constructor(key, value, negated) {
|
|
1133
|
+
this.key = key;
|
|
1134
|
+
this.value = value;
|
|
1135
|
+
this.negated = negated;
|
|
1136
|
+
this.type = 5 ;
|
|
1137
|
+
}
|
|
1138
|
+
cmp(other) {
|
|
1139
|
+
if (other.type !== this.type) {
|
|
1140
|
+
return this.type - other.type;
|
|
1141
|
+
}
|
|
1142
|
+
return cmp2(this.key, this.value, other.key, other.value);
|
|
1143
|
+
}
|
|
1144
|
+
equals(other) {
|
|
1145
|
+
if (other.type === this.type) {
|
|
1146
|
+
return (this.key === other.key && this.value === other.value);
|
|
1147
|
+
}
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
1150
|
+
substituteConstants() {
|
|
1151
|
+
const constantValue = CONSTANT_VALUES.get(this.key);
|
|
1152
|
+
if (typeof constantValue === 'boolean') {
|
|
1153
|
+
const falseValue = constantValue ? 'true' : 'false';
|
|
1154
|
+
return (this.value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
|
|
1155
|
+
}
|
|
1156
|
+
return this;
|
|
1157
|
+
}
|
|
1158
|
+
evaluate(context) {
|
|
1159
|
+
return (context.getValue(this.key) != this.value);
|
|
1160
|
+
}
|
|
1161
|
+
serialize() {
|
|
1162
|
+
return `${this.key} != '${this.value}'`;
|
|
1163
|
+
}
|
|
1164
|
+
keys() {
|
|
1165
|
+
return [this.key];
|
|
1166
|
+
}
|
|
1167
|
+
map(mapFnc) {
|
|
1168
|
+
return mapFnc.mapNotEquals(this.key, this.value);
|
|
1169
|
+
}
|
|
1170
|
+
negate() {
|
|
1171
|
+
if (!this.negated) {
|
|
1172
|
+
this.negated = ContextKeyEqualsExpr.create(this.key, this.value, this);
|
|
1173
|
+
}
|
|
1174
|
+
return this.negated;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
class ContextKeyNotExpr {
|
|
1178
|
+
static create(key, negated = null) {
|
|
1179
|
+
const constantValue = CONSTANT_VALUES.get(key);
|
|
1180
|
+
if (typeof constantValue === 'boolean') {
|
|
1181
|
+
return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
|
|
1182
|
+
}
|
|
1183
|
+
return (
|
|
1184
|
+
(new ContextKeyNotExpr(key, negated))
|
|
1185
|
+
);
|
|
1186
|
+
}
|
|
1187
|
+
constructor(key, negated) {
|
|
1188
|
+
this.key = key;
|
|
1189
|
+
this.negated = negated;
|
|
1190
|
+
this.type = 3 ;
|
|
1191
|
+
}
|
|
1192
|
+
cmp(other) {
|
|
1193
|
+
if (other.type !== this.type) {
|
|
1194
|
+
return this.type - other.type;
|
|
1195
|
+
}
|
|
1196
|
+
return cmp1(this.key, other.key);
|
|
1197
|
+
}
|
|
1198
|
+
equals(other) {
|
|
1199
|
+
if (other.type === this.type) {
|
|
1200
|
+
return (this.key === other.key);
|
|
1201
|
+
}
|
|
1202
|
+
return false;
|
|
1203
|
+
}
|
|
1204
|
+
substituteConstants() {
|
|
1205
|
+
const constantValue = CONSTANT_VALUES.get(this.key);
|
|
1206
|
+
if (typeof constantValue === 'boolean') {
|
|
1207
|
+
return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
|
|
1208
|
+
}
|
|
1209
|
+
return this;
|
|
1210
|
+
}
|
|
1211
|
+
evaluate(context) {
|
|
1212
|
+
return (!context.getValue(this.key));
|
|
1213
|
+
}
|
|
1214
|
+
serialize() {
|
|
1215
|
+
return `!${this.key}`;
|
|
1216
|
+
}
|
|
1217
|
+
keys() {
|
|
1218
|
+
return [this.key];
|
|
1219
|
+
}
|
|
1220
|
+
map(mapFnc) {
|
|
1221
|
+
return mapFnc.mapNot(this.key);
|
|
1222
|
+
}
|
|
1223
|
+
negate() {
|
|
1224
|
+
if (!this.negated) {
|
|
1225
|
+
this.negated = ( (ContextKeyDefinedExpr.create(this.key, this)));
|
|
1226
|
+
}
|
|
1227
|
+
return this.negated;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
function withFloatOrStr(value, callback) {
|
|
1231
|
+
if (typeof value === 'string') {
|
|
1232
|
+
const n = parseFloat(value);
|
|
1233
|
+
if (!isNaN(n)) {
|
|
1234
|
+
value = n;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
1238
|
+
return callback(value);
|
|
1239
|
+
}
|
|
1240
|
+
return ContextKeyFalseExpr.INSTANCE;
|
|
1241
|
+
}
|
|
1242
|
+
class ContextKeyGreaterExpr {
|
|
1243
|
+
static create(key, _value, negated = null) {
|
|
1244
|
+
return withFloatOrStr(_value, (value) => ( (new ContextKeyGreaterExpr(key, value, negated))));
|
|
1245
|
+
}
|
|
1246
|
+
constructor(key, value, negated) {
|
|
1247
|
+
this.key = key;
|
|
1248
|
+
this.value = value;
|
|
1249
|
+
this.negated = negated;
|
|
1250
|
+
this.type = 12 ;
|
|
1251
|
+
}
|
|
1252
|
+
cmp(other) {
|
|
1253
|
+
if (other.type !== this.type) {
|
|
1254
|
+
return this.type - other.type;
|
|
1255
|
+
}
|
|
1256
|
+
return cmp2(this.key, this.value, other.key, other.value);
|
|
1257
|
+
}
|
|
1258
|
+
equals(other) {
|
|
1259
|
+
if (other.type === this.type) {
|
|
1260
|
+
return (this.key === other.key && this.value === other.value);
|
|
1261
|
+
}
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
substituteConstants() {
|
|
1265
|
+
return this;
|
|
1266
|
+
}
|
|
1267
|
+
evaluate(context) {
|
|
1268
|
+
if (typeof this.value === 'string') {
|
|
1269
|
+
return false;
|
|
1270
|
+
}
|
|
1271
|
+
return (parseFloat(context.getValue(this.key)) > this.value);
|
|
1272
|
+
}
|
|
1273
|
+
serialize() {
|
|
1274
|
+
return `${this.key} > ${this.value}`;
|
|
1275
|
+
}
|
|
1276
|
+
keys() {
|
|
1277
|
+
return [this.key];
|
|
1278
|
+
}
|
|
1279
|
+
map(mapFnc) {
|
|
1280
|
+
return mapFnc.mapGreater(this.key, this.value);
|
|
1281
|
+
}
|
|
1282
|
+
negate() {
|
|
1283
|
+
if (!this.negated) {
|
|
1284
|
+
this.negated = ContextKeySmallerEqualsExpr.create(this.key, this.value, this);
|
|
1285
|
+
}
|
|
1286
|
+
return this.negated;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
class ContextKeyGreaterEqualsExpr {
|
|
1290
|
+
static create(key, _value, negated = null) {
|
|
1291
|
+
return withFloatOrStr(_value, (value) => ( (new ContextKeyGreaterEqualsExpr(key, value, negated))));
|
|
1292
|
+
}
|
|
1293
|
+
constructor(key, value, negated) {
|
|
1294
|
+
this.key = key;
|
|
1295
|
+
this.value = value;
|
|
1296
|
+
this.negated = negated;
|
|
1297
|
+
this.type = 13 ;
|
|
1298
|
+
}
|
|
1299
|
+
cmp(other) {
|
|
1300
|
+
if (other.type !== this.type) {
|
|
1301
|
+
return this.type - other.type;
|
|
1302
|
+
}
|
|
1303
|
+
return cmp2(this.key, this.value, other.key, other.value);
|
|
1304
|
+
}
|
|
1305
|
+
equals(other) {
|
|
1306
|
+
if (other.type === this.type) {
|
|
1307
|
+
return (this.key === other.key && this.value === other.value);
|
|
1308
|
+
}
|
|
1309
|
+
return false;
|
|
1310
|
+
}
|
|
1311
|
+
substituteConstants() {
|
|
1312
|
+
return this;
|
|
1313
|
+
}
|
|
1314
|
+
evaluate(context) {
|
|
1315
|
+
if (typeof this.value === 'string') {
|
|
1316
|
+
return false;
|
|
1317
|
+
}
|
|
1318
|
+
return (parseFloat(context.getValue(this.key)) >= this.value);
|
|
1319
|
+
}
|
|
1320
|
+
serialize() {
|
|
1321
|
+
return `${this.key} >= ${this.value}`;
|
|
1322
|
+
}
|
|
1323
|
+
keys() {
|
|
1324
|
+
return [this.key];
|
|
1325
|
+
}
|
|
1326
|
+
map(mapFnc) {
|
|
1327
|
+
return mapFnc.mapGreaterEquals(this.key, this.value);
|
|
1328
|
+
}
|
|
1329
|
+
negate() {
|
|
1330
|
+
if (!this.negated) {
|
|
1331
|
+
this.negated = ContextKeySmallerExpr.create(this.key, this.value, this);
|
|
1332
|
+
}
|
|
1333
|
+
return this.negated;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
class ContextKeySmallerExpr {
|
|
1337
|
+
static create(key, _value, negated = null) {
|
|
1338
|
+
return withFloatOrStr(_value, (value) => ( (new ContextKeySmallerExpr(key, value, negated))));
|
|
1339
|
+
}
|
|
1340
|
+
constructor(key, value, negated) {
|
|
1341
|
+
this.key = key;
|
|
1342
|
+
this.value = value;
|
|
1343
|
+
this.negated = negated;
|
|
1344
|
+
this.type = 14 ;
|
|
1345
|
+
}
|
|
1346
|
+
cmp(other) {
|
|
1347
|
+
if (other.type !== this.type) {
|
|
1348
|
+
return this.type - other.type;
|
|
1349
|
+
}
|
|
1350
|
+
return cmp2(this.key, this.value, other.key, other.value);
|
|
1351
|
+
}
|
|
1352
|
+
equals(other) {
|
|
1353
|
+
if (other.type === this.type) {
|
|
1354
|
+
return (this.key === other.key && this.value === other.value);
|
|
1355
|
+
}
|
|
1356
|
+
return false;
|
|
1357
|
+
}
|
|
1358
|
+
substituteConstants() {
|
|
1359
|
+
return this;
|
|
1360
|
+
}
|
|
1361
|
+
evaluate(context) {
|
|
1362
|
+
if (typeof this.value === 'string') {
|
|
1363
|
+
return false;
|
|
1364
|
+
}
|
|
1365
|
+
return (parseFloat(context.getValue(this.key)) < this.value);
|
|
1366
|
+
}
|
|
1367
|
+
serialize() {
|
|
1368
|
+
return `${this.key} < ${this.value}`;
|
|
1369
|
+
}
|
|
1370
|
+
keys() {
|
|
1371
|
+
return [this.key];
|
|
1372
|
+
}
|
|
1373
|
+
map(mapFnc) {
|
|
1374
|
+
return mapFnc.mapSmaller(this.key, this.value);
|
|
1375
|
+
}
|
|
1376
|
+
negate() {
|
|
1377
|
+
if (!this.negated) {
|
|
1378
|
+
this.negated = ContextKeyGreaterEqualsExpr.create(this.key, this.value, this);
|
|
1379
|
+
}
|
|
1380
|
+
return this.negated;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
class ContextKeySmallerEqualsExpr {
|
|
1384
|
+
static create(key, _value, negated = null) {
|
|
1385
|
+
return withFloatOrStr(_value, (value) => ( (new ContextKeySmallerEqualsExpr(key, value, negated))));
|
|
1386
|
+
}
|
|
1387
|
+
constructor(key, value, negated) {
|
|
1388
|
+
this.key = key;
|
|
1389
|
+
this.value = value;
|
|
1390
|
+
this.negated = negated;
|
|
1391
|
+
this.type = 15 ;
|
|
1392
|
+
}
|
|
1393
|
+
cmp(other) {
|
|
1394
|
+
if (other.type !== this.type) {
|
|
1395
|
+
return this.type - other.type;
|
|
1396
|
+
}
|
|
1397
|
+
return cmp2(this.key, this.value, other.key, other.value);
|
|
1398
|
+
}
|
|
1399
|
+
equals(other) {
|
|
1400
|
+
if (other.type === this.type) {
|
|
1401
|
+
return (this.key === other.key && this.value === other.value);
|
|
1402
|
+
}
|
|
1403
|
+
return false;
|
|
1404
|
+
}
|
|
1405
|
+
substituteConstants() {
|
|
1406
|
+
return this;
|
|
1407
|
+
}
|
|
1408
|
+
evaluate(context) {
|
|
1409
|
+
if (typeof this.value === 'string') {
|
|
1410
|
+
return false;
|
|
1411
|
+
}
|
|
1412
|
+
return (parseFloat(context.getValue(this.key)) <= this.value);
|
|
1413
|
+
}
|
|
1414
|
+
serialize() {
|
|
1415
|
+
return `${this.key} <= ${this.value}`;
|
|
1416
|
+
}
|
|
1417
|
+
keys() {
|
|
1418
|
+
return [this.key];
|
|
1419
|
+
}
|
|
1420
|
+
map(mapFnc) {
|
|
1421
|
+
return mapFnc.mapSmallerEquals(this.key, this.value);
|
|
1422
|
+
}
|
|
1423
|
+
negate() {
|
|
1424
|
+
if (!this.negated) {
|
|
1425
|
+
this.negated = ContextKeyGreaterExpr.create(this.key, this.value, this);
|
|
1426
|
+
}
|
|
1427
|
+
return this.negated;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
class ContextKeyRegexExpr {
|
|
1431
|
+
static create(key, regexp) {
|
|
1432
|
+
return (
|
|
1433
|
+
(new ContextKeyRegexExpr(key, regexp))
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
constructor(key, regexp) {
|
|
1437
|
+
this.key = key;
|
|
1438
|
+
this.regexp = regexp;
|
|
1439
|
+
this.type = 7 ;
|
|
1440
|
+
this.negated = null;
|
|
1441
|
+
}
|
|
1442
|
+
cmp(other) {
|
|
1443
|
+
if (other.type !== this.type) {
|
|
1444
|
+
return this.type - other.type;
|
|
1445
|
+
}
|
|
1446
|
+
if (this.key < other.key) {
|
|
1447
|
+
return -1;
|
|
1448
|
+
}
|
|
1449
|
+
if (this.key > other.key) {
|
|
1450
|
+
return 1;
|
|
1451
|
+
}
|
|
1452
|
+
const thisSource = this.regexp ? this.regexp.source : '';
|
|
1453
|
+
const otherSource = other.regexp ? other.regexp.source : '';
|
|
1454
|
+
if (thisSource < otherSource) {
|
|
1455
|
+
return -1;
|
|
1456
|
+
}
|
|
1457
|
+
if (thisSource > otherSource) {
|
|
1458
|
+
return 1;
|
|
1459
|
+
}
|
|
1460
|
+
return 0;
|
|
1461
|
+
}
|
|
1462
|
+
equals(other) {
|
|
1463
|
+
if (other.type === this.type) {
|
|
1464
|
+
const thisSource = this.regexp ? this.regexp.source : '';
|
|
1465
|
+
const otherSource = other.regexp ? other.regexp.source : '';
|
|
1466
|
+
return (this.key === other.key && thisSource === otherSource);
|
|
1467
|
+
}
|
|
1468
|
+
return false;
|
|
1469
|
+
}
|
|
1470
|
+
substituteConstants() {
|
|
1471
|
+
return this;
|
|
1472
|
+
}
|
|
1473
|
+
evaluate(context) {
|
|
1474
|
+
const value = context.getValue(this.key);
|
|
1475
|
+
return this.regexp ? this.regexp.test(value) : false;
|
|
1476
|
+
}
|
|
1477
|
+
serialize() {
|
|
1478
|
+
const value = this.regexp
|
|
1479
|
+
? `/${this.regexp.source}/${this.regexp.flags}`
|
|
1480
|
+
: '/invalid/';
|
|
1481
|
+
return `${this.key} =~ ${value}`;
|
|
1482
|
+
}
|
|
1483
|
+
keys() {
|
|
1484
|
+
return [this.key];
|
|
1485
|
+
}
|
|
1486
|
+
map(mapFnc) {
|
|
1487
|
+
return mapFnc.mapRegex(this.key, this.regexp);
|
|
1488
|
+
}
|
|
1489
|
+
negate() {
|
|
1490
|
+
if (!this.negated) {
|
|
1491
|
+
this.negated = ContextKeyNotRegexExpr.create(this);
|
|
1492
|
+
}
|
|
1493
|
+
return this.negated;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
class ContextKeyNotRegexExpr {
|
|
1497
|
+
static create(actual) {
|
|
1498
|
+
return (
|
|
1499
|
+
(new ContextKeyNotRegexExpr(actual))
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1502
|
+
constructor(_actual) {
|
|
1503
|
+
this._actual = _actual;
|
|
1504
|
+
this.type = 8 ;
|
|
1505
|
+
}
|
|
1506
|
+
cmp(other) {
|
|
1507
|
+
if (other.type !== this.type) {
|
|
1508
|
+
return this.type - other.type;
|
|
1509
|
+
}
|
|
1510
|
+
return this._actual.cmp(other._actual);
|
|
1511
|
+
}
|
|
1512
|
+
equals(other) {
|
|
1513
|
+
if (other.type === this.type) {
|
|
1514
|
+
return this._actual.equals(other._actual);
|
|
1515
|
+
}
|
|
1516
|
+
return false;
|
|
1517
|
+
}
|
|
1518
|
+
substituteConstants() {
|
|
1519
|
+
return this;
|
|
1520
|
+
}
|
|
1521
|
+
evaluate(context) {
|
|
1522
|
+
return !this._actual.evaluate(context);
|
|
1523
|
+
}
|
|
1524
|
+
serialize() {
|
|
1525
|
+
throw new Error('Method not implemented.');
|
|
1526
|
+
}
|
|
1527
|
+
keys() {
|
|
1528
|
+
return (
|
|
1529
|
+
(this._actual.keys())
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1532
|
+
map(mapFnc) {
|
|
1533
|
+
return (
|
|
1534
|
+
(new ContextKeyNotRegexExpr( (this._actual.map(mapFnc))))
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1537
|
+
negate() {
|
|
1538
|
+
return this._actual;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
function eliminateConstantsInArray(arr) {
|
|
1542
|
+
let newArr = null;
|
|
1543
|
+
for (let i = 0, len = arr.length; i < len; i++) {
|
|
1544
|
+
const newExpr = arr[i].substituteConstants();
|
|
1545
|
+
if (arr[i] !== newExpr) {
|
|
1546
|
+
if (newArr === null) {
|
|
1547
|
+
newArr = [];
|
|
1548
|
+
for (let j = 0; j < i; j++) {
|
|
1549
|
+
newArr[j] = arr[j];
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
if (newArr !== null) {
|
|
1554
|
+
newArr[i] = newExpr;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
if (newArr === null) {
|
|
1558
|
+
return arr;
|
|
1559
|
+
}
|
|
1560
|
+
return newArr;
|
|
1561
|
+
}
|
|
1562
|
+
class ContextKeyAndExpr {
|
|
1563
|
+
static create(_expr, negated, extraRedundantCheck) {
|
|
1564
|
+
return ContextKeyAndExpr._normalizeArr(_expr, negated, extraRedundantCheck);
|
|
1565
|
+
}
|
|
1566
|
+
constructor(expr, negated) {
|
|
1567
|
+
this.expr = expr;
|
|
1568
|
+
this.negated = negated;
|
|
1569
|
+
this.type = 6 ;
|
|
1570
|
+
}
|
|
1571
|
+
cmp(other) {
|
|
1572
|
+
if (other.type !== this.type) {
|
|
1573
|
+
return this.type - other.type;
|
|
1574
|
+
}
|
|
1575
|
+
if (this.expr.length < other.expr.length) {
|
|
1576
|
+
return -1;
|
|
1577
|
+
}
|
|
1578
|
+
if (this.expr.length > other.expr.length) {
|
|
1579
|
+
return 1;
|
|
1580
|
+
}
|
|
1581
|
+
for (let i = 0, len = this.expr.length; i < len; i++) {
|
|
1582
|
+
const r = cmp(this.expr[i], other.expr[i]);
|
|
1583
|
+
if (r !== 0) {
|
|
1584
|
+
return r;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
return 0;
|
|
1588
|
+
}
|
|
1589
|
+
equals(other) {
|
|
1590
|
+
if (other.type === this.type) {
|
|
1591
|
+
if (this.expr.length !== other.expr.length) {
|
|
1592
|
+
return false;
|
|
1593
|
+
}
|
|
1594
|
+
for (let i = 0, len = this.expr.length; i < len; i++) {
|
|
1595
|
+
if (!this.expr[i].equals(other.expr[i])) {
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return true;
|
|
1600
|
+
}
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
substituteConstants() {
|
|
1604
|
+
const exprArr = eliminateConstantsInArray(this.expr);
|
|
1605
|
+
if (exprArr === this.expr) {
|
|
1606
|
+
return this;
|
|
1607
|
+
}
|
|
1608
|
+
return ContextKeyAndExpr.create(exprArr, this.negated, false);
|
|
1609
|
+
}
|
|
1610
|
+
evaluate(context) {
|
|
1611
|
+
for (let i = 0, len = this.expr.length; i < len; i++) {
|
|
1612
|
+
if (!this.expr[i].evaluate(context)) {
|
|
1613
|
+
return false;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
return true;
|
|
1617
|
+
}
|
|
1618
|
+
static _normalizeArr(arr, negated, extraRedundantCheck) {
|
|
1619
|
+
const expr = [];
|
|
1620
|
+
let hasTrue = false;
|
|
1621
|
+
for (const e of arr) {
|
|
1622
|
+
if (!e) {
|
|
1623
|
+
continue;
|
|
1624
|
+
}
|
|
1625
|
+
if (e.type === 1 ) {
|
|
1626
|
+
hasTrue = true;
|
|
1627
|
+
continue;
|
|
1628
|
+
}
|
|
1629
|
+
if (e.type === 0 ) {
|
|
1630
|
+
return ContextKeyFalseExpr.INSTANCE;
|
|
1631
|
+
}
|
|
1632
|
+
if (e.type === 6 ) {
|
|
1633
|
+
expr.push(...e.expr);
|
|
1634
|
+
continue;
|
|
1635
|
+
}
|
|
1636
|
+
expr.push(e);
|
|
1637
|
+
}
|
|
1638
|
+
if (expr.length === 0 && hasTrue) {
|
|
1639
|
+
return ContextKeyTrueExpr.INSTANCE;
|
|
1640
|
+
}
|
|
1641
|
+
if (expr.length === 0) {
|
|
1642
|
+
return undefined;
|
|
1643
|
+
}
|
|
1644
|
+
if (expr.length === 1) {
|
|
1645
|
+
return expr[0];
|
|
1646
|
+
}
|
|
1647
|
+
expr.sort(cmp);
|
|
1648
|
+
for (let i = 1; i < expr.length; i++) {
|
|
1649
|
+
if (expr[i - 1].equals(expr[i])) {
|
|
1650
|
+
expr.splice(i, 1);
|
|
1651
|
+
i--;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
if (expr.length === 1) {
|
|
1655
|
+
return expr[0];
|
|
1656
|
+
}
|
|
1657
|
+
while (expr.length > 1) {
|
|
1658
|
+
const lastElement = expr[expr.length - 1];
|
|
1659
|
+
if (lastElement.type !== 9 ) {
|
|
1660
|
+
break;
|
|
1661
|
+
}
|
|
1662
|
+
expr.pop();
|
|
1663
|
+
const secondToLastElement = expr.pop();
|
|
1664
|
+
const isFinished = (expr.length === 0);
|
|
1665
|
+
const resultElement = ContextKeyOrExpr.create(( (lastElement.expr.map(
|
|
1666
|
+
el => ContextKeyAndExpr.create([el, secondToLastElement], null, extraRedundantCheck)
|
|
1667
|
+
))), null, isFinished);
|
|
1668
|
+
if (resultElement) {
|
|
1669
|
+
expr.push(resultElement);
|
|
1670
|
+
expr.sort(cmp);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
if (expr.length === 1) {
|
|
1674
|
+
return expr[0];
|
|
1675
|
+
}
|
|
1676
|
+
if (extraRedundantCheck) {
|
|
1677
|
+
for (let i = 0; i < expr.length; i++) {
|
|
1678
|
+
for (let j = i + 1; j < expr.length; j++) {
|
|
1679
|
+
if (expr[i].negate().equals(expr[j])) {
|
|
1680
|
+
return ContextKeyFalseExpr.INSTANCE;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
if (expr.length === 1) {
|
|
1685
|
+
return expr[0];
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
return (
|
|
1689
|
+
(new ContextKeyAndExpr(expr, negated))
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
serialize() {
|
|
1693
|
+
return ( (this.expr.map(e => e.serialize()))).join(' && ');
|
|
1694
|
+
}
|
|
1695
|
+
keys() {
|
|
1696
|
+
const result = [];
|
|
1697
|
+
for (const expr of this.expr) {
|
|
1698
|
+
result.push(...( (expr.keys())));
|
|
1699
|
+
}
|
|
1700
|
+
return result;
|
|
1701
|
+
}
|
|
1702
|
+
map(mapFnc) {
|
|
1703
|
+
return (
|
|
1704
|
+
(new ContextKeyAndExpr(
|
|
1705
|
+
(this.expr.map(expr => ( (expr.map(mapFnc))))),
|
|
1706
|
+
null
|
|
1707
|
+
))
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
negate() {
|
|
1711
|
+
if (!this.negated) {
|
|
1712
|
+
const result = [];
|
|
1713
|
+
for (const expr of this.expr) {
|
|
1714
|
+
result.push(expr.negate());
|
|
1715
|
+
}
|
|
1716
|
+
this.negated = ContextKeyOrExpr.create(result, this, true);
|
|
1717
|
+
}
|
|
1718
|
+
return this.negated;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
class ContextKeyOrExpr {
|
|
1722
|
+
static create(_expr, negated, extraRedundantCheck) {
|
|
1723
|
+
return ContextKeyOrExpr._normalizeArr(_expr, negated, extraRedundantCheck);
|
|
1724
|
+
}
|
|
1725
|
+
constructor(expr, negated) {
|
|
1726
|
+
this.expr = expr;
|
|
1727
|
+
this.negated = negated;
|
|
1728
|
+
this.type = 9 ;
|
|
1729
|
+
}
|
|
1730
|
+
cmp(other) {
|
|
1731
|
+
if (other.type !== this.type) {
|
|
1732
|
+
return this.type - other.type;
|
|
1733
|
+
}
|
|
1734
|
+
if (this.expr.length < other.expr.length) {
|
|
1735
|
+
return -1;
|
|
1736
|
+
}
|
|
1737
|
+
if (this.expr.length > other.expr.length) {
|
|
1738
|
+
return 1;
|
|
1739
|
+
}
|
|
1740
|
+
for (let i = 0, len = this.expr.length; i < len; i++) {
|
|
1741
|
+
const r = cmp(this.expr[i], other.expr[i]);
|
|
1742
|
+
if (r !== 0) {
|
|
1743
|
+
return r;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
return 0;
|
|
1747
|
+
}
|
|
1748
|
+
equals(other) {
|
|
1749
|
+
if (other.type === this.type) {
|
|
1750
|
+
if (this.expr.length !== other.expr.length) {
|
|
1751
|
+
return false;
|
|
1752
|
+
}
|
|
1753
|
+
for (let i = 0, len = this.expr.length; i < len; i++) {
|
|
1754
|
+
if (!this.expr[i].equals(other.expr[i])) {
|
|
1755
|
+
return false;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
return true;
|
|
1759
|
+
}
|
|
1760
|
+
return false;
|
|
1761
|
+
}
|
|
1762
|
+
substituteConstants() {
|
|
1763
|
+
const exprArr = eliminateConstantsInArray(this.expr);
|
|
1764
|
+
if (exprArr === this.expr) {
|
|
1765
|
+
return this;
|
|
1766
|
+
}
|
|
1767
|
+
return ContextKeyOrExpr.create(exprArr, this.negated, false);
|
|
1768
|
+
}
|
|
1769
|
+
evaluate(context) {
|
|
1770
|
+
for (let i = 0, len = this.expr.length; i < len; i++) {
|
|
1771
|
+
if (this.expr[i].evaluate(context)) {
|
|
1772
|
+
return true;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
return false;
|
|
1776
|
+
}
|
|
1777
|
+
static _normalizeArr(arr, negated, extraRedundantCheck) {
|
|
1778
|
+
let expr = [];
|
|
1779
|
+
let hasFalse = false;
|
|
1780
|
+
if (arr) {
|
|
1781
|
+
for (let i = 0, len = arr.length; i < len; i++) {
|
|
1782
|
+
const e = arr[i];
|
|
1783
|
+
if (!e) {
|
|
1784
|
+
continue;
|
|
1785
|
+
}
|
|
1786
|
+
if (e.type === 0 ) {
|
|
1787
|
+
hasFalse = true;
|
|
1788
|
+
continue;
|
|
1789
|
+
}
|
|
1790
|
+
if (e.type === 1 ) {
|
|
1791
|
+
return ContextKeyTrueExpr.INSTANCE;
|
|
1792
|
+
}
|
|
1793
|
+
if (e.type === 9 ) {
|
|
1794
|
+
expr = expr.concat(e.expr);
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1797
|
+
expr.push(e);
|
|
1798
|
+
}
|
|
1799
|
+
if (expr.length === 0 && hasFalse) {
|
|
1800
|
+
return ContextKeyFalseExpr.INSTANCE;
|
|
1801
|
+
}
|
|
1802
|
+
expr.sort(cmp);
|
|
1803
|
+
}
|
|
1804
|
+
if (expr.length === 0) {
|
|
1805
|
+
return undefined;
|
|
1806
|
+
}
|
|
1807
|
+
if (expr.length === 1) {
|
|
1808
|
+
return expr[0];
|
|
1809
|
+
}
|
|
1810
|
+
for (let i = 1; i < expr.length; i++) {
|
|
1811
|
+
if (expr[i - 1].equals(expr[i])) {
|
|
1812
|
+
expr.splice(i, 1);
|
|
1813
|
+
i--;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
if (expr.length === 1) {
|
|
1817
|
+
return expr[0];
|
|
1818
|
+
}
|
|
1819
|
+
if (extraRedundantCheck) {
|
|
1820
|
+
for (let i = 0; i < expr.length; i++) {
|
|
1821
|
+
for (let j = i + 1; j < expr.length; j++) {
|
|
1822
|
+
if (expr[i].negate().equals(expr[j])) {
|
|
1823
|
+
return ContextKeyTrueExpr.INSTANCE;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
if (expr.length === 1) {
|
|
1828
|
+
return expr[0];
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return (
|
|
1832
|
+
(new ContextKeyOrExpr(expr, negated))
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1835
|
+
serialize() {
|
|
1836
|
+
return ( (this.expr.map(e => e.serialize()))).join(' || ');
|
|
1837
|
+
}
|
|
1838
|
+
keys() {
|
|
1839
|
+
const result = [];
|
|
1840
|
+
for (const expr of this.expr) {
|
|
1841
|
+
result.push(...( (expr.keys())));
|
|
1842
|
+
}
|
|
1843
|
+
return result;
|
|
1844
|
+
}
|
|
1845
|
+
map(mapFnc) {
|
|
1846
|
+
return (
|
|
1847
|
+
(new ContextKeyOrExpr(
|
|
1848
|
+
(this.expr.map(expr => ( (expr.map(mapFnc))))),
|
|
1849
|
+
null
|
|
1850
|
+
))
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1853
|
+
negate() {
|
|
1854
|
+
if (!this.negated) {
|
|
1855
|
+
const result = [];
|
|
1856
|
+
for (const expr of this.expr) {
|
|
1857
|
+
result.push(expr.negate());
|
|
1858
|
+
}
|
|
1859
|
+
while (result.length > 1) {
|
|
1860
|
+
const LEFT = result.shift();
|
|
1861
|
+
const RIGHT = result.shift();
|
|
1862
|
+
const all = [];
|
|
1863
|
+
for (const left of getTerminals(LEFT)) {
|
|
1864
|
+
for (const right of getTerminals(RIGHT)) {
|
|
1865
|
+
all.push(ContextKeyAndExpr.create([left, right], null, false));
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
result.unshift(ContextKeyOrExpr.create(all, null, false));
|
|
1869
|
+
}
|
|
1870
|
+
this.negated = ContextKeyOrExpr.create(result, this, true);
|
|
1871
|
+
}
|
|
1872
|
+
return this.negated;
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
class RawContextKey extends ContextKeyDefinedExpr {
|
|
1876
|
+
static all() {
|
|
1877
|
+
return (
|
|
1878
|
+
(RawContextKey._info.values())
|
|
1879
|
+
);
|
|
1880
|
+
}
|
|
1881
|
+
constructor(key, defaultValue, metaOrHide) {
|
|
1882
|
+
super(key, null);
|
|
1883
|
+
this._defaultValue = defaultValue;
|
|
1884
|
+
if (typeof metaOrHide === 'object') {
|
|
1885
|
+
RawContextKey._info.push({ ...metaOrHide, key });
|
|
1886
|
+
}
|
|
1887
|
+
else if (metaOrHide !== true) {
|
|
1888
|
+
RawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== undefined ? typeof defaultValue : undefined });
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
bindTo(target) {
|
|
1892
|
+
return target.createKey(this.key, this._defaultValue);
|
|
1893
|
+
}
|
|
1894
|
+
getValue(target) {
|
|
1895
|
+
return target.getContextKeyValue(this.key);
|
|
1896
|
+
}
|
|
1897
|
+
toNegated() {
|
|
1898
|
+
return this.negate();
|
|
1899
|
+
}
|
|
1900
|
+
isEqualTo(value) {
|
|
1901
|
+
return ContextKeyEqualsExpr.create(this.key, value);
|
|
1902
|
+
}
|
|
1903
|
+
notEqualsTo(value) {
|
|
1904
|
+
return ContextKeyNotEqualsExpr.create(this.key, value);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
RawContextKey._info = [];
|
|
1908
|
+
function cmp1(key1, key2) {
|
|
1909
|
+
if (key1 < key2) {
|
|
1910
|
+
return -1;
|
|
1911
|
+
}
|
|
1912
|
+
if (key1 > key2) {
|
|
1913
|
+
return 1;
|
|
1914
|
+
}
|
|
1915
|
+
return 0;
|
|
1916
|
+
}
|
|
1917
|
+
function cmp2(key1, value1, key2, value2) {
|
|
1918
|
+
if (key1 < key2) {
|
|
1919
|
+
return -1;
|
|
1920
|
+
}
|
|
1921
|
+
if (key1 > key2) {
|
|
1922
|
+
return 1;
|
|
1923
|
+
}
|
|
1924
|
+
if (value1 < value2) {
|
|
1925
|
+
return -1;
|
|
1926
|
+
}
|
|
1927
|
+
if (value1 > value2) {
|
|
1928
|
+
return 1;
|
|
1929
|
+
}
|
|
1930
|
+
return 0;
|
|
1931
|
+
}
|
|
1932
|
+
function getTerminals(node) {
|
|
1933
|
+
if (node.type === 9 ) {
|
|
1934
|
+
return node.expr;
|
|
1935
|
+
}
|
|
1936
|
+
return [node];
|
|
1937
|
+
}
|
|
1938
|
+
const mark = (name) => {
|
|
1939
|
+
performance.mark(name);
|
|
1940
|
+
};
|
|
1941
|
+
const getMarks = () => {
|
|
1942
|
+
let timeOrigin = performance.timeOrigin;
|
|
1943
|
+
if (typeof timeOrigin !== 'number') {
|
|
1944
|
+
timeOrigin = performance.timing.navigationStart || performance.timing.redirectStart || performance.timing.fetchStart;
|
|
1945
|
+
}
|
|
1946
|
+
const result = [{ name: 'code/timeOrigin', startTime: Math.round(timeOrigin) }];
|
|
1947
|
+
for (const entry of performance.getEntriesByType('mark')) {
|
|
1948
|
+
result.push({
|
|
1949
|
+
name: entry.name,
|
|
1950
|
+
startTime: Math.round(timeOrigin + entry.startTime)
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
return result;
|
|
1954
|
+
};
|
|
21
1955
|
const IFileService = ( (createDecorator('fileService')));
|
|
22
1956
|
var FileType;
|
|
23
1957
|
( ((function(FileType) {
|
|
@@ -260,6 +2194,17 @@ class NotModifiedSinceFileOperationError extends FileOperationError {
|
|
|
260
2194
|
this.stat = stat;
|
|
261
2195
|
}
|
|
262
2196
|
}
|
|
2197
|
+
const AutoSaveConfiguration = {
|
|
2198
|
+
OFF: 'off',
|
|
2199
|
+
AFTER_DELAY: 'afterDelay',
|
|
2200
|
+
ON_FOCUS_CHANGE: 'onFocusChange',
|
|
2201
|
+
ON_WINDOW_CHANGE: 'onWindowChange'
|
|
2202
|
+
};
|
|
2203
|
+
const HotExitConfiguration = {
|
|
2204
|
+
OFF: 'off',
|
|
2205
|
+
ON_EXIT: 'onExit',
|
|
2206
|
+
ON_EXIT_AND_WINDOW_CLOSE: 'onExitAndWindowClose'
|
|
2207
|
+
};
|
|
263
2208
|
const FILES_ASSOCIATIONS_CONFIG = 'files.associations';
|
|
264
2209
|
const ETAG_DISABLED = '';
|
|
265
2210
|
function etag(stat) {
|
|
@@ -540,9 +2485,9 @@ let UserDataProfilesService = class UserDataProfilesService extends Disposable {
|
|
|
540
2485
|
}
|
|
541
2486
|
if (await this.fileService.exists(this.profilesHome)) {
|
|
542
2487
|
const stat = await this.fileService.resolve(this.profilesHome);
|
|
543
|
-
await Promise.all((stat.children || [])
|
|
2488
|
+
await Promise.all(( ((stat.children || [])
|
|
544
2489
|
.filter(child => child.isDirectory && this.profiles.every(p => !this.uriIdentityService.extUri.isEqual(p.location, child.resource)))
|
|
545
|
-
.map(child => this.fileService.del(child.resource, { recursive: true })));
|
|
2490
|
+
.map(child => this.fileService.del(child.resource, { recursive: true })))));
|
|
546
2491
|
}
|
|
547
2492
|
}
|
|
548
2493
|
async cleanUpTransientProfiles() {
|
|
@@ -550,7 +2495,7 @@ let UserDataProfilesService = class UserDataProfilesService extends Disposable {
|
|
|
550
2495
|
return;
|
|
551
2496
|
}
|
|
552
2497
|
const unAssociatedTransientProfiles = this.transientProfilesObject.profiles.filter(p => !this.isProfileAssociatedToWorkspace(p));
|
|
553
|
-
await Promise.allSettled(unAssociatedTransientProfiles.map(p => this.removeProfile(p)));
|
|
2498
|
+
await Promise.allSettled(( (unAssociatedTransientProfiles.map(p => this.removeProfile(p)))));
|
|
554
2499
|
}
|
|
555
2500
|
getProfileForWorkspace(workspaceIdentifier) {
|
|
556
2501
|
const workspace = this.getWorkspace(workspaceIdentifier);
|
|
@@ -735,10 +2680,12 @@ class AbstractStorageService extends Disposable {
|
|
|
735
2680
|
initialize() {
|
|
736
2681
|
if (!this.initializationPromise) {
|
|
737
2682
|
this.initializationPromise = (async () => {
|
|
2683
|
+
mark('code/willInitStorage');
|
|
738
2684
|
try {
|
|
739
2685
|
await this.doInitialize();
|
|
740
2686
|
}
|
|
741
2687
|
finally {
|
|
2688
|
+
mark('code/didInitStorage');
|
|
742
2689
|
}
|
|
743
2690
|
this.flushWhenIdleScheduler.schedule();
|
|
744
2691
|
})();
|
|
@@ -996,6 +2943,8 @@ async function logStorage(application, profile, workspace, applicationPath, prof
|
|
|
996
2943
|
console.groupEnd();
|
|
997
2944
|
console.log(workspaceItemsParsed);
|
|
998
2945
|
}
|
|
2946
|
+
const IProductService = ( (createDecorator('productService')));
|
|
2947
|
+
const productSchemaId = 'vscode://schemas/vscode-product';
|
|
999
2948
|
const IEditorGroupsService = ( (createDecorator('editorGroupsService')));
|
|
1000
2949
|
function isEditorGroup(obj) {
|
|
1001
2950
|
const group = obj;
|
|
@@ -1015,16 +2964,485 @@ function isPreferredGroup(obj) {
|
|
|
1015
2964
|
const candidate = obj;
|
|
1016
2965
|
return typeof obj === 'number' || isEditorGroup(candidate);
|
|
1017
2966
|
}
|
|
1018
|
-
const ITextFileService = ( (createDecorator('textFileService')));
|
|
1019
2967
|
const IWorkbenchEnvironmentService = refineServiceDecorator(IEnvironmentService);
|
|
1020
|
-
const IWorkingCopyFileService = ( (createDecorator('workingCopyFileService')));
|
|
1021
|
-
const IPathService = ( (createDecorator('pathService')));
|
|
1022
|
-
const IPaneCompositePartService = ( (createDecorator('paneCompositePartService')));
|
|
1023
|
-
const IProductService = ( (createDecorator('productService')));
|
|
1024
|
-
const productSchemaId = 'vscode://schemas/vscode-product';
|
|
1025
|
-
const ILanguageStatusService = ( (createDecorator('ILanguageStatusService')));
|
|
1026
2968
|
const IHostService = ( (createDecorator('hostService')));
|
|
2969
|
+
const ILanguageStatusService = ( (createDecorator('ILanguageStatusService')));
|
|
2970
|
+
const IPaneCompositePartService = ( (createDecorator('paneCompositePartService')));
|
|
2971
|
+
function isVirtualResource(resource) {
|
|
2972
|
+
return resource.scheme !== Schemas.file && resource.scheme !== Schemas.vscodeRemote;
|
|
2973
|
+
}
|
|
2974
|
+
function getVirtualWorkspaceLocation(workspace) {
|
|
2975
|
+
if (workspace.folders.length) {
|
|
2976
|
+
return workspace.folders.every(f => isVirtualResource(f.uri)) ? workspace.folders[0].uri : undefined;
|
|
2977
|
+
}
|
|
2978
|
+
else if (workspace.configuration && isVirtualResource(workspace.configuration)) {
|
|
2979
|
+
return workspace.configuration;
|
|
2980
|
+
}
|
|
2981
|
+
return undefined;
|
|
2982
|
+
}
|
|
2983
|
+
function getVirtualWorkspaceScheme(workspace) {
|
|
2984
|
+
return getVirtualWorkspaceLocation(workspace)?.scheme;
|
|
2985
|
+
}
|
|
2986
|
+
const IRemoteAgentService = ( (createDecorator('remoteAgentService')));
|
|
2987
|
+
const IPathService = ( (createDecorator('pathService')));
|
|
2988
|
+
let AbstractPathService = class AbstractPathService {
|
|
2989
|
+
constructor(localUserHome, remoteAgentService, environmentService, contextService) {
|
|
2990
|
+
this.localUserHome = localUserHome;
|
|
2991
|
+
this.remoteAgentService = remoteAgentService;
|
|
2992
|
+
this.environmentService = environmentService;
|
|
2993
|
+
this.contextService = contextService;
|
|
2994
|
+
this.resolveOS = (async () => {
|
|
2995
|
+
const env = await this.remoteAgentService.getEnvironment();
|
|
2996
|
+
return env?.os || OS;
|
|
2997
|
+
})();
|
|
2998
|
+
this.resolveUserHome = (async () => {
|
|
2999
|
+
const env = await this.remoteAgentService.getEnvironment();
|
|
3000
|
+
const userHome = this.maybeUnresolvedUserHome = env?.userHome ?? localUserHome;
|
|
3001
|
+
return userHome;
|
|
3002
|
+
})();
|
|
3003
|
+
}
|
|
3004
|
+
hasValidBasename(resource, arg2, basename) {
|
|
3005
|
+
if (typeof arg2 === 'string' || typeof arg2 === 'undefined') {
|
|
3006
|
+
return this.resolveOS.then(os => this.doHasValidBasename(resource, os, arg2));
|
|
3007
|
+
}
|
|
3008
|
+
return this.doHasValidBasename(resource, arg2, basename);
|
|
3009
|
+
}
|
|
3010
|
+
doHasValidBasename(resource, os, name) {
|
|
3011
|
+
if (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote) {
|
|
3012
|
+
return isValidBasename(name ?? basename(resource), os === 1 );
|
|
3013
|
+
}
|
|
3014
|
+
return true;
|
|
3015
|
+
}
|
|
3016
|
+
get defaultUriScheme() {
|
|
3017
|
+
return AbstractPathService.findDefaultUriScheme(this.environmentService, this.contextService);
|
|
3018
|
+
}
|
|
3019
|
+
static findDefaultUriScheme(environmentService, contextService) {
|
|
3020
|
+
if (environmentService.remoteAuthority) {
|
|
3021
|
+
return Schemas.vscodeRemote;
|
|
3022
|
+
}
|
|
3023
|
+
const virtualWorkspace = getVirtualWorkspaceScheme(contextService.getWorkspace());
|
|
3024
|
+
if (virtualWorkspace) {
|
|
3025
|
+
return virtualWorkspace;
|
|
3026
|
+
}
|
|
3027
|
+
const firstFolder = contextService.getWorkspace().folders[0];
|
|
3028
|
+
if (firstFolder) {
|
|
3029
|
+
return firstFolder.uri.scheme;
|
|
3030
|
+
}
|
|
3031
|
+
const configuration = contextService.getWorkspace().configuration;
|
|
3032
|
+
if (configuration) {
|
|
3033
|
+
return configuration.scheme;
|
|
3034
|
+
}
|
|
3035
|
+
return Schemas.file;
|
|
3036
|
+
}
|
|
3037
|
+
userHome(options) {
|
|
3038
|
+
return options?.preferLocal ? this.localUserHome : this.resolveUserHome;
|
|
3039
|
+
}
|
|
3040
|
+
get resolvedUserHome() {
|
|
3041
|
+
return this.maybeUnresolvedUserHome;
|
|
3042
|
+
}
|
|
3043
|
+
get path() {
|
|
3044
|
+
return this.resolveOS.then(os => {
|
|
3045
|
+
return os === 1 ?
|
|
3046
|
+
win32 :
|
|
3047
|
+
posix;
|
|
3048
|
+
});
|
|
3049
|
+
}
|
|
3050
|
+
async fileURI(_path) {
|
|
3051
|
+
let authority = '';
|
|
3052
|
+
const os = await this.resolveOS;
|
|
3053
|
+
if (os === 1 ) {
|
|
3054
|
+
_path = _path.replace(/\\/g, '/');
|
|
3055
|
+
}
|
|
3056
|
+
if (_path[0] === '/' && _path[1] === '/') {
|
|
3057
|
+
const idx = _path.indexOf('/', 2);
|
|
3058
|
+
if (idx === -1) {
|
|
3059
|
+
authority = _path.substring(2);
|
|
3060
|
+
_path = '/';
|
|
3061
|
+
}
|
|
3062
|
+
else {
|
|
3063
|
+
authority = _path.substring(2, idx);
|
|
3064
|
+
_path = _path.substring(idx) || '/';
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
return (
|
|
3068
|
+
(URI.from({
|
|
3069
|
+
scheme: Schemas.file,
|
|
3070
|
+
authority,
|
|
3071
|
+
path: _path,
|
|
3072
|
+
query: '',
|
|
3073
|
+
fragment: ''
|
|
3074
|
+
}))
|
|
3075
|
+
);
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
AbstractPathService = ( (__decorate([
|
|
3079
|
+
( (__param(1, IRemoteAgentService))),
|
|
3080
|
+
( (__param(2, IWorkbenchEnvironmentService))),
|
|
3081
|
+
( (__param(3, IWorkspaceContextService)))
|
|
3082
|
+
], AbstractPathService)));
|
|
3083
|
+
const ITextFileService = ( (createDecorator('textFileService')));
|
|
3084
|
+
class TextFileOperationError extends FileOperationError {
|
|
3085
|
+
static isTextFileOperationError(obj) {
|
|
3086
|
+
return obj instanceof Error && !isUndefinedOrNull(obj.textFileOperationResult);
|
|
3087
|
+
}
|
|
3088
|
+
constructor(message, textFileOperationResult, options) {
|
|
3089
|
+
super(message, 11 );
|
|
3090
|
+
this.textFileOperationResult = textFileOperationResult;
|
|
3091
|
+
this.options = options;
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
function stringToSnapshot(value) {
|
|
3095
|
+
let done = false;
|
|
3096
|
+
return {
|
|
3097
|
+
read() {
|
|
3098
|
+
if (!done) {
|
|
3099
|
+
done = true;
|
|
3100
|
+
return value;
|
|
3101
|
+
}
|
|
3102
|
+
return null;
|
|
3103
|
+
}
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
function toBufferOrReadable(value) {
|
|
3107
|
+
if (typeof value === 'undefined') {
|
|
3108
|
+
return undefined;
|
|
3109
|
+
}
|
|
3110
|
+
if (typeof value === 'string') {
|
|
3111
|
+
return VSBuffer.fromString(value);
|
|
3112
|
+
}
|
|
3113
|
+
return {
|
|
3114
|
+
read: () => {
|
|
3115
|
+
const chunk = value.read();
|
|
3116
|
+
if (typeof chunk === 'string') {
|
|
3117
|
+
return VSBuffer.fromString(chunk);
|
|
3118
|
+
}
|
|
3119
|
+
return null;
|
|
3120
|
+
}
|
|
3121
|
+
};
|
|
3122
|
+
}
|
|
3123
|
+
const IWorkingCopyFileService = ( (createDecorator('workingCopyFileService')));
|
|
1027
3124
|
const ISnippetsService = ( (createDecorator('snippetService')));
|
|
3125
|
+
const VIEWLET_ID = 'workbench.view.debug';
|
|
3126
|
+
const VARIABLES_VIEW_ID = 'workbench.debug.variablesView';
|
|
3127
|
+
const CALLSTACK_VIEW_ID = 'workbench.debug.callStackView';
|
|
3128
|
+
const BREAKPOINTS_VIEW_ID = 'workbench.debug.breakPointsView';
|
|
3129
|
+
const REPL_VIEW_ID = 'workbench.panel.repl.view';
|
|
3130
|
+
const CONTEXT_DEBUG_TYPE = ( (new RawContextKey$1(
|
|
3131
|
+
'debugType',
|
|
3132
|
+
undefined,
|
|
3133
|
+
{ type: 'string', description: ( (localize(
|
|
3134
|
+
'debugType',
|
|
3135
|
+
"Debug type of the active debug session. For example 'python'."
|
|
3136
|
+
))) }
|
|
3137
|
+
)));
|
|
3138
|
+
const CONTEXT_DEBUG_CONFIGURATION_TYPE = ( (new RawContextKey$1(
|
|
3139
|
+
'debugConfigurationType',
|
|
3140
|
+
undefined,
|
|
3141
|
+
{ type: 'string', description: ( (localize(
|
|
3142
|
+
'debugConfigurationType',
|
|
3143
|
+
"Debug type of the selected launch configuration. For example 'python'."
|
|
3144
|
+
))) }
|
|
3145
|
+
)));
|
|
3146
|
+
const CONTEXT_DEBUG_STATE = ( (new RawContextKey$1(
|
|
3147
|
+
'debugState',
|
|
3148
|
+
'inactive',
|
|
3149
|
+
{ type: 'string', description: ( (localize(
|
|
3150
|
+
'debugState',
|
|
3151
|
+
"State that the focused debug session is in. One of the following: 'inactive', 'initializing', 'stopped' or 'running'."
|
|
3152
|
+
))) }
|
|
3153
|
+
)));
|
|
3154
|
+
const CONTEXT_DEBUG_UX_KEY = 'debugUx';
|
|
3155
|
+
const CONTEXT_DEBUG_UX = ( (new RawContextKey$1(
|
|
3156
|
+
CONTEXT_DEBUG_UX_KEY,
|
|
3157
|
+
'default',
|
|
3158
|
+
{ type: 'string', description: ( (localize(
|
|
3159
|
+
'debugUX',
|
|
3160
|
+
"Debug UX state. When there are no debug configurations it is 'simple', otherwise 'default'. Used to decide when to show welcome views in the debug viewlet."
|
|
3161
|
+
))) }
|
|
3162
|
+
)));
|
|
3163
|
+
const CONTEXT_HAS_DEBUGGED = ( (new RawContextKey$1(
|
|
3164
|
+
'hasDebugged',
|
|
3165
|
+
false,
|
|
3166
|
+
{ type: 'boolean', description: ( (localize(
|
|
3167
|
+
'hasDebugged',
|
|
3168
|
+
"True when a debug session has been started at least once, false otherwise."
|
|
3169
|
+
))) }
|
|
3170
|
+
)));
|
|
3171
|
+
const CONTEXT_IN_DEBUG_MODE = ( (new RawContextKey$1(
|
|
3172
|
+
'inDebugMode',
|
|
3173
|
+
false,
|
|
3174
|
+
{ type: 'boolean', description: ( (localize('inDebugMode', "True when debugging, false otherwise."))) }
|
|
3175
|
+
)));
|
|
3176
|
+
const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = ( (new RawContextKey$1(
|
|
3177
|
+
'breakpointWidgetVisible',
|
|
3178
|
+
false,
|
|
3179
|
+
{ type: 'boolean', description: ( (localize(
|
|
3180
|
+
'breakpointWidgetVisibile',
|
|
3181
|
+
"True when breakpoint editor zone widget is visible, false otherwise."
|
|
3182
|
+
))) }
|
|
3183
|
+
)));
|
|
3184
|
+
const CONTEXT_IN_BREAKPOINT_WIDGET = ( (new RawContextKey$1(
|
|
3185
|
+
'inBreakpointWidget',
|
|
3186
|
+
false,
|
|
3187
|
+
{ type: 'boolean', description: ( (localize(
|
|
3188
|
+
'inBreakpointWidget',
|
|
3189
|
+
"True when focus is in the breakpoint editor zone widget, false otherwise."
|
|
3190
|
+
))) }
|
|
3191
|
+
)));
|
|
3192
|
+
const CONTEXT_BREAKPOINTS_FOCUSED = ( (new RawContextKey$1(
|
|
3193
|
+
'breakpointsFocused',
|
|
3194
|
+
true,
|
|
3195
|
+
{ type: 'boolean', description: ( (localize(
|
|
3196
|
+
'breakpointsFocused',
|
|
3197
|
+
"True when the BREAKPOINTS view is focused, false otherwise."
|
|
3198
|
+
))) }
|
|
3199
|
+
)));
|
|
3200
|
+
const CONTEXT_WATCH_EXPRESSIONS_FOCUSED = ( (new RawContextKey$1(
|
|
3201
|
+
'watchExpressionsFocused',
|
|
3202
|
+
true,
|
|
3203
|
+
{ type: 'boolean', description: ( (localize(
|
|
3204
|
+
'watchExpressionsFocused',
|
|
3205
|
+
"True when the WATCH view is focused, false otherwsie."
|
|
3206
|
+
))) }
|
|
3207
|
+
)));
|
|
3208
|
+
const CONTEXT_VARIABLES_FOCUSED = ( (new RawContextKey$1(
|
|
3209
|
+
'variablesFocused',
|
|
3210
|
+
true,
|
|
3211
|
+
{ type: 'boolean', description: ( (localize(
|
|
3212
|
+
'variablesFocused',
|
|
3213
|
+
"True when the VARIABLES views is focused, false otherwsie"
|
|
3214
|
+
))) }
|
|
3215
|
+
)));
|
|
3216
|
+
const CONTEXT_EXPRESSION_SELECTED = ( (new RawContextKey$1(
|
|
3217
|
+
'expressionSelected',
|
|
3218
|
+
false,
|
|
3219
|
+
{ type: 'boolean', description: ( (localize(
|
|
3220
|
+
'expressionSelected',
|
|
3221
|
+
"True when an expression input box is open in either the WATCH or the VARIABLES view, false otherwise."
|
|
3222
|
+
))) }
|
|
3223
|
+
)));
|
|
3224
|
+
const CONTEXT_BREAKPOINT_INPUT_FOCUSED = ( (new RawContextKey$1(
|
|
3225
|
+
'breakpointInputFocused',
|
|
3226
|
+
false,
|
|
3227
|
+
{ type: 'boolean', description: ( (localize(
|
|
3228
|
+
'breakpointInputFocused',
|
|
3229
|
+
"True when the input box has focus in the BREAKPOINTS view."
|
|
3230
|
+
))) }
|
|
3231
|
+
)));
|
|
3232
|
+
const CONTEXT_CAN_VIEW_MEMORY = ( (new RawContextKey$1(
|
|
3233
|
+
'canViewMemory',
|
|
3234
|
+
undefined,
|
|
3235
|
+
{ type: 'boolean', description: ( (localize(
|
|
3236
|
+
'canViewMemory',
|
|
3237
|
+
"Indicates whether the item in the view has an associated memory refrence."
|
|
3238
|
+
))) }
|
|
3239
|
+
)));
|
|
3240
|
+
const CONTEXT_BREAKPOINT_ITEM_TYPE = ( (new RawContextKey$1(
|
|
3241
|
+
'breakpointItemType',
|
|
3242
|
+
undefined,
|
|
3243
|
+
{ type: 'string', description: ( (localize(
|
|
3244
|
+
'breakpointItemType',
|
|
3245
|
+
"Represents the item type of the focused element in the BREAKPOINTS view. For example: 'breakpoint', 'exceptionBreakppint', 'functionBreakpoint', 'dataBreakpoint'"
|
|
3246
|
+
))) }
|
|
3247
|
+
)));
|
|
3248
|
+
const CONTEXT_BREAKPOINT_SUPPORTS_CONDITION = ( (new RawContextKey$1(
|
|
3249
|
+
'breakpointSupportsCondition',
|
|
3250
|
+
false,
|
|
3251
|
+
{ type: 'boolean', description: ( (localize(
|
|
3252
|
+
'breakpointSupportsCondition',
|
|
3253
|
+
"True when the focused breakpoint supports conditions."
|
|
3254
|
+
))) }
|
|
3255
|
+
)));
|
|
3256
|
+
const CONTEXT_LOADED_SCRIPTS_SUPPORTED = ( (new RawContextKey$1(
|
|
3257
|
+
'loadedScriptsSupported',
|
|
3258
|
+
false,
|
|
3259
|
+
{ type: 'boolean', description: ( (localize(
|
|
3260
|
+
'loadedScriptsSupported',
|
|
3261
|
+
"True when the focused sessions supports the LOADED SCRIPTS view"
|
|
3262
|
+
))) }
|
|
3263
|
+
)));
|
|
3264
|
+
const CONTEXT_FOCUSED_SESSION_IS_ATTACH = ( (new RawContextKey$1(
|
|
3265
|
+
'focusedSessionIsAttach',
|
|
3266
|
+
false,
|
|
3267
|
+
{ type: 'boolean', description: ( (localize('focusedSessionIsAttach', "True when the focused session is 'attach'."))) }
|
|
3268
|
+
)));
|
|
3269
|
+
const CONTEXT_STEP_BACK_SUPPORTED = ( (new RawContextKey$1(
|
|
3270
|
+
'stepBackSupported',
|
|
3271
|
+
false,
|
|
3272
|
+
{ type: 'boolean', description: ( (localize(
|
|
3273
|
+
'stepBackSupported',
|
|
3274
|
+
"True when the focused session supports 'stepBack' requests."
|
|
3275
|
+
))) }
|
|
3276
|
+
)));
|
|
3277
|
+
const CONTEXT_RESTART_FRAME_SUPPORTED = ( (new RawContextKey$1(
|
|
3278
|
+
'restartFrameSupported',
|
|
3279
|
+
false,
|
|
3280
|
+
{ type: 'boolean', description: ( (localize(
|
|
3281
|
+
'restartFrameSupported',
|
|
3282
|
+
"True when the focused session supports 'restartFrame' requests."
|
|
3283
|
+
))) }
|
|
3284
|
+
)));
|
|
3285
|
+
const CONTEXT_JUMP_TO_CURSOR_SUPPORTED = ( (new RawContextKey$1(
|
|
3286
|
+
'jumpToCursorSupported',
|
|
3287
|
+
false,
|
|
3288
|
+
{ type: 'boolean', description: ( (localize(
|
|
3289
|
+
'jumpToCursorSupported',
|
|
3290
|
+
"True when the focused session supports 'jumpToCursor' request."
|
|
3291
|
+
))) }
|
|
3292
|
+
)));
|
|
3293
|
+
const CONTEXT_STEP_INTO_TARGETS_SUPPORTED = ( (new RawContextKey$1(
|
|
3294
|
+
'stepIntoTargetsSupported',
|
|
3295
|
+
false,
|
|
3296
|
+
{ type: 'boolean', description: ( (localize(
|
|
3297
|
+
'stepIntoTargetsSupported',
|
|
3298
|
+
"True when the focused session supports 'stepIntoTargets' request."
|
|
3299
|
+
))) }
|
|
3300
|
+
)));
|
|
3301
|
+
const CONTEXT_BREAKPOINTS_EXIST = ( (new RawContextKey$1(
|
|
3302
|
+
'breakpointsExist',
|
|
3303
|
+
false,
|
|
3304
|
+
{ type: 'boolean', description: ( (localize('breakpointsExist', "True when at least one breakpoint exists."))) }
|
|
3305
|
+
)));
|
|
3306
|
+
const CONTEXT_DEBUGGERS_AVAILABLE = ( (new RawContextKey$1(
|
|
3307
|
+
'debuggersAvailable',
|
|
3308
|
+
false,
|
|
3309
|
+
{ type: 'boolean', description: ( (localize(
|
|
3310
|
+
'debuggersAvailable',
|
|
3311
|
+
"True when there is at least one debug extensions active."
|
|
3312
|
+
))) }
|
|
3313
|
+
)));
|
|
3314
|
+
const CONTEXT_DEBUG_EXTENSION_AVAILABLE = ( (new RawContextKey$1(
|
|
3315
|
+
'debugExtensionAvailable',
|
|
3316
|
+
true,
|
|
3317
|
+
{ type: 'boolean', description: ( (localize(
|
|
3318
|
+
'debugExtensionsAvailable',
|
|
3319
|
+
"True when there is at least one debug extension installed and enabled."
|
|
3320
|
+
))) }
|
|
3321
|
+
)));
|
|
3322
|
+
const CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT = ( (new RawContextKey$1(
|
|
3323
|
+
'debugProtocolVariableMenuContext',
|
|
3324
|
+
undefined,
|
|
3325
|
+
{ type: 'string', description: ( (localize(
|
|
3326
|
+
'debugProtocolVariableMenuContext',
|
|
3327
|
+
"Represents the context the debug adapter sets on the focused variable in the VARIABLES view."
|
|
3328
|
+
))) }
|
|
3329
|
+
)));
|
|
3330
|
+
const CONTEXT_SET_VARIABLE_SUPPORTED = ( (new RawContextKey$1(
|
|
3331
|
+
'debugSetVariableSupported',
|
|
3332
|
+
false,
|
|
3333
|
+
{ type: 'boolean', description: ( (localize(
|
|
3334
|
+
'debugSetVariableSupported',
|
|
3335
|
+
"True when the focused session supports 'setVariable' request."
|
|
3336
|
+
))) }
|
|
3337
|
+
)));
|
|
3338
|
+
const CONTEXT_SET_EXPRESSION_SUPPORTED = ( (new RawContextKey$1(
|
|
3339
|
+
'debugSetExpressionSupported',
|
|
3340
|
+
false,
|
|
3341
|
+
{ type: 'boolean', description: ( (localize(
|
|
3342
|
+
'debugSetExpressionSupported',
|
|
3343
|
+
"True when the focused session supports 'setExpression' request."
|
|
3344
|
+
))) }
|
|
3345
|
+
)));
|
|
3346
|
+
const CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED = ( (new RawContextKey$1(
|
|
3347
|
+
'terminateDebuggeeSupported',
|
|
3348
|
+
false,
|
|
3349
|
+
{ type: 'boolean', description: ( (localize(
|
|
3350
|
+
'terminateDebuggeeSupported',
|
|
3351
|
+
"True when the focused session supports the terminate debuggee capability."
|
|
3352
|
+
))) }
|
|
3353
|
+
)));
|
|
3354
|
+
const CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED = ( (new RawContextKey$1(
|
|
3355
|
+
'suspendDebuggeeSupported',
|
|
3356
|
+
false,
|
|
3357
|
+
{ type: 'boolean', description: ( (localize(
|
|
3358
|
+
'suspendDebuggeeSupported',
|
|
3359
|
+
"True when the focused session supports the suspend debuggee capability."
|
|
3360
|
+
))) }
|
|
3361
|
+
)));
|
|
3362
|
+
const CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT = ( (new RawContextKey$1(
|
|
3363
|
+
'variableEvaluateNamePresent',
|
|
3364
|
+
false,
|
|
3365
|
+
{ type: 'boolean', description: ( (localize(
|
|
3366
|
+
'variableEvaluateNamePresent',
|
|
3367
|
+
"True when the focused variable has an 'evalauteName' field set."
|
|
3368
|
+
))) }
|
|
3369
|
+
)));
|
|
3370
|
+
const CONTEXT_VARIABLE_IS_READONLY = ( (new RawContextKey$1(
|
|
3371
|
+
'variableIsReadonly',
|
|
3372
|
+
false,
|
|
3373
|
+
{ type: 'boolean', description: ( (localize('variableIsReadonly', "True when the focused variable is readonly."))) }
|
|
3374
|
+
)));
|
|
3375
|
+
const CONTEXT_EXCEPTION_WIDGET_VISIBLE = ( (new RawContextKey$1(
|
|
3376
|
+
'exceptionWidgetVisible',
|
|
3377
|
+
false,
|
|
3378
|
+
{ type: 'boolean', description: ( (localize('exceptionWidgetVisible', "True when the exception widget is visible."))) }
|
|
3379
|
+
)));
|
|
3380
|
+
const CONTEXT_MULTI_SESSION_DEBUG = ( (new RawContextKey$1(
|
|
3381
|
+
'multiSessionDebug',
|
|
3382
|
+
false,
|
|
3383
|
+
{ type: 'boolean', description: ( (localize(
|
|
3384
|
+
'multiSessionDebug',
|
|
3385
|
+
"True when there is more than 1 active debug session."
|
|
3386
|
+
))) }
|
|
3387
|
+
)));
|
|
3388
|
+
const CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED = ( (new RawContextKey$1(
|
|
3389
|
+
'disassembleRequestSupported',
|
|
3390
|
+
false,
|
|
3391
|
+
{ type: 'boolean', description: ( (localize(
|
|
3392
|
+
'disassembleRequestSupported',
|
|
3393
|
+
"True when the focused sessions supports disassemble request."
|
|
3394
|
+
))) }
|
|
3395
|
+
)));
|
|
3396
|
+
const CONTEXT_DISASSEMBLY_VIEW_FOCUS = ( (new RawContextKey$1(
|
|
3397
|
+
'disassemblyViewFocus',
|
|
3398
|
+
false,
|
|
3399
|
+
{ type: 'boolean', description: ( (localize('disassemblyViewFocus', "True when the Disassembly View is focused."))) }
|
|
3400
|
+
)));
|
|
3401
|
+
const CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE = ( (new RawContextKey$1(
|
|
3402
|
+
'focusedStackFrameHasInstructionReference',
|
|
3403
|
+
false,
|
|
3404
|
+
{ type: 'boolean', description: ( (localize(
|
|
3405
|
+
'focusedStackFrameHasInstructionReference',
|
|
3406
|
+
"True when the focused stack frame has instruction pointer reference."
|
|
3407
|
+
))) }
|
|
3408
|
+
)));
|
|
3409
|
+
const debuggerDisabledMessage = (debugType) => ( (localize(
|
|
3410
|
+
'debuggerDisabled',
|
|
3411
|
+
"Configured debug type '{0}' is installed but not supported in this environment.",
|
|
3412
|
+
debugType
|
|
3413
|
+
)));
|
|
3414
|
+
const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';
|
|
3415
|
+
const BREAKPOINT_EDITOR_CONTRIBUTION_ID = 'editor.contrib.breakpoint';
|
|
3416
|
+
const DEBUG_SCHEME = 'debug';
|
|
3417
|
+
const INTERNAL_CONSOLE_OPTIONS_SCHEMA = {
|
|
3418
|
+
enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'],
|
|
3419
|
+
default: 'openOnFirstSessionStart',
|
|
3420
|
+
description: ( (localize(
|
|
3421
|
+
'internalConsoleOptions',
|
|
3422
|
+
"Controls when the internal Debug Console should open."
|
|
3423
|
+
)))
|
|
3424
|
+
};
|
|
3425
|
+
function getStateLabel(state) {
|
|
3426
|
+
switch (state) {
|
|
3427
|
+
case 1 : return 'initializing';
|
|
3428
|
+
case 2 : return 'stopped';
|
|
3429
|
+
case 3 : return 'running';
|
|
3430
|
+
default: return 'inactive';
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
const DEBUG_MEMORY_SCHEME = 'vscode-debug-memory';
|
|
3434
|
+
var DebugConfigurationProviderTriggerKind;
|
|
3435
|
+
( ((function(DebugConfigurationProviderTriggerKind) {
|
|
3436
|
+
DebugConfigurationProviderTriggerKind[DebugConfigurationProviderTriggerKind["Initial"] = 1] = "Initial";
|
|
3437
|
+
DebugConfigurationProviderTriggerKind[DebugConfigurationProviderTriggerKind["Dynamic"] = 2] = "Dynamic";
|
|
3438
|
+
})(
|
|
3439
|
+
DebugConfigurationProviderTriggerKind || (DebugConfigurationProviderTriggerKind = {})
|
|
3440
|
+
)));
|
|
3441
|
+
var DebuggerString;
|
|
3442
|
+
( ((function(DebuggerString) {
|
|
3443
|
+
DebuggerString["UnverifiedBreakpoints"] = "unverifiedBreakpoints";
|
|
3444
|
+
})(DebuggerString || (DebuggerString = {}))));
|
|
3445
|
+
const IDebugService = ( (createDecorator('debugService')));
|
|
1028
3446
|
let services;
|
|
1029
3447
|
var Services;
|
|
1030
3448
|
( (function(Services) {
|
|
@@ -1046,4 +3464,4 @@ var Services;
|
|
|
1046
3464
|
}
|
|
1047
3465
|
Services.install = install;
|
|
1048
3466
|
})(Services || (Services = {})));
|
|
1049
|
-
export { ACTIVE_GROUP as A,
|
|
3467
|
+
export { TooLargeFileOperationError as $, ACTIVE_GROUP as A, StorageTarget as B, ContextKeyExprType as C, DebugConfigurationProviderTriggerKind as D, Emitter as E, FileSystemProviderErrorCode as F, NeverShowAgainScope as G, isPreferredGroup as H, IEditorService as I, IUserDataProfilesService as J, toBufferOrReadable as K, stringToSnapshot as L, FileChangesEvent as M, NotificationsFilter as N, hasOpenReadWriteCloseCapability as O, hasReadWriteCapability as P, hasFileReadStreamCapability as Q, ensureFileSystemProviderError as R, SIDE_GROUP as S, TextFileOperationError as T, etag as U, FileOperationEvent as V, toFileOperationResult as W, ETAG_DISABLED as X, hasFileAtomicReadCapability as Y, NotModifiedSinceFileOperationError as Z, __decorate as _, __param as a, NoOpNotification as a$, hasFileFolderCopyCapability as a0, hasFileCloneCapability as a1, createFileSystemProviderError as a2, FileSystemProviderError as a3, BREAKPOINTS_VIEW_ID as a4, CONTEXT_DEBUGGERS_AVAILABLE as a5, CONTEXT_BREAKPOINT_ITEM_TYPE as a6, CONTEXT_BREAKPOINTS_EXIST as a7, CONTEXT_IN_DEBUG_MODE as a8, CONTEXT_BREAKPOINT_SUPPORTS_CONDITION as a9, CONTEXT_STEP_BACK_SUPPORTED as aA, CONTEXT_MULTI_SESSION_DEBUG as aB, CONTEXT_BREAKPOINT_WIDGET_VISIBLE as aC, CONTEXT_IN_BREAKPOINT_WIDGET as aD, CONTEXT_EXCEPTION_WIDGET_VISIBLE as aE, CONTEXT_DEBUG_EXTENSION_AVAILABLE as aF, CONTEXT_DEBUG_CONFIGURATION_TYPE as aG, CONTEXT_LOADED_SCRIPTS_SUPPORTED as aH, CONTEXT_RESTART_FRAME_SUPPORTED as aI, CONTEXT_SET_VARIABLE_SUPPORTED as aJ, CONTEXT_SET_EXPRESSION_SUPPORTED as aK, CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED as aL, CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE as aM, CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT as aN, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT as aO, CONTEXT_CAN_VIEW_MEMORY as aP, CONTEXT_VARIABLE_IS_READONLY as aQ, DebuggerString as aR, FILES_ASSOCIATIONS_CONFIG as aS, productSchemaId as aT, AutoSaveConfiguration as aU, IRemoteAgentService as aV, AbstractPathService as aW, HotExitConfiguration as aX, markAsFileSystemProviderError as aY, RawContextKey as aZ, ContextKeyExpr as a_, BREAKPOINT_EDITOR_CONTRIBUTION_ID as aa, CONTEXT_DISASSEMBLY_VIEW_FOCUS as ab, CONTEXT_JUMP_TO_CURSOR_SUPPORTED as ac, CONTEXT_DEBUG_STATE as ad, CONTEXT_STEP_INTO_TARGETS_SUPPORTED as ae, CONTEXT_FOCUSED_SESSION_IS_ATTACH as af, REPL_VIEW_ID as ag, CONTEXT_BREAKPOINTS_FOCUSED as ah, CONTEXT_WATCH_EXPRESSIONS_FOCUSED as ai, CONTEXT_VARIABLES_FOCUSED as aj, CONTEXT_EXPRESSION_SELECTED as ak, CONTEXT_BREAKPOINT_INPUT_FOCUSED as al, VIEWLET_ID as am, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED as an, CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED as ao, VARIABLES_VIEW_ID as ap, EDITOR_CONTRIBUTION_ID as aq, INTERNAL_CONSOLE_OPTIONS_SCHEMA as ar, DEBUG_MEMORY_SCHEME as as, DEBUG_SCHEME as at, CALLSTACK_VIEW_ID as au, CONTEXT_DEBUG_TYPE as av, CONTEXT_HAS_DEBUGGED as aw, CONTEXT_DEBUG_UX as ax, getStateLabel as ay, debuggerDisabledMessage as az, __classPrivateFieldSet as b, __classPrivateFieldGet as c, IEditorGroupsService as d, IProductService as e, Services as f, getMarks as g, FileType as h, FilePermission as i, IUriIdentityService as j, IPaneCompositePartService as k, ITextFileService as l, mark as m, IFileService as n, IWorkbenchEnvironmentService as o, preferredSideBySideGroupDirection as p, IWorkingCopyFileService as q, IPathService as r, ILanguageStatusService as s, IHostService as t, IDebugService as u, FileOperationError as v, refineServiceDecorator as w, toFileSystemProviderErrorCode as x, ISnippetsService as y, StorageScope as z };
|