@finos/legend-lego 1.2.72 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/code-editor/CodeDiffView.d.ts +3 -1
- package/lib/code-editor/CodeDiffView.d.ts.map +1 -1
- package/lib/code-editor/CodeDiffView.js +6 -2
- package/lib/code-editor/CodeDiffView.js.map +1 -1
- package/lib/code-editor/CodeEditor.d.ts +8 -2
- package/lib/code-editor/CodeEditor.d.ts.map +1 -1
- package/lib/code-editor/CodeEditor.js +42 -4
- package/lib/code-editor/CodeEditor.js.map +1 -1
- package/lib/code-editor/index.d.ts +0 -5
- package/lib/code-editor/index.d.ts.map +1 -1
- package/lib/code-editor/index.js +0 -5
- package/lib/code-editor/index.js.map +1 -1
- package/lib/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/data-grid/DataGrid.js +1 -13
- package/lib/data-grid/DataGrid.js.map +1 -1
- package/lib/index.css +1 -1
- package/package.json +29 -29
- package/src/code-editor/CodeDiffView.tsx +10 -3
- package/src/code-editor/CodeEditor.tsx +69 -4
- package/src/code-editor/index.ts +0 -6
- package/src/data-grid/DataGrid.tsx +0 -6
- package/tsconfig.json +1 -15
- package/lib/code-editor/CodeEditorTheme.d.ts +0 -41
- package/lib/code-editor/CodeEditorTheme.d.ts.map +0 -1
- package/lib/code-editor/CodeEditorTheme.js +0 -99
- package/lib/code-editor/CodeEditorTheme.js.map +0 -1
- package/lib/code-editor/CodeEditorUtils.d.ts +0 -74
- package/lib/code-editor/CodeEditorUtils.d.ts.map +0 -1
- package/lib/code-editor/CodeEditorUtils.js +0 -203
- package/lib/code-editor/CodeEditorUtils.js.map +0 -1
- package/lib/code-editor/PureLanguage.d.ts +0 -38
- package/lib/code-editor/PureLanguage.d.ts.map +0 -1
- package/lib/code-editor/PureLanguage.js +0 -39
- package/lib/code-editor/PureLanguage.js.map +0 -1
- package/lib/code-editor/PureLanguageCodeEditorSupport.d.ts +0 -71
- package/lib/code-editor/PureLanguageCodeEditorSupport.d.ts.map +0 -1
- package/lib/code-editor/PureLanguageCodeEditorSupport.js +0 -238
- package/lib/code-editor/PureLanguageCodeEditorSupport.js.map +0 -1
- package/lib/code-editor/PureLanguageService.d.ts +0 -19
- package/lib/code-editor/PureLanguageService.d.ts.map +0 -1
- package/lib/code-editor/PureLanguageService.js +0 -373
- package/lib/code-editor/PureLanguageService.js.map +0 -1
- package/lib/code-editor/themes/Github-Theme-dark-dimmed.json +0 -613
- package/lib/code-editor/themes/Github-Theme-dark.json +0 -513
- package/lib/code-editor/themes/Github-Theme-light.json +0 -598
- package/lib/code-editor/themes/Material-Theme-Darker.json +0 -816
- package/lib/code-editor/themes/Material-Theme-Default.json +0 -816
- package/lib/code-editor/themes/MonacoEditorThemeUtils.d.ts +0 -31
- package/lib/code-editor/themes/MonacoEditorThemeUtils.d.ts.map +0 -1
- package/lib/code-editor/themes/MonacoEditorThemeUtils.js +0 -88
- package/lib/code-editor/themes/MonacoEditorThemeUtils.js.map +0 -1
- package/lib/code-editor/themes/OneDark-Pro-darker.json +0 -2061
- package/lib/code-editor/themes/OneDark-Pro.json +0 -2090
- package/lib/code-editor/themes/solarized-dark-color-theme.json +0 -398
- package/src/code-editor/CodeEditorTheme.ts +0 -151
- package/src/code-editor/CodeEditorUtils.ts +0 -336
- package/src/code-editor/PureLanguage.ts +0 -42
- package/src/code-editor/PureLanguageCodeEditorSupport.ts +0 -341
- package/src/code-editor/PureLanguageService.ts +0 -416
- package/src/code-editor/themes/Github-Theme-dark-dimmed.json +0 -613
- package/src/code-editor/themes/Github-Theme-dark.json +0 -513
- package/src/code-editor/themes/Github-Theme-light.json +0 -598
- package/src/code-editor/themes/Material-Theme-Darker.json +0 -816
- package/src/code-editor/themes/Material-Theme-Default.json +0 -816
- package/src/code-editor/themes/MonacoEditorThemeUtils.ts +0 -128
- package/src/code-editor/themes/OneDark-Pro-darker.json +0 -2061
- package/src/code-editor/themes/OneDark-Pro.json +0 -2090
- package/src/code-editor/themes/README.md +0 -8
- package/src/code-editor/themes/solarized-dark-color-theme.json +0 -423
@@ -1,416 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
-
*
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
* you may not use this file except in compliance with the License.
|
6
|
-
* You may obtain a copy of the License at
|
7
|
-
*
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
*
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
* See the License for the specific language governing permissions and
|
14
|
-
* limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
/* eslint-disable prefer-named-capture-group */
|
18
|
-
import { PURE_ELEMENT_NAME, PURE_CONNECTION_NAME } from '@finos/legend-graph';
|
19
|
-
import { languages as monacoLanguagesAPI } from 'monaco-editor';
|
20
|
-
import { PURE_GRAMMAR_TOKEN } from './PureLanguage.js';
|
21
|
-
import { CODE_EDITOR_LANGUAGE } from './CodeEditorUtils.js';
|
22
|
-
|
23
|
-
/**
|
24
|
-
* The postfix to be added to all token types, i.e. identifier.pure, number.pure, etc.
|
25
|
-
*/
|
26
|
-
const PURE_GRAMMAR_TOKEN_POSTFIX = '.pure';
|
27
|
-
|
28
|
-
// Taken from `monaco-languages` configuration for Java in order to do propert brace matching
|
29
|
-
// See https://github.com/microsoft/monaco-languages/blob/master/src/java/java.ts
|
30
|
-
const configuration: monacoLanguagesAPI.LanguageConfiguration = {
|
31
|
-
// NOTE: Pure identifier includes $ but not in the first position (as that is parsed as a variable)
|
32
|
-
wordPattern:
|
33
|
-
/(-?\d*\.\d\w*)|([^`~!@#%^$&*()\-=+[{\]}\\|;:'",.<>/?\s][^`~!@#%^&*()\-=+[{\]}\\|;:'",.<>/?\s]*)/,
|
34
|
-
comments: {
|
35
|
-
lineComment: '//',
|
36
|
-
blockComment: ['/*', '*/'],
|
37
|
-
},
|
38
|
-
brackets: [
|
39
|
-
['{', '}'],
|
40
|
-
['[', ']'],
|
41
|
-
['(', ')'],
|
42
|
-
],
|
43
|
-
autoClosingPairs: [
|
44
|
-
{ open: '{', close: '}' },
|
45
|
-
{ open: '[', close: ']' },
|
46
|
-
{ open: '(', close: ')' },
|
47
|
-
{ open: '"', close: '"' },
|
48
|
-
{ open: "'", close: "'" },
|
49
|
-
],
|
50
|
-
surroundingPairs: [
|
51
|
-
{ open: '{', close: '}' },
|
52
|
-
{ open: '[', close: ']' },
|
53
|
-
{ open: '(', close: ')' },
|
54
|
-
{ open: '"', close: '"' },
|
55
|
-
{ open: "'", close: "'" },
|
56
|
-
{ open: '<', close: '>' },
|
57
|
-
{ open: '<<', close: '>>' },
|
58
|
-
],
|
59
|
-
folding: {
|
60
|
-
markers: {
|
61
|
-
start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
|
62
|
-
end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'),
|
63
|
-
},
|
64
|
-
},
|
65
|
-
};
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Create new monarch definition to support syntax-highlighting
|
69
|
-
* See https://microsoft.github.io/monaco-editor/monarch.html
|
70
|
-
*
|
71
|
-
* The way SQL monarch definition is organized is good and worth learning from
|
72
|
-
* See https://github.com/microsoft/monaco-languages/blob/master/src/sql/sql.ts
|
73
|
-
*
|
74
|
-
* NOTE: using `monarch` only allows fairly very basic syntax-highlighting
|
75
|
-
* to actually do full AST analysis, we might need something more serious like
|
76
|
-
* using TextMate grammar which is used by VSCode itself
|
77
|
-
* See https://github.com/microsoft/monaco-editor#faq
|
78
|
-
* See https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide
|
79
|
-
*/
|
80
|
-
const generateLanguageMonarch = (
|
81
|
-
extraKeywords: string[],
|
82
|
-
): monacoLanguagesAPI.IMonarchLanguage =>
|
83
|
-
// TODO: complete syntax-highlighter for core features like constraint, derived properties, etc.
|
84
|
-
// TODO: add syntax highlighting for modules/plugins (come up with a plugin mechanism to do this).
|
85
|
-
({
|
86
|
-
defaultToken: 'invalid',
|
87
|
-
tokenPostfix: PURE_GRAMMAR_TOKEN_POSTFIX,
|
88
|
-
|
89
|
-
keywords: [
|
90
|
-
...extraKeywords,
|
91
|
-
// relational
|
92
|
-
'Schema',
|
93
|
-
'Table',
|
94
|
-
'Join',
|
95
|
-
'View',
|
96
|
-
'primaryKey',
|
97
|
-
'groupBy',
|
98
|
-
'mainTable',
|
99
|
-
// native
|
100
|
-
'let',
|
101
|
-
'extends',
|
102
|
-
'true',
|
103
|
-
'false',
|
104
|
-
'projects',
|
105
|
-
// elements
|
106
|
-
PURE_ELEMENT_NAME.CLASS,
|
107
|
-
PURE_ELEMENT_NAME.ASSOCIATION,
|
108
|
-
PURE_ELEMENT_NAME.ENUMERATION,
|
109
|
-
PURE_ELEMENT_NAME.MEASURE,
|
110
|
-
PURE_ELEMENT_NAME.PROFILE,
|
111
|
-
PURE_ELEMENT_NAME.FUNCTION,
|
112
|
-
PURE_ELEMENT_NAME.MAPPING,
|
113
|
-
PURE_ELEMENT_NAME.RUNTIME,
|
114
|
-
PURE_ELEMENT_NAME.CONNECTION,
|
115
|
-
PURE_ELEMENT_NAME.FILE_GENERATION,
|
116
|
-
PURE_ELEMENT_NAME.GENERATION_SPECIFICATION,
|
117
|
-
PURE_ELEMENT_NAME.DATA_ELEMENT,
|
118
|
-
// connections
|
119
|
-
PURE_CONNECTION_NAME.JSON_MODEL_CONNECTION,
|
120
|
-
PURE_CONNECTION_NAME.MODEL_CHAIN_CONNECTION,
|
121
|
-
PURE_CONNECTION_NAME.XML_MODEL_CONNECTION,
|
122
|
-
// mapping
|
123
|
-
'include',
|
124
|
-
'EnumerationMapping',
|
125
|
-
'Pure',
|
126
|
-
'AssociationMapping',
|
127
|
-
'XStore',
|
128
|
-
'AggregationAware',
|
129
|
-
/**
|
130
|
-
* @modularize
|
131
|
-
* See https://github.com/finos/legend-studio/issues/65
|
132
|
-
*/
|
133
|
-
PURE_ELEMENT_NAME.SERVICE,
|
134
|
-
PURE_ELEMENT_NAME.FLAT_DATA,
|
135
|
-
PURE_ELEMENT_NAME.DATABASE,
|
136
|
-
PURE_CONNECTION_NAME.FLAT_DATA_CONNECTION,
|
137
|
-
PURE_CONNECTION_NAME.RELATIONAL_DATABASE_CONNECTION,
|
138
|
-
'Relational',
|
139
|
-
],
|
140
|
-
|
141
|
-
operators: [
|
142
|
-
'=',
|
143
|
-
'>',
|
144
|
-
'<',
|
145
|
-
'!',
|
146
|
-
'~',
|
147
|
-
'?',
|
148
|
-
':',
|
149
|
-
'==',
|
150
|
-
'<=',
|
151
|
-
'>=',
|
152
|
-
'&&',
|
153
|
-
'||',
|
154
|
-
'++',
|
155
|
-
'--',
|
156
|
-
'+',
|
157
|
-
'-',
|
158
|
-
'*',
|
159
|
-
'/',
|
160
|
-
'&',
|
161
|
-
'|',
|
162
|
-
'^',
|
163
|
-
'%',
|
164
|
-
'->',
|
165
|
-
'#{',
|
166
|
-
'}#',
|
167
|
-
'@',
|
168
|
-
'<<',
|
169
|
-
'>>',
|
170
|
-
],
|
171
|
-
|
172
|
-
languageStructs: ['import', 'native'],
|
173
|
-
|
174
|
-
// common regular expressions to be used in tokenizer
|
175
|
-
identifier: /[a-zA-Z_$][\w$]*/,
|
176
|
-
symbols: /[=><!~?:&|+\-*/^%#@]+/,
|
177
|
-
escapes:
|
178
|
-
/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
179
|
-
digits: /\d+(_+\d+)*/,
|
180
|
-
octaldigits: /[0-7]+(_+[0-7]+)*/,
|
181
|
-
binarydigits: /[0-1]+(_+[0-1]+)*/,
|
182
|
-
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
|
183
|
-
multiplicity: /\[(?:[a-zA-Z0-9]+(?:\.\.(?:[a-zA-Z0-9]+|\*|))?|\*)\]/,
|
184
|
-
package: /(?:[\w_]+::)+/,
|
185
|
-
// NOTE: generics is a little tricky because in order to do it right, we have to
|
186
|
-
// do some sort of bracket matching, but we just can use a simple tokenizer here
|
187
|
-
// so to account for cases like `<Nil,Any|*>)->` `Function<{T[1]->Boolean[1]}>[1]`
|
188
|
-
// we have to make sure the content does not contain any `:` or `.` characters
|
189
|
-
// in order to avoid the accidental greedy match with inputs like
|
190
|
-
// `function doSomething<T>(a: Function<T[1]->Boolean[1]>)`
|
191
|
-
// nor we want to make sure the last character of the content is not `-` to avoid
|
192
|
-
// accidentally matching `->` as the end of the generics
|
193
|
-
generics: /(?:(?:<\w+>)|(?:<[^:.@^()]+[^-]>))/,
|
194
|
-
date: /%-?\d+(?:-\d+(?:-\d+(?:T(?:\d+(?::\d+(?::\d+(?:.\d+)?)?)?)(?:[+-][0-9]{4})?)))/,
|
195
|
-
time: /%\d+(?::\d+(?::\d+(?:.\d+)?)?)?/,
|
196
|
-
|
197
|
-
tokenizer: {
|
198
|
-
root: [
|
199
|
-
// NOTE: since `monaco-editor` Monarch is only meant for tokenizing
|
200
|
-
// and the need to highlight Pure syntax is more than just token-based,
|
201
|
-
// but semantic/syntax-based we have to create these complex rules.
|
202
|
-
// the things to note here is these are not meant to match multilines
|
203
|
-
// and they must be placed before identifier rules since token matching
|
204
|
-
// is run in order
|
205
|
-
// See https://github.com/microsoft/monaco-editor/issues/316#issuecomment-273555698
|
206
|
-
// See https://github.com/microsoft/monaco-editor/issues/571#issuecomment-342555050
|
207
|
-
// See https://microsoft.github.io/monaco-editor/monarch.html
|
208
|
-
{ include: '@pure' },
|
209
|
-
|
210
|
-
{ include: '@date' },
|
211
|
-
{ include: '@color' },
|
212
|
-
|
213
|
-
// parser markers
|
214
|
-
[
|
215
|
-
// NOTE: any leading whitespace to the section header is considered invalid syntax
|
216
|
-
/^\s*###[\w]+/,
|
217
|
-
PURE_GRAMMAR_TOKEN.PARSER,
|
218
|
-
],
|
219
|
-
|
220
|
-
// identifiers and keywords
|
221
|
-
[
|
222
|
-
/(@identifier)/,
|
223
|
-
{
|
224
|
-
cases: {
|
225
|
-
'@languageStructs': PURE_GRAMMAR_TOKEN.LANGUAGE_STRUCT,
|
226
|
-
'@keywords': `${PURE_GRAMMAR_TOKEN.KEYWORD}.$0`,
|
227
|
-
// function descriptor
|
228
|
-
'([a-zA-Z_$][\\w$]*)_((\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))__)*(\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))_':
|
229
|
-
PURE_GRAMMAR_TOKEN.TYPE,
|
230
|
-
'@default': PURE_GRAMMAR_TOKEN.IDENTIFIER,
|
231
|
-
},
|
232
|
-
},
|
233
|
-
],
|
234
|
-
|
235
|
-
// whitespace
|
236
|
-
{ include: '@whitespace' },
|
237
|
-
|
238
|
-
// delimiters and operators
|
239
|
-
[/[{}()[\]]/, '@brackets'],
|
240
|
-
[/[<>](?!@symbols)/, '@brackets'],
|
241
|
-
[
|
242
|
-
/@symbols/,
|
243
|
-
{
|
244
|
-
cases: {
|
245
|
-
'@operators': PURE_GRAMMAR_TOKEN.OPERATOR,
|
246
|
-
'@default': PURE_GRAMMAR_TOKEN.IDENTIFIER,
|
247
|
-
},
|
248
|
-
},
|
249
|
-
],
|
250
|
-
|
251
|
-
{ include: '@number' },
|
252
|
-
|
253
|
-
// delimiter: after number because of .\d floats
|
254
|
-
[/[;,.]/, PURE_GRAMMAR_TOKEN.DELIMITER],
|
255
|
-
|
256
|
-
// strings
|
257
|
-
// NOTE: including non-teminated string so as people type ', we can start showing them that they're working on a string
|
258
|
-
[/'([^'\\]|\\.)*$/, `${PURE_GRAMMAR_TOKEN.STRING}.invalid`],
|
259
|
-
[/'/, PURE_GRAMMAR_TOKEN.STRING, '@string'],
|
260
|
-
|
261
|
-
{ include: '@characters' },
|
262
|
-
],
|
263
|
-
|
264
|
-
pure: [
|
265
|
-
// type
|
266
|
-
[/(@package\*)/, [PURE_GRAMMAR_TOKEN.PACKAGE]], // import path
|
267
|
-
[
|
268
|
-
/(@package?)(@identifier)(@generics?)(\s*)(@multiplicity)/,
|
269
|
-
[
|
270
|
-
PURE_GRAMMAR_TOKEN.PACKAGE,
|
271
|
-
PURE_GRAMMAR_TOKEN.TYPE,
|
272
|
-
PURE_GRAMMAR_TOKEN.GENERICS,
|
273
|
-
PURE_GRAMMAR_TOKEN.WHITESPACE,
|
274
|
-
PURE_GRAMMAR_TOKEN.MULTIPLICITY,
|
275
|
-
],
|
276
|
-
],
|
277
|
-
[
|
278
|
-
/(@package)(@identifier)(@generics?)/,
|
279
|
-
[
|
280
|
-
PURE_GRAMMAR_TOKEN.PACKAGE,
|
281
|
-
PURE_GRAMMAR_TOKEN.TYPE,
|
282
|
-
PURE_GRAMMAR_TOKEN.GENERICS,
|
283
|
-
],
|
284
|
-
],
|
285
|
-
|
286
|
-
// special operators that uses type (e.g. constructor, cast)
|
287
|
-
[
|
288
|
-
/([@^])(\s*)(@package?)(@identifier)(@generics?)(@multiplicity?)/,
|
289
|
-
[
|
290
|
-
`${PURE_GRAMMAR_TOKEN.TYPE}.operator`,
|
291
|
-
PURE_GRAMMAR_TOKEN.WHITESPACE,
|
292
|
-
PURE_GRAMMAR_TOKEN.PACKAGE,
|
293
|
-
PURE_GRAMMAR_TOKEN.TYPE,
|
294
|
-
PURE_GRAMMAR_TOKEN.GENERICS,
|
295
|
-
PURE_GRAMMAR_TOKEN.MULTIPLICITY,
|
296
|
-
],
|
297
|
-
],
|
298
|
-
|
299
|
-
// property / parameter
|
300
|
-
[
|
301
|
-
/(\.\s*)(@identifier)/,
|
302
|
-
[PURE_GRAMMAR_TOKEN.DELIMITER, PURE_GRAMMAR_TOKEN.PROPERTY],
|
303
|
-
],
|
304
|
-
[
|
305
|
-
/(@identifier)(\s*=)/,
|
306
|
-
[PURE_GRAMMAR_TOKEN.PROPERTY, PURE_GRAMMAR_TOKEN.OPERATOR],
|
307
|
-
],
|
308
|
-
[
|
309
|
-
/(@identifier)(\.)(@identifier)/,
|
310
|
-
[
|
311
|
-
PURE_GRAMMAR_TOKEN.TYPE,
|
312
|
-
PURE_GRAMMAR_TOKEN.OPERATOR,
|
313
|
-
PURE_GRAMMAR_TOKEN.PROPERTY,
|
314
|
-
],
|
315
|
-
], // could be: property chain, profile tag, and stereotype
|
316
|
-
[
|
317
|
-
/(@identifier)(\s*:)/,
|
318
|
-
[PURE_GRAMMAR_TOKEN.PARAMETER, PURE_GRAMMAR_TOKEN.OPERATOR],
|
319
|
-
],
|
320
|
-
|
321
|
-
// variables
|
322
|
-
[
|
323
|
-
/(let)(\s+)(@identifier)(\s*=)/,
|
324
|
-
[
|
325
|
-
PURE_GRAMMAR_TOKEN.KEYWORD,
|
326
|
-
PURE_GRAMMAR_TOKEN.WHITESPACE,
|
327
|
-
PURE_GRAMMAR_TOKEN.VARIABLE,
|
328
|
-
PURE_GRAMMAR_TOKEN.OPERATOR,
|
329
|
-
],
|
330
|
-
],
|
331
|
-
[/(\$@identifier)/, [`${PURE_GRAMMAR_TOKEN.VARIABLE}.reference`]],
|
332
|
-
],
|
333
|
-
|
334
|
-
date: [
|
335
|
-
[/(%latest)/, [`${PURE_GRAMMAR_TOKEN.DATE}.latest`]],
|
336
|
-
[/(@date)/, [PURE_GRAMMAR_TOKEN.DATE]],
|
337
|
-
[/(@time)/, [`${PURE_GRAMMAR_TOKEN.DATE}.time`]],
|
338
|
-
],
|
339
|
-
|
340
|
-
color: [[/(#[0-9a-fA-F]{6})/, [PURE_GRAMMAR_TOKEN.COLOR]]],
|
341
|
-
|
342
|
-
number: [
|
343
|
-
[
|
344
|
-
/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,
|
345
|
-
`${PURE_GRAMMAR_TOKEN.NUMBER}.float`,
|
346
|
-
],
|
347
|
-
[
|
348
|
-
/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,
|
349
|
-
`${PURE_GRAMMAR_TOKEN.NUMBER}.float`,
|
350
|
-
],
|
351
|
-
[/0[xX](@hexdigits)[Ll]?/, `${PURE_GRAMMAR_TOKEN.NUMBER}.hex`],
|
352
|
-
[/0(@octaldigits)[Ll]?/, `${PURE_GRAMMAR_TOKEN.NUMBER}.octal`],
|
353
|
-
[/0[bB](@binarydigits)[Ll]?/, `${PURE_GRAMMAR_TOKEN.NUMBER}.binary`],
|
354
|
-
[/(@digits)[fFdD]/, `${PURE_GRAMMAR_TOKEN.NUMBER}.float`],
|
355
|
-
[/(@digits)[lL]?/, PURE_GRAMMAR_TOKEN.NUMBER],
|
356
|
-
],
|
357
|
-
|
358
|
-
whitespace: [
|
359
|
-
[/[ \t\r\n]+/, PURE_GRAMMAR_TOKEN.WHITESPACE],
|
360
|
-
[/\/\*\*(?!\/)/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`, '@doc'],
|
361
|
-
[/\/\*/, PURE_GRAMMAR_TOKEN.COMMENT, '@comment'],
|
362
|
-
[/\/\/.*$/, PURE_GRAMMAR_TOKEN.COMMENT],
|
363
|
-
],
|
364
|
-
|
365
|
-
comment: [
|
366
|
-
[/[^/*]+/, PURE_GRAMMAR_TOKEN.COMMENT],
|
367
|
-
// [/\/\*/, PURE_GRAMMAR_TOKEN.COMMENT, '@push' ], // nested comment not allowed :-(
|
368
|
-
// [/\/\*/, ${PURE_GRAMMAR_TOKEN.COMMENT}.invalid` ], // this breaks block comments in the shape of /* //*/
|
369
|
-
[/\*\//, PURE_GRAMMAR_TOKEN.COMMENT, '@pop'],
|
370
|
-
[/[/*]/, PURE_GRAMMAR_TOKEN.COMMENT],
|
371
|
-
],
|
372
|
-
|
373
|
-
// Identical copy of comment above, except for the addition of .doc
|
374
|
-
doc: [
|
375
|
-
[/[^/*]+/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`],
|
376
|
-
// [/\/\*/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`, '@push' ], // nested comment not allowed :-(
|
377
|
-
[/\/\*/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc.invalid`],
|
378
|
-
[/\*\//, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`, '@pop'],
|
379
|
-
[/[/*]/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`],
|
380
|
-
],
|
381
|
-
|
382
|
-
string: [
|
383
|
-
[/[^\\']+/, PURE_GRAMMAR_TOKEN.STRING],
|
384
|
-
[/@escapes/, `${PURE_GRAMMAR_TOKEN.STRING}.escape`],
|
385
|
-
[/\\./, `${PURE_GRAMMAR_TOKEN.STRING}.escape.invalid`],
|
386
|
-
[/'/, PURE_GRAMMAR_TOKEN.STRING, '@pop'],
|
387
|
-
],
|
388
|
-
|
389
|
-
characters: [
|
390
|
-
[/'[^\\']'/, PURE_GRAMMAR_TOKEN.STRING],
|
391
|
-
[
|
392
|
-
/(')(@escapes)(')/,
|
393
|
-
[
|
394
|
-
PURE_GRAMMAR_TOKEN.STRING,
|
395
|
-
`${PURE_GRAMMAR_TOKEN.STRING}.escape`,
|
396
|
-
PURE_GRAMMAR_TOKEN.STRING,
|
397
|
-
],
|
398
|
-
],
|
399
|
-
[/'/, `${PURE_GRAMMAR_TOKEN.STRING}.invalid`],
|
400
|
-
],
|
401
|
-
},
|
402
|
-
}) as monacoLanguagesAPI.IMonarchLanguage;
|
403
|
-
|
404
|
-
export function setupPureLanguageService(options?: {
|
405
|
-
extraKeywords?: string[] | undefined;
|
406
|
-
}): void {
|
407
|
-
monacoLanguagesAPI.register({ id: CODE_EDITOR_LANGUAGE.PURE });
|
408
|
-
monacoLanguagesAPI.setLanguageConfiguration(
|
409
|
-
CODE_EDITOR_LANGUAGE.PURE,
|
410
|
-
configuration,
|
411
|
-
);
|
412
|
-
monacoLanguagesAPI.setMonarchTokensProvider(
|
413
|
-
CODE_EDITOR_LANGUAGE.PURE,
|
414
|
-
generateLanguageMonarch(options?.extraKeywords ?? []),
|
415
|
-
);
|
416
|
-
}
|