@live-codes/browser-compilers 0.5.2 → 0.5.3
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/.eslintrc.js +1 -3
- package/dist/eslint/eslint.js +143 -0
- package/package.json +9 -10
- package/scripts/vendors.js +9 -36
- package/dist/monaco-editor/codicon-2HT6E3BE.ttf +0 -0
- package/dist/monaco-editor/css.worker.js +0 -65
- package/dist/monaco-editor/editor.worker.js +0 -6
- package/dist/monaco-editor/html.worker.js +0 -455
- package/dist/monaco-editor/json.worker.js +0 -38
- package/dist/monaco-editor/languages/astro.js +0 -1
- package/dist/monaco-editor/languages/clio.js +0 -1
- package/dist/monaco-editor/languages/imba.js +0 -1
- package/dist/monaco-editor/languages/wat.js +0 -1
- package/dist/monaco-editor/monaco-editor.css +0 -1
- package/dist/monaco-editor/monaco-editor.js +0 -800
- package/dist/monaco-editor/ts.worker.js +0 -35324
- package/vendor_modules/imports/monaco-editor.ts +0 -1
- package/vendor_modules/modules/monaco-languages/astro.ts +0 -222
- package/vendor_modules/modules/monaco-languages/clio.ts +0 -120
- package/vendor_modules/modules/monaco-languages/imba.ts +0 -1520
- package/vendor_modules/modules/monaco-languages/wat.ts +0 -710
|
@@ -1,1520 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
|
|
4
|
-
// from https://github.com/imba/imba.io/blob/master/scripts/lexer/grammar.imba
|
|
5
|
-
// and https://github.com/imba/imba.io/blob/master/src/repl/languages/imba.imba
|
|
6
|
-
|
|
7
|
-
function iter$__(a) {
|
|
8
|
-
let v;
|
|
9
|
-
return a ? ((v = a.toIterable) ? v.call(a) : a) : [];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/*body*/
|
|
13
|
-
const eolpop = [/^/, { token: '@rematch', next: '@pop' }];
|
|
14
|
-
const repop = { token: '@rematch', next: '@pop' };
|
|
15
|
-
const toodeep = { token: 'white.indent', next: '@>illegal_indent' };
|
|
16
|
-
|
|
17
|
-
const EOF = '§EOF§';
|
|
18
|
-
|
|
19
|
-
function regexify(array, pattern = '#') {
|
|
20
|
-
if (typeof array == 'string') {
|
|
21
|
-
array = array.split(' ');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let items = array.slice().sort(function (_0, _1) {
|
|
25
|
-
return _1.length - _0.length;
|
|
26
|
-
});
|
|
27
|
-
items = items.map(function (item) {
|
|
28
|
-
let escaped = item.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
|
|
29
|
-
return pattern.replace('#', escaped);
|
|
30
|
-
});
|
|
31
|
-
return new RegExp('(?:' + items.join('|') + ')');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function denter(indent, outdent, stay, o = {}) {
|
|
35
|
-
var v$φ;
|
|
36
|
-
|
|
37
|
-
if (indent == null) {
|
|
38
|
-
indent = toodeep;
|
|
39
|
-
} else if (indent == 1) {
|
|
40
|
-
indent = { next: '@>' };
|
|
41
|
-
} else if (indent == 2) {
|
|
42
|
-
indent = { next: '@>_indent&-_indent' };
|
|
43
|
-
} else if (typeof indent == 'string') {
|
|
44
|
-
indent = { next: indent };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (outdent == -1) {
|
|
48
|
-
outdent = repop;
|
|
49
|
-
}
|
|
50
|
-
if (stay == -1) {
|
|
51
|
-
stay = repop;
|
|
52
|
-
} else if (stay == 0) {
|
|
53
|
-
o.comment == null ? (o.comment = true) : o.comment;
|
|
54
|
-
|
|
55
|
-
stay = {};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
indent = Object.assign({ token: 'white.tabs' }, indent || {});
|
|
59
|
-
stay = Object.assign({ token: 'white.tabs' }, stay || {});
|
|
60
|
-
outdent = Object.assign({ token: '@rematch', next: '@pop' }, outdent || {});
|
|
61
|
-
|
|
62
|
-
let cases = {
|
|
63
|
-
'$1==$S2\t': indent,
|
|
64
|
-
'$1==$S2': {
|
|
65
|
-
cases: { '$1==$S6': stay, '@default': { token: '@rematch', switchTo: '@*$1' } },
|
|
66
|
-
},
|
|
67
|
-
'@default': outdent,
|
|
68
|
-
};
|
|
69
|
-
v$φ = 0;
|
|
70
|
-
for (let k of ['next', 'switchTo']) {
|
|
71
|
-
let v = v$φ++;
|
|
72
|
-
if (indent[k] && indent[k].indexOf('*') == -1) {
|
|
73
|
-
indent[k] += '*$1';
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// for own k,v of cases
|
|
78
|
-
let rule = [/^(\t*)(?=[^ \t\n])/, { cases: cases }];
|
|
79
|
-
if (o.comment) {
|
|
80
|
-
let clones = {};
|
|
81
|
-
for (let iφ = 0, keysφ = Object.keys(cases), lφ = keysφ.length, k, v; iφ < lφ; iφ++) {
|
|
82
|
-
k = keysφ[iφ];
|
|
83
|
-
v = cases[k];
|
|
84
|
-
let clone = Object.assign({}, v);
|
|
85
|
-
if (!clone.next && !clone.switchTo) {
|
|
86
|
-
clone.next = '@>_comment';
|
|
87
|
-
}
|
|
88
|
-
clones[k] = clone;
|
|
89
|
-
}
|
|
90
|
-
return [[/^(\t*)(?=#\s|#$)/, { cases: clones }], rule];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return rule;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const states = {
|
|
97
|
-
root: [
|
|
98
|
-
[/^@comment/, 'comment', '@>_comment'], // want to push this state _ before the token
|
|
99
|
-
[
|
|
100
|
-
/^(\t+)(?=[^\t\n])/,
|
|
101
|
-
{
|
|
102
|
-
cases: {
|
|
103
|
-
'$1==$S2\t': { token: 'white.indent', next: '@>_indent*$1' },
|
|
104
|
-
'@default': 'white.indent',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
'block_',
|
|
109
|
-
],
|
|
110
|
-
|
|
111
|
-
_comment: [
|
|
112
|
-
[/^([\t\s\n]*)$/, 'comment'],
|
|
113
|
-
[
|
|
114
|
-
/^(\t*)([\S\s]*)/,
|
|
115
|
-
{
|
|
116
|
-
cases: {
|
|
117
|
-
// same or deeper indentation
|
|
118
|
-
'$1~$S2\t*': { token: 'comment' },
|
|
119
|
-
'@default': { token: '@rematch', next: '@pop' },
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
[/[\S\s]+/, 'comment'],
|
|
124
|
-
],
|
|
125
|
-
|
|
126
|
-
illegal_indent: [denter()],
|
|
127
|
-
|
|
128
|
-
identifier_: [
|
|
129
|
-
[/\$\w+\$/, 'identifier.env'],
|
|
130
|
-
[/\$\d+/, 'identifier.special'],
|
|
131
|
-
[/\#+@id/, 'identifier.symbol'],
|
|
132
|
-
[/\¶@id/, 'ivar'], // imba1
|
|
133
|
-
[
|
|
134
|
-
/@id\!?/,
|
|
135
|
-
{
|
|
136
|
-
cases: {
|
|
137
|
-
this: 'this',
|
|
138
|
-
self: 'self',
|
|
139
|
-
'@keywords': 'keyword.$#',
|
|
140
|
-
'$0~[A-Z].*': 'identifier.uppercase.$F',
|
|
141
|
-
'@default': 'identifier.$F',
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
],
|
|
146
|
-
|
|
147
|
-
block_: [
|
|
148
|
-
// 'common_'
|
|
149
|
-
[/^(\t+)(?=[\r\n]|$)/, 'white.tabs'],
|
|
150
|
-
'class_',
|
|
151
|
-
'tagclass_',
|
|
152
|
-
'var_',
|
|
153
|
-
'func_',
|
|
154
|
-
'import_',
|
|
155
|
-
'export_',
|
|
156
|
-
'flow_',
|
|
157
|
-
'for_',
|
|
158
|
-
'try_',
|
|
159
|
-
'catch_',
|
|
160
|
-
'while_',
|
|
161
|
-
'css_',
|
|
162
|
-
'tag_',
|
|
163
|
-
'do_',
|
|
164
|
-
'block_comment_',
|
|
165
|
-
'expr_',
|
|
166
|
-
[/[ ]+/, 'white'],
|
|
167
|
-
'common_',
|
|
168
|
-
],
|
|
169
|
-
|
|
170
|
-
indentable_: [
|
|
171
|
-
[/^[ ]+/, 'white'],
|
|
172
|
-
denter('@>_paren_indent&-_indent', null, null),
|
|
173
|
-
[/^(\t+)(?=[\r\n]|$)/, 'white.tabs'],
|
|
174
|
-
'whitespace',
|
|
175
|
-
],
|
|
176
|
-
|
|
177
|
-
_indent: [denter(2, -1, 0), 'block_'],
|
|
178
|
-
|
|
179
|
-
_paren_indent: [denter(2, -1, 0), 'block_', [/\)|\}|\]/, '@rematch', '@pop']],
|
|
180
|
-
|
|
181
|
-
block: [denter('@>', -1, 0), 'block_'],
|
|
182
|
-
bool_: [[/(true|false|yes|no|undefined|null)(?![\:\-\w\.\_])/, 'boolean']],
|
|
183
|
-
|
|
184
|
-
op_: [
|
|
185
|
-
[/\s+\:\s+/, 'operator.ternary'],
|
|
186
|
-
// [/\s*(\=)/]
|
|
187
|
-
[
|
|
188
|
-
/(@unspaced_ops)/,
|
|
189
|
-
{
|
|
190
|
-
cases: {
|
|
191
|
-
'@spread': 'operator.spread',
|
|
192
|
-
'@access': 'operator.access',
|
|
193
|
-
'@default': 'operator',
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
[/\/(?!\/)/, 'operator.math'],
|
|
198
|
-
[/\&(?=[,\)])/, 'operator.special.blockparam'],
|
|
199
|
-
[
|
|
200
|
-
/(\s*)(@symbols)(\s*)/,
|
|
201
|
-
{
|
|
202
|
-
cases: {
|
|
203
|
-
'$2@assignments': 'operator.assign',
|
|
204
|
-
'$2@math': 'operator.math',
|
|
205
|
-
'$2@operators': 'operator',
|
|
206
|
-
'$2@logic': 'operator.logic',
|
|
207
|
-
'$2@access': 'operator.access',
|
|
208
|
-
'@default': 'delimiter',
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
[/\&\b/, 'operator'],
|
|
213
|
-
],
|
|
214
|
-
|
|
215
|
-
keyword_: [
|
|
216
|
-
[/new@B/, 'keyword.new'],
|
|
217
|
-
[/isa@B/, 'keyword.isa'],
|
|
218
|
-
[/is@B/, 'keyword.is'],
|
|
219
|
-
[/(switch|when|throw|continue|break|then|await|typeof|by)@B/, 'keyword.$1'],
|
|
220
|
-
[/delete@B/, 'keyword.delete'],
|
|
221
|
-
[/and@B|or@B/, 'operator.flow'],
|
|
222
|
-
],
|
|
223
|
-
|
|
224
|
-
return_: [[/return@B/, 'keyword.new']],
|
|
225
|
-
|
|
226
|
-
primitive_: ['string_', 'number_', 'regexp_', 'bool_'],
|
|
227
|
-
|
|
228
|
-
value_: [
|
|
229
|
-
'primitive_',
|
|
230
|
-
'keyword_',
|
|
231
|
-
'implicit_call_',
|
|
232
|
-
'parens_', // call will always capture?
|
|
233
|
-
'key_',
|
|
234
|
-
'access_',
|
|
235
|
-
'identifier_',
|
|
236
|
-
'array_',
|
|
237
|
-
'object_',
|
|
238
|
-
],
|
|
239
|
-
|
|
240
|
-
expr_: ['comment_', 'inline_var_', 'return_', 'value_', 'tag_', 'op_', 'type_', 'spread_'],
|
|
241
|
-
|
|
242
|
-
attr_expr_: [
|
|
243
|
-
'primitive_',
|
|
244
|
-
'parens_',
|
|
245
|
-
'access_',
|
|
246
|
-
'identifier_',
|
|
247
|
-
'array_',
|
|
248
|
-
'object_',
|
|
249
|
-
'tag_',
|
|
250
|
-
'op_',
|
|
251
|
-
],
|
|
252
|
-
|
|
253
|
-
access_: [
|
|
254
|
-
[
|
|
255
|
-
/(\.\.?)(@propid\!?)/,
|
|
256
|
-
{
|
|
257
|
-
cases: {
|
|
258
|
-
'$2~[A-Z].*': ['operator.access', 'accessor.uppercase'],
|
|
259
|
-
'$2~#.*': ['operator.access', 'accessor.symbol'],
|
|
260
|
-
'@default': ['operator.access', 'accessor'],
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
],
|
|
265
|
-
|
|
266
|
-
call_: [[/\(/, '(', '@call_body']],
|
|
267
|
-
|
|
268
|
-
key_: [
|
|
269
|
-
[/(\#+@id)(\:\s*)/, ['key.symbol', 'operator.assign.key-value']],
|
|
270
|
-
[
|
|
271
|
-
/(@propid)(\:\s*)/,
|
|
272
|
-
{
|
|
273
|
-
cases: {
|
|
274
|
-
'@default': ['key', 'operator.assign.key-value'],
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
],
|
|
279
|
-
|
|
280
|
-
implicit_call_: [
|
|
281
|
-
[
|
|
282
|
-
/(\.\.?)(@propid)@implicitCall/,
|
|
283
|
-
{
|
|
284
|
-
cases: {
|
|
285
|
-
'$2~[A-Z].*': ['operator.access', 'accessor.uppercase', '@implicit_call_body'],
|
|
286
|
-
'@default': ['operator.access', 'accessor', '@implicit_call_body'],
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
[
|
|
291
|
-
/(@propid)@implicitCall/,
|
|
292
|
-
{
|
|
293
|
-
cases: {
|
|
294
|
-
'$2~[A-Z].*': ['identifier.uppercase', '@implicit_call_body'],
|
|
295
|
-
'@default': ['identifier', '@implicit_call_body'],
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
],
|
|
299
|
-
],
|
|
300
|
-
|
|
301
|
-
implicit_call_body: [eolpop, [/\)|\}|\]|\>/, '@rematch', '@pop'], 'arglist_', 'whitespace'],
|
|
302
|
-
|
|
303
|
-
arglist_: ['do_', 'expr_', [/\s*\,\s*/, 'delimiter.comma']],
|
|
304
|
-
|
|
305
|
-
params_: [
|
|
306
|
-
[/\[/, 'array.[', '@array_var_body=decl-param'],
|
|
307
|
-
[/\{/, 'object.{', '@object_body=decl-param'],
|
|
308
|
-
[/(@variable)/, 'identifier.decl-param'],
|
|
309
|
-
// [/(\s*\=\s*)(?=(for|while|until|if|unless)\s)/,'operator','@pop']
|
|
310
|
-
'spread_',
|
|
311
|
-
'type_',
|
|
312
|
-
[/\s*\=\s*/, 'operator', '@var_value='],
|
|
313
|
-
[/\s*\,\s*/, 'separator'],
|
|
314
|
-
],
|
|
315
|
-
|
|
316
|
-
object_: [[/\{/, 'object.{', '@object_body']],
|
|
317
|
-
|
|
318
|
-
parens_: [[/\(/, 'parens.(', '@parens_body']],
|
|
319
|
-
|
|
320
|
-
parens_body: [[/\)/, ')', '@pop'], 'indentable_', 'arglist_'],
|
|
321
|
-
|
|
322
|
-
array_: [[/\[/, 'array.[', '@array_body']],
|
|
323
|
-
|
|
324
|
-
array_body: [
|
|
325
|
-
[/\]@implicitCall/, { token: ']', switchTo: '@implicit_call_body=' }],
|
|
326
|
-
[/\]/, ']', '@pop'],
|
|
327
|
-
[/\)|\}/, 'invalid'],
|
|
328
|
-
'indentable_',
|
|
329
|
-
'expr_',
|
|
330
|
-
[',', 'delimiter'],
|
|
331
|
-
],
|
|
332
|
-
|
|
333
|
-
object_body: [
|
|
334
|
-
[/\}/, '}', '@pop'],
|
|
335
|
-
[/(@id)(\s*:\s*)/, ['key', 'operator.assign.key-value', '@object_value']],
|
|
336
|
-
[/(@id)/, 'identifier.$F'],
|
|
337
|
-
[/\[/, '[', '@object_dynamic_key='], //
|
|
338
|
-
[/\s*=\s*/, 'operator.assign', '@object_value='],
|
|
339
|
-
[/:/, 'operator.assign.key-value', '@object_value='],
|
|
340
|
-
[/\,/, 'delimiter.comma'],
|
|
341
|
-
'indentable_',
|
|
342
|
-
'expr_',
|
|
343
|
-
],
|
|
344
|
-
|
|
345
|
-
object_value: [
|
|
346
|
-
eolpop,
|
|
347
|
-
// couldnt this be indented as well?
|
|
348
|
-
// [/(?=,|\})/, 'delimiter', '@pop']
|
|
349
|
-
[/,|\}|\]|\)/, '@rematch', '@pop'],
|
|
350
|
-
'expr_',
|
|
351
|
-
],
|
|
352
|
-
|
|
353
|
-
object_dynamic_key: [[']', ']', '@pop'], 'expr_'],
|
|
354
|
-
|
|
355
|
-
comment_: [[/#(\s.*)?(\n|$)/, 'comment']],
|
|
356
|
-
|
|
357
|
-
block_comment_: [[/###/, 'comment.start', '@_block_comment']],
|
|
358
|
-
|
|
359
|
-
_block_comment: [
|
|
360
|
-
[/###/, 'comment.end', '@pop'],
|
|
361
|
-
[/[^#]+/, 'comment'],
|
|
362
|
-
[/#(?!##)/, 'comment'],
|
|
363
|
-
],
|
|
364
|
-
|
|
365
|
-
// add try_start that accepts catch on the same line?
|
|
366
|
-
try_: [[/try@B/, 'keyword.try', '@>_try&try']],
|
|
367
|
-
|
|
368
|
-
catch_: [
|
|
369
|
-
[/(catch\s+)(?=@id(\s|$))/, 'keyword.catch', '@catch_start&catch'],
|
|
370
|
-
[/catch@B/, 'keyword.catch', '@catch_start&catch'],
|
|
371
|
-
],
|
|
372
|
-
|
|
373
|
-
catch_start: [
|
|
374
|
-
[/@id/, 'identifier.decl-const', { switchTo: '@>_catch' }],
|
|
375
|
-
[/.?/, '@rematch', { switchTo: '@>_catch' }],
|
|
376
|
-
],
|
|
377
|
-
|
|
378
|
-
_catch: [denter('@>block', -1, 0), 'block_'],
|
|
379
|
-
|
|
380
|
-
_try: [denter('@>block', -1, 0), 'block_'],
|
|
381
|
-
|
|
382
|
-
do_: [
|
|
383
|
-
// [/(do)(\()/,['keyword.do','(','@>_do_params&do']]
|
|
384
|
-
[/do(?=\()/, 'keyword.do', '@>do_start&do'],
|
|
385
|
-
[/do(?=\s*\|)/, 'keyword.do', '@>do_piped&do'],
|
|
386
|
-
[/do@B/, 'keyword.do', '@>_do&do'],
|
|
387
|
-
],
|
|
388
|
-
|
|
389
|
-
do_start: [
|
|
390
|
-
denter(null, -1, -1),
|
|
391
|
-
[/\(/, '(', { switchTo: '@_do_params' }],
|
|
392
|
-
[/./, '@rematch', { switchTo: '@_do' }],
|
|
393
|
-
],
|
|
394
|
-
|
|
395
|
-
do_piped: [
|
|
396
|
-
denter(null, -1, -1),
|
|
397
|
-
[/\s*\|/, 'args.open', { switchTo: '@_do_piped_params' }],
|
|
398
|
-
[/./, '@rematch', { switchTo: '@_do' }],
|
|
399
|
-
],
|
|
400
|
-
|
|
401
|
-
_do_piped_params: [[/\|/, 'args.close', { switchTo: '@_do' }], 'params_'],
|
|
402
|
-
|
|
403
|
-
_do_params: [[/\)/, ')', { switchTo: '@_do' }], 'params_'],
|
|
404
|
-
|
|
405
|
-
_do: [
|
|
406
|
-
denter(2, -1, 0),
|
|
407
|
-
// block in general, no?
|
|
408
|
-
[/(\}|\)|\])/, '@rematch', '@pop'],
|
|
409
|
-
'block_',
|
|
410
|
-
],
|
|
411
|
-
|
|
412
|
-
class_: [
|
|
413
|
-
[/(extend)(?=\s+class )/, 'keyword.$1'],
|
|
414
|
-
[/(global)(?=\s+class )/, 'keyword.$1'],
|
|
415
|
-
[
|
|
416
|
-
/(class)(\s)(@id)/,
|
|
417
|
-
['keyword.$1', 'white.$1name', 'entity.name.class.decl-const', '@class_start='],
|
|
418
|
-
],
|
|
419
|
-
[/(class)(?=\n)/, 'keyword.$1', '@>_class&class='],
|
|
420
|
-
],
|
|
421
|
-
|
|
422
|
-
class_start: [
|
|
423
|
-
[/(\s+\<\s+)(@id)/, ['keyword.extends', 'identifier.superclass']],
|
|
424
|
-
[/@comment/, 'comment'],
|
|
425
|
-
[/^/, '@rematch', { switchTo: '@>_class&class=' }],
|
|
426
|
-
],
|
|
427
|
-
|
|
428
|
-
tagclass_: [
|
|
429
|
-
[/(extend)(?=\s+tag )/, 'keyword.$1'],
|
|
430
|
-
[/(global)(?=\s+tag )/, 'keyword.$1'],
|
|
431
|
-
[
|
|
432
|
-
/(tag)(\s)(@constant)/,
|
|
433
|
-
['keyword.tag', 'white.tagname', 'entity.name.component.local', '@tagclass_start='],
|
|
434
|
-
], // only when uppercase
|
|
435
|
-
[
|
|
436
|
-
/(tag)(\s)(@id)/,
|
|
437
|
-
['keyword.tag', 'white.tagname', 'entity.name.component.global', '@tagclass_start='],
|
|
438
|
-
], // only when uppercase
|
|
439
|
-
],
|
|
440
|
-
|
|
441
|
-
tagclass_start: [
|
|
442
|
-
[/(\s+\<\s+)(@id)/, ['keyword.extends', 'identifier.superclass']],
|
|
443
|
-
[/@comment/, 'comment'],
|
|
444
|
-
[/^/, '@rematch', { switchTo: '@>_tagclass&component=' }],
|
|
445
|
-
],
|
|
446
|
-
|
|
447
|
-
import_: [
|
|
448
|
-
[/(import)(?=\s+['"])/, 'keyword.import', '@>import_source'],
|
|
449
|
-
[
|
|
450
|
-
/(import)(\s+type)(?=\s[\w\$\@\{])/,
|
|
451
|
-
['keyword.import', 'keyword.type', '@>import_body&-_imports=decl-import/part'],
|
|
452
|
-
],
|
|
453
|
-
[/(import)@B/, 'keyword.import', '@>import_body&-_imports=decl-import/part'],
|
|
454
|
-
],
|
|
455
|
-
|
|
456
|
-
import_body: [
|
|
457
|
-
denter(null, -1, 0),
|
|
458
|
-
[
|
|
459
|
-
/(@esmIdentifier)( +from)/,
|
|
460
|
-
['identifier.$F.default', 'keyword.from', { switchTo: '@import_source' }],
|
|
461
|
-
],
|
|
462
|
-
[
|
|
463
|
-
/(\*)(\s+as\s+)(@esmIdentifier)(\s+from)/,
|
|
464
|
-
[
|
|
465
|
-
'keyword.star',
|
|
466
|
-
'keyword.as',
|
|
467
|
-
'identifier.$F.ns',
|
|
468
|
-
'keyword.from',
|
|
469
|
-
{ switchTo: '@import_source' },
|
|
470
|
-
],
|
|
471
|
-
],
|
|
472
|
-
[
|
|
473
|
-
/(@esmIdentifier)(\s*,\s*)(\*)(\s+as\s+)(@esmIdentifier)(from)/,
|
|
474
|
-
[
|
|
475
|
-
'identifier.$F.default',
|
|
476
|
-
'delimiter.comma',
|
|
477
|
-
'keyword.star',
|
|
478
|
-
'keyword.as',
|
|
479
|
-
'identifier.$F.ns',
|
|
480
|
-
'keyword.from',
|
|
481
|
-
{ switchTo: '@import_source' },
|
|
482
|
-
],
|
|
483
|
-
],
|
|
484
|
-
// [/(\*)(\s+as\s+)(@esmIdentifier)/, ['keyword.star','keyword.as','identifier.const.import',switchTo: '@/delim']]
|
|
485
|
-
// [/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/, ['alias','keyword.as','identifier.const.import']]
|
|
486
|
-
[/\ *from/, 'keyword.from', { switchTo: '@import_source' }],
|
|
487
|
-
[/\{/, 'specifiers.{', '@esm_specifiers/part'],
|
|
488
|
-
[/(@esmIdentifier)/, 'identifier.$F', { switchTo: '@/delim' }],
|
|
489
|
-
[/\s*\,\s*/, 'delimiter.comma', { switchTo: '@/part' }],
|
|
490
|
-
'comma_',
|
|
491
|
-
'common_',
|
|
492
|
-
],
|
|
493
|
-
|
|
494
|
-
import_source: [denter(null, -1, 0), [/["']/, 'path.open', '@_path=$#'], eolpop],
|
|
495
|
-
|
|
496
|
-
export_: [
|
|
497
|
-
[/(export)( +)(default)@B/, ['keyword.export', 'white', 'keyword.default']], // ,'@>import_body'
|
|
498
|
-
[/(export)(?= +(let|const|var|class|tag)@B)/, 'keyword.export'], // ,'@>import_body'
|
|
499
|
-
[/(export)( +)(global)@B/, ['keyword.export', 'white', 'keyword.global']], // ,'@>import_body'
|
|
500
|
-
|
|
501
|
-
[
|
|
502
|
-
/(export)(\s+\*\s+)(from)@B/,
|
|
503
|
-
['keyword.export', 'operator.star', 'keyword.from', '@>import_source'],
|
|
504
|
-
],
|
|
505
|
-
[/(export)@B/, 'keyword.export', '@>export_body'],
|
|
506
|
-
],
|
|
507
|
-
|
|
508
|
-
export_body: [
|
|
509
|
-
denter(null, -1, 0),
|
|
510
|
-
[/(\*)(\s+as\s+)(@esmIdentifier)/, ['keyword.star', 'keyword.as', 'identifier.const.export']],
|
|
511
|
-
[/(@esmIdentifier)(\s+as\s+)(default)/, ['alias', 'keyword.as', 'alias.default']],
|
|
512
|
-
[
|
|
513
|
-
/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/,
|
|
514
|
-
['alias', 'keyword.as', 'identifier.const.export'],
|
|
515
|
-
],
|
|
516
|
-
[/from/, 'keyword.from', { switchTo: '@import_source' }],
|
|
517
|
-
[/\{/, '{', '@esm_specifiers=export/part'],
|
|
518
|
-
[/(@esmIdentifier)/, 'identifier.const.export'],
|
|
519
|
-
[/\*/, 'operator.star'],
|
|
520
|
-
'comma_',
|
|
521
|
-
'common_',
|
|
522
|
-
],
|
|
523
|
-
|
|
524
|
-
esm_specifiers: [
|
|
525
|
-
[/\}/, '}', '@pop'],
|
|
526
|
-
[
|
|
527
|
-
/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/,
|
|
528
|
-
['alias', 'keyword.as', 'identifier.const.$F', { switchTo: '@/delim' }],
|
|
529
|
-
],
|
|
530
|
-
[
|
|
531
|
-
/@esmIdentifier/,
|
|
532
|
-
{
|
|
533
|
-
cases: {
|
|
534
|
-
'$/==part': { token: 'identifier.const.$S4', switchTo: '@/delim' },
|
|
535
|
-
'@default': { token: 'invalid' },
|
|
536
|
-
},
|
|
537
|
-
},
|
|
538
|
-
],
|
|
539
|
-
[/\s*\,\s*/, 'delimiter.comma', { switchTo: '@/part' }],
|
|
540
|
-
'whitespace',
|
|
541
|
-
],
|
|
542
|
-
|
|
543
|
-
_path: [
|
|
544
|
-
[/[^"'\`\{\\]+/, 'path'],
|
|
545
|
-
[/@escapes/, 'path.escape'],
|
|
546
|
-
[/\./, 'path.escape.invalid'],
|
|
547
|
-
[/\{/, 'invalid'],
|
|
548
|
-
[/["'`]/, { cases: { '$#==$F': { token: 'path.close', next: '@pop' }, '@default': 'path' } }],
|
|
549
|
-
],
|
|
550
|
-
|
|
551
|
-
member_: [
|
|
552
|
-
// [/static(?=\s+(get|set|def) )/,'keyword.static'] # only in class and tagclass?
|
|
553
|
-
[/(constructor)@B/, 'entity.name.constructor', '@>def_params&def/def'],
|
|
554
|
-
[
|
|
555
|
-
/(def|get|set)(\s)(@defid)/,
|
|
556
|
-
['keyword.$1', 'white.entity', 'entity.name.$1', '@>def_params&$1/$1'],
|
|
557
|
-
],
|
|
558
|
-
[/(def|get|set)(\s)(\[)/, ['keyword.$1', 'white.entity', '$$', '@>def_dynamic_name/$1']],
|
|
559
|
-
],
|
|
560
|
-
|
|
561
|
-
func_: [
|
|
562
|
-
[/export(?=\s+(get|set|def|global) )/, 'keyword.export'], // only in class and tagclass?
|
|
563
|
-
[/global(?=\s+(get|set|def) )/, 'keyword.global'], // only in class and tagclass?
|
|
564
|
-
[
|
|
565
|
-
/(def)(\s)(@id)(\.)(@defid)/,
|
|
566
|
-
[
|
|
567
|
-
'keyword.$1',
|
|
568
|
-
'white.entity',
|
|
569
|
-
'identifier.target',
|
|
570
|
-
'operator',
|
|
571
|
-
'entity.name.def',
|
|
572
|
-
'@>def_params&$1/$1',
|
|
573
|
-
],
|
|
574
|
-
],
|
|
575
|
-
|
|
576
|
-
[
|
|
577
|
-
/(def)(\s)(@defid)/,
|
|
578
|
-
['keyword.$1', 'white.entity', 'entity.name.function.decl-const-func', '@>def_params&$1/$1'],
|
|
579
|
-
],
|
|
580
|
-
],
|
|
581
|
-
|
|
582
|
-
flow_: [
|
|
583
|
-
// [/(else)(?=\s|$)/, ['keyword.$1','@flow_start.$S2.flow.$S4']]
|
|
584
|
-
[/(if|else|elif|unless)(?=\s|$)/, ['keyword.$1', '@flow_start=$1']],
|
|
585
|
-
],
|
|
586
|
-
|
|
587
|
-
flow_start: [
|
|
588
|
-
denter({ switchTo: '@>_flow&$F' }, -1, -1),
|
|
589
|
-
// denter({switchTo: '@>_flow&-body'},-1,-1)
|
|
590
|
-
// denter('@>_flow&block',-1,-1)
|
|
591
|
-
[/[ \t]+/, 'white'],
|
|
592
|
-
'expr_',
|
|
593
|
-
],
|
|
594
|
-
|
|
595
|
-
for_: [
|
|
596
|
-
[/for(?: own)?@B/, 'keyword.$#', '@for_start&forscope=decl-for'],
|
|
597
|
-
// [/for@B/,'keyword.$#','@for_start&flow=let']
|
|
598
|
-
],
|
|
599
|
-
|
|
600
|
-
while_: [[/(while|until)@B/, 'keyword.$#', '@>while_body']],
|
|
601
|
-
while_body: [denter(2, -1, 0), 'block_'],
|
|
602
|
-
|
|
603
|
-
for_start: [
|
|
604
|
-
denter({ switchTo: '@>for_body' }, -1, -1),
|
|
605
|
-
[/\[/, 'array.[', '@array_var_body'],
|
|
606
|
-
[/\{/, 'object.{', '@object_body'], // object_var_body?
|
|
607
|
-
[/(@variable)/, 'identifier.$F'],
|
|
608
|
-
[/(\s*\,\s*)/, 'separator', '@=decl-for-index'],
|
|
609
|
-
[/\s(in|of)@B/, 'keyword.$1', { switchTo: '@>for_source=' }],
|
|
610
|
-
[/[ \t]+/, 'white'],
|
|
611
|
-
'type_',
|
|
612
|
-
],
|
|
613
|
-
for_source: [
|
|
614
|
-
denter({ switchTo: '@>for_body' }, -1, { switchTo: '@for_body' }),
|
|
615
|
-
'expr_',
|
|
616
|
-
[/[ \t]+/, 'white'],
|
|
617
|
-
],
|
|
618
|
-
|
|
619
|
-
for_body: [denter(2, -1, 0), 'block_'],
|
|
620
|
-
|
|
621
|
-
decorator_: [
|
|
622
|
-
[/(@decid)(\()/, ['decorator', '$2', '@_decorator_params']],
|
|
623
|
-
[/(@decid)/, 'decorator'],
|
|
624
|
-
],
|
|
625
|
-
|
|
626
|
-
_decorator_params: [[/\)/, ')', '@pop'], 'params_'],
|
|
627
|
-
|
|
628
|
-
field_: [
|
|
629
|
-
[
|
|
630
|
-
/((?:lazy )?)((?:static )?)(const|let|attr)(?=\s|$)/,
|
|
631
|
-
['keyword.lazy', 'keyword.static', 'keyword.$1', '@_vardecl=field-$3'],
|
|
632
|
-
], // $2_body.$S2.$2.$S4
|
|
633
|
-
[/(static\s+)(?=@fieldid)/, 'keyword.static'],
|
|
634
|
-
[/(@fieldid)(?=$)/, 'entity.name.field'],
|
|
635
|
-
[/(@fieldid)/, ['entity.name.field', '@_field_1']],
|
|
636
|
-
],
|
|
637
|
-
|
|
638
|
-
_field_1: [
|
|
639
|
-
denter(null, -1, -1),
|
|
640
|
-
'type_',
|
|
641
|
-
[/(\s*=)(?!\=)/, ['operator.assign', '@>_field_value&field']],
|
|
642
|
-
[/(\s*(?:\@)set\s*)/, ['keyword.spy', '@>_def&spy']],
|
|
643
|
-
],
|
|
644
|
-
|
|
645
|
-
_field_value: [
|
|
646
|
-
denter(2, -1, 0),
|
|
647
|
-
'block_', // sure?
|
|
648
|
-
[/(\s*(?:\@)set\s*)/, ['@rematch', '@pop']],
|
|
649
|
-
],
|
|
650
|
-
|
|
651
|
-
var_: [
|
|
652
|
-
[
|
|
653
|
-
/((?:export )?)(const|let)(?=\s[\[\{\$a-zA-Z]|\s*$)/,
|
|
654
|
-
['keyword.export', 'keyword.$1', '@_vardecl=decl-$2'],
|
|
655
|
-
], // $2_body.$S2.$2.$S4
|
|
656
|
-
[/((?:export )?)(const|let)(?=\s|$)/, ['keyword.export', 'keyword.$1']],
|
|
657
|
-
],
|
|
658
|
-
|
|
659
|
-
inline_var_: [
|
|
660
|
-
[/(const|let)(?=\s[\[\{\$a-zA-Z]|\s*$)/, ['keyword.$1', '@inline_var_body=decl-$1']],
|
|
661
|
-
],
|
|
662
|
-
|
|
663
|
-
string_: [
|
|
664
|
-
[/"""/, 'string', '@_herestring="""'],
|
|
665
|
-
[/'''/, 'string', "@_herestring='''"],
|
|
666
|
-
[/["'`]/, 'string.open', '@_string=$#'],
|
|
667
|
-
],
|
|
668
|
-
|
|
669
|
-
number_: [
|
|
670
|
-
[/0[xX][0-9a-fA-F_]+/, 'number.hex'],
|
|
671
|
-
[/0[b][01_]+/, 'number.binary'],
|
|
672
|
-
[/0[o][0-9_]+/, 'number.octal'],
|
|
673
|
-
[/(\d+)([a-z]+|\%)/, ['number', 'unit']],
|
|
674
|
-
[/(\d*\.\d+(?:[eE][\-+]?\d+)?)([a-z]+|\%)/, ['number.float', 'unit']],
|
|
675
|
-
[/\d+[eE]([\-+]?\d+)?/, 'number.float'],
|
|
676
|
-
[/\d[\d_]*\.\d[\d_]*([eE][\-+]?\d+)?/, 'number.float'],
|
|
677
|
-
[/\d[\d_]*/, 'number.integer'],
|
|
678
|
-
[/0[0-7]+(?!\d)/, 'number.octal'],
|
|
679
|
-
[/\d+/, 'number'],
|
|
680
|
-
],
|
|
681
|
-
|
|
682
|
-
_string: [
|
|
683
|
-
[/[^"'\`\{\\]+/, 'string'],
|
|
684
|
-
[/@escapes/, 'string.escape'],
|
|
685
|
-
[/\./, 'string.escape.invalid'],
|
|
686
|
-
[
|
|
687
|
-
/\{/,
|
|
688
|
-
{
|
|
689
|
-
cases: {
|
|
690
|
-
"$F=='": 'string',
|
|
691
|
-
'@default': { token: 'string.bracket.open', next: '@interpolation_body' },
|
|
692
|
-
},
|
|
693
|
-
},
|
|
694
|
-
],
|
|
695
|
-
[
|
|
696
|
-
/["'`]/,
|
|
697
|
-
{ cases: { '$#==$F': { token: 'string.close', next: '@pop' }, '@default': 'string' } },
|
|
698
|
-
],
|
|
699
|
-
[/#/, 'string'],
|
|
700
|
-
],
|
|
701
|
-
|
|
702
|
-
_herestring: [
|
|
703
|
-
[/("""|''')/, { cases: { '$1==$F': { token: 'string', next: '@pop' }, '@default': 'string' } }],
|
|
704
|
-
[/[^#\\'"\{]+/, 'string'],
|
|
705
|
-
[/['"]+/, 'string'],
|
|
706
|
-
[/@escapes/, 'string.escape'],
|
|
707
|
-
[/\./, 'string.escape.invalid'],
|
|
708
|
-
[
|
|
709
|
-
/\{/,
|
|
710
|
-
{
|
|
711
|
-
cases: {
|
|
712
|
-
'$F=="""': { token: 'string', next: '@interpolation_body' },
|
|
713
|
-
'@default': 'string',
|
|
714
|
-
},
|
|
715
|
-
},
|
|
716
|
-
],
|
|
717
|
-
[/#/, 'string'],
|
|
718
|
-
],
|
|
719
|
-
|
|
720
|
-
interpolation_body: [[/\}/, 'string.bracket.close', '@pop'], 'expr_'],
|
|
721
|
-
|
|
722
|
-
_class: [
|
|
723
|
-
denter(toodeep, -1, 0),
|
|
724
|
-
// 'var_'
|
|
725
|
-
'css_',
|
|
726
|
-
'member_',
|
|
727
|
-
'comment_',
|
|
728
|
-
'decorator_',
|
|
729
|
-
[/(get|set|def|static|prop|attr)@B/, 'keyword.$0'],
|
|
730
|
-
'field_',
|
|
731
|
-
'common_',
|
|
732
|
-
],
|
|
733
|
-
|
|
734
|
-
_tagclass: [
|
|
735
|
-
'_class',
|
|
736
|
-
[/(?=\<self)/, 'entity.name.def.render', '@_render&def'],
|
|
737
|
-
// self def
|
|
738
|
-
],
|
|
739
|
-
|
|
740
|
-
def_params: [
|
|
741
|
-
// denter({switchTo: '@>_def'},-1,{switchTo: '@>_def'})
|
|
742
|
-
[/\(/, '(', '@def_parens'],
|
|
743
|
-
[/^/, '@rematch', { switchTo: '@_def' }],
|
|
744
|
-
[/do@B/, 'keyword.do', { switchTo: '@_def' }],
|
|
745
|
-
'params_',
|
|
746
|
-
[/@comment/, 'comment'],
|
|
747
|
-
],
|
|
748
|
-
|
|
749
|
-
def_parens: [[/\)/, ')', '@pop'], 'params_'],
|
|
750
|
-
|
|
751
|
-
def_dynamic_name: [[']', { token: 'square.close', switchTo: '@def_params&$/' }], 'expr_'],
|
|
752
|
-
|
|
753
|
-
_render: [denter(2, -1, -1), 'block_'],
|
|
754
|
-
|
|
755
|
-
_def: [denter(2, -1, 0), 'block_'],
|
|
756
|
-
|
|
757
|
-
_flow: [denter(2, -1, 0), 'block_'],
|
|
758
|
-
|
|
759
|
-
_varblock: [
|
|
760
|
-
denter(1, -1, -1),
|
|
761
|
-
[/\[/, 'array.[', '@array_var_body'],
|
|
762
|
-
[/\{/, 'object.{', '@object_body'],
|
|
763
|
-
[/(@variable)/, 'identifier.$F'],
|
|
764
|
-
[/\s*\,\s*/, 'separator'],
|
|
765
|
-
[/(\s*\=\s*)(?=(for|while|until|if|unless|try)\s)/, 'operator', '@pop'],
|
|
766
|
-
[/(\s*\=\s*)/, 'operator', '@var_value='],
|
|
767
|
-
'type_',
|
|
768
|
-
[/#(\s.*)?\n?$/, 'comment'],
|
|
769
|
-
],
|
|
770
|
-
|
|
771
|
-
_vardecl: [
|
|
772
|
-
denter(null, -1, -1),
|
|
773
|
-
[/\[/, 'array.[', '@array_var_body'],
|
|
774
|
-
[/\{/, 'object.{', '@object_body'],
|
|
775
|
-
[/(@variable)(?=\n|,|$)/, 'identifier.$F', '@pop'],
|
|
776
|
-
[/(@variable)/, 'identifier.$F'],
|
|
777
|
-
[/(\s*\=\s*)/, 'operator.declval', { switchTo: '@var_value&value=' }], // ,switchTo: '@var_value='
|
|
778
|
-
'type_',
|
|
779
|
-
],
|
|
780
|
-
|
|
781
|
-
array_var_body: [
|
|
782
|
-
[/\]/, ']', '@pop'],
|
|
783
|
-
[/\{/, 'object.{', '@object_body'],
|
|
784
|
-
[/\[/, 'array.[', '@array_var_body'],
|
|
785
|
-
'spread_',
|
|
786
|
-
[/(@variable)/, 'identifier.$F'],
|
|
787
|
-
[/(\s*\=\s*)/, 'operator.assign', '@array_var_body_value='],
|
|
788
|
-
// 'expr_'
|
|
789
|
-
[',', 'delimiter'],
|
|
790
|
-
],
|
|
791
|
-
|
|
792
|
-
array_var_body_value: [[/(?=,|\)|]|})/, 'delimiter', '@pop'], 'expr_'],
|
|
793
|
-
|
|
794
|
-
inline_var_body: [
|
|
795
|
-
[/\[/, 'array.[', '@array_var_body'],
|
|
796
|
-
[/\{/, 'object.{', '@object_body'],
|
|
797
|
-
[/(@variable)/, 'identifier.$F'],
|
|
798
|
-
[/(\s*\=\s*)/, 'operator', '@pop'], // ,switchTo: '@var_value='
|
|
799
|
-
'type_',
|
|
800
|
-
],
|
|
801
|
-
|
|
802
|
-
var_value: [
|
|
803
|
-
[/(?=,|\)|]|})/, 'delimiter', '@pop'],
|
|
804
|
-
denter({ switchTo: '@>block' }, -1, -1),
|
|
805
|
-
'block_',
|
|
806
|
-
// 'do_'
|
|
807
|
-
// 'expr_'
|
|
808
|
-
// 'common_'
|
|
809
|
-
],
|
|
810
|
-
|
|
811
|
-
common_: [[/^(\t+)(?=\n|$)/, 'white.tabs'], 'whitespace'],
|
|
812
|
-
comma_: [[/\s*,\s*/, 'delimiter.comma']],
|
|
813
|
-
|
|
814
|
-
spread_: [[/\.\.\./, 'operator.spread']],
|
|
815
|
-
|
|
816
|
-
type_: [[/\\/, '@rematch', '@_type&-_type/0']],
|
|
817
|
-
|
|
818
|
-
_type: [
|
|
819
|
-
denter(-1, -1, -1),
|
|
820
|
-
[/\\/, 'delimiter.type.prefix'],
|
|
821
|
-
// these should probably stack and pair
|
|
822
|
-
[/\[/, 'delimiter.type', '@/]'],
|
|
823
|
-
[/\(/, 'delimiter.type', '@/)'],
|
|
824
|
-
[/\{/, 'delimiter.type', '@/}'],
|
|
825
|
-
[/\</, 'delimiter.type', '@/>'],
|
|
826
|
-
[/\|/, 'delimiter.type.union'],
|
|
827
|
-
[
|
|
828
|
-
/\,|\s|\=|\./,
|
|
829
|
-
{
|
|
830
|
-
cases: {
|
|
831
|
-
'$/==0': { token: '@rematch', next: '@pop' },
|
|
832
|
-
'@default': 'type',
|
|
833
|
-
},
|
|
834
|
-
},
|
|
835
|
-
],
|
|
836
|
-
[
|
|
837
|
-
/[\]\}\)\>]/,
|
|
838
|
-
{
|
|
839
|
-
cases: {
|
|
840
|
-
'$#==$/': { token: 'delimiter.type', next: '@pop' },
|
|
841
|
-
'@default': { token: '@rematch', next: '@pop' },
|
|
842
|
-
},
|
|
843
|
-
},
|
|
844
|
-
],
|
|
845
|
-
[/[\w\-\$]+/, 'type'],
|
|
846
|
-
],
|
|
847
|
-
|
|
848
|
-
css_: [
|
|
849
|
-
[/global(?=\s+css@B)/, 'keyword.$#'],
|
|
850
|
-
[/css(?:\s+)?/, 'keyword.css', '@>css_selector&rule-_sel'],
|
|
851
|
-
],
|
|
852
|
-
|
|
853
|
-
sel_: [
|
|
854
|
-
[/(\%)((?:@id)?)/, ['style.selector.mixin.prefix', 'style.selector.mixin']],
|
|
855
|
-
[/(\@)(\.{0,2}[\w\-\<\>\!]*\+?)/, 'style.selector.modifier'],
|
|
856
|
-
[/(\@)(\.{0,2}[\w\-\<\>\!]*)/, 'style.selector.modifier'],
|
|
857
|
-
[/\.([\w\-]+)/, 'style.selector.class-name'],
|
|
858
|
-
[/\#([\w\-]+)/, 'style.selector.id'],
|
|
859
|
-
[/([\w\-]+)/, 'style.selector.element'],
|
|
860
|
-
[/(>+|~|\+)/, 'style.selector.operator'],
|
|
861
|
-
[/(\*+)/, 'style.selector.element.any'],
|
|
862
|
-
[/(\$)((?:@id)?)/, ['style.selector.reference.prefix', 'style.selector.reference']],
|
|
863
|
-
[/\&/, 'style.selector.context'],
|
|
864
|
-
[/\(/, 'delimiter.selector.parens.open', '@css_selector_parens'],
|
|
865
|
-
[/\[/, 'delimiter.selector.attr.open', '@css_selector_attr'],
|
|
866
|
-
[/\s+/, 'white'],
|
|
867
|
-
[/,/, 'style.selector.delimiter'],
|
|
868
|
-
[/#(\s.*)?\n?$/, 'comment'],
|
|
869
|
-
],
|
|
870
|
-
|
|
871
|
-
css_props: [
|
|
872
|
-
denter(null, -1, 0),
|
|
873
|
-
[/(?=@cssPropertyKey2)/, '', '@css_property&-_styleprop-_stylepropkey'],
|
|
874
|
-
[/#(\s.*)?\n?$/, 'comment'],
|
|
875
|
-
[/(?=[\%\*\w\&\$\>\.\[\@\!]|\#[\w\-])/, '', '@>css_selector&rule-_sel'],
|
|
876
|
-
[/\s+/, 'white'],
|
|
877
|
-
],
|
|
878
|
-
|
|
879
|
-
css_selector: [
|
|
880
|
-
denter({ switchTo: '@css_props' }, -1, { token: '@rematch', switchTo: '@css_props&_props' }),
|
|
881
|
-
[/(\}|\)|\])/, '@rematch', '@pop'],
|
|
882
|
-
[/(?=\s*@cssPropertyKey2)/, '', { switchTo: '@css_props&_props' }],
|
|
883
|
-
[/\s*#\s/, '@rematch', { switchTo: '@css_props&_props' }],
|
|
884
|
-
'sel_',
|
|
885
|
-
],
|
|
886
|
-
|
|
887
|
-
css_inline: [
|
|
888
|
-
[/\]/, 'style.close', '@pop'],
|
|
889
|
-
[/(?=@cssPropertyKey2)/, '', '@css_property&-_styleprop-_stylepropkey'],
|
|
890
|
-
[/(?=@cssPropertyPath\])/, '', '@css_property&-_styleprop-_stylepropkey'],
|
|
891
|
-
],
|
|
892
|
-
|
|
893
|
-
css_selector_parens: [[/\)/, 'delimiter.selector.parens.close', '@pop'], 'sel_'],
|
|
894
|
-
|
|
895
|
-
css_selector_attr: [[/\]/, 'delimiter.selector.parens.close', '@pop'], 'sel_'],
|
|
896
|
-
|
|
897
|
-
css_property: [
|
|
898
|
-
denter(null, -1, -1),
|
|
899
|
-
[/\]/, '@rematch', '@pop'],
|
|
900
|
-
[/(\d+)(@id)/, ['style.property.unit.number', 'style.property.unit.name']],
|
|
901
|
-
[/((--|\$)@id)/, 'style.property.var'],
|
|
902
|
-
[/(-*@id)/, 'style.property.name'],
|
|
903
|
-
// [/(\@+)([\>\<\!]?[\w\-]+)/, ['style.property.modifier.start','style.property.modifier']]
|
|
904
|
-
[/@cssModifier/, 'style.property.modifier'],
|
|
905
|
-
[/(\@+|\.+)(@id\-?)/, ['style.property.modifier.start', 'style.property.modifier']],
|
|
906
|
-
[/\+(@id)/, 'style.property.scope'],
|
|
907
|
-
[
|
|
908
|
-
/\s*([\:]\s*)(?=@br|$)/,
|
|
909
|
-
'style.property.operator',
|
|
910
|
-
{ switchTo: '@>css_multiline_value&_stylevalue' },
|
|
911
|
-
],
|
|
912
|
-
[/\s*([\:]\s*)/, 'style.property.operator', { switchTo: '@>css_value&_stylevalue' }],
|
|
913
|
-
],
|
|
914
|
-
|
|
915
|
-
css_value_: [
|
|
916
|
-
[/(x?xs|sm\-?|md\-?|lg\-?|xx*l|\dxl|hg|x+h)\b/, 'style.value.size'],
|
|
917
|
-
[/\#[0-9a-fA-F]+/, 'style.value.color.hex'],
|
|
918
|
-
[/((--|\$)@id)/, 'style.value.var'],
|
|
919
|
-
[
|
|
920
|
-
/(@optid)(\@+|\.+)(@optid)/,
|
|
921
|
-
['style.property.name', 'style.property.modifier.prefix', 'style.property.modifier'],
|
|
922
|
-
],
|
|
923
|
-
'op_',
|
|
924
|
-
'string_',
|
|
925
|
-
'number_',
|
|
926
|
-
'comment_',
|
|
927
|
-
[/\s+/, 'style.value.white'],
|
|
928
|
-
[/\(/, 'delimiter.style.parens.open', '@css_expressions'],
|
|
929
|
-
[/\{/, 'delimiter.style.curly.open', '@css_interpolation&-_styleinterpolation'],
|
|
930
|
-
[/(@id)/, 'style.value'],
|
|
931
|
-
],
|
|
932
|
-
|
|
933
|
-
css_value: [
|
|
934
|
-
denter({ switchTo: '@>css_multiline_value' }, -1, -1),
|
|
935
|
-
// [/@cssModifier/, '@rematch', '@pop']
|
|
936
|
-
[/@cssPropertyKey2/, '@rematch', '@pop'],
|
|
937
|
-
[/;/, 'style.delimiter', '@pop'],
|
|
938
|
-
[/(\}|\)|\])/, '@rematch', '@pop'],
|
|
939
|
-
'css_value_',
|
|
940
|
-
],
|
|
941
|
-
|
|
942
|
-
css_multiline_value: [denter(null, -1, 0), [/@cssPropertyKey2/, 'invalid'], 'css_value_'],
|
|
943
|
-
|
|
944
|
-
css_expressions: [
|
|
945
|
-
[/\)/, 'delimiter.style.parens.close', '@pop'],
|
|
946
|
-
[/\(/, 'delimiter.style.parens.open', '@css_expressions'],
|
|
947
|
-
'css_value',
|
|
948
|
-
],
|
|
949
|
-
|
|
950
|
-
css_interpolation: [[/\}/, 'delimiter.style.curly.close', '@pop'], 'expr_'],
|
|
951
|
-
|
|
952
|
-
expressions: [[/\,/, 'delimiter.comma']],
|
|
953
|
-
|
|
954
|
-
whitespace: [
|
|
955
|
-
[/[\r\n]+/, 'br'],
|
|
956
|
-
[/[ \t\r\n]+/, 'white'],
|
|
957
|
-
],
|
|
958
|
-
|
|
959
|
-
space: [[/[ \t]+/, 'white']],
|
|
960
|
-
|
|
961
|
-
tag_: [
|
|
962
|
-
[/(\s*)(<)(?=\.)/, ['white', 'tag.open', '@_tag/flag']],
|
|
963
|
-
[/(\s*)(<)(?=\w|\{|\[|\%|\#|>)/, ['white', 'tag.open', '@_tag/name']],
|
|
964
|
-
],
|
|
965
|
-
tag_content: [
|
|
966
|
-
denter(2, -1, 0),
|
|
967
|
-
[/\)|\}|\]/, '@rematch', '@pop'],
|
|
968
|
-
'common_',
|
|
969
|
-
'flow_',
|
|
970
|
-
'var_',
|
|
971
|
-
'for_',
|
|
972
|
-
'css_',
|
|
973
|
-
'expr_',
|
|
974
|
-
'do_',
|
|
975
|
-
// dont support object keys directly here
|
|
976
|
-
],
|
|
977
|
-
|
|
978
|
-
tag_children: [],
|
|
979
|
-
|
|
980
|
-
_tag: [
|
|
981
|
-
[/\/>/, 'tag.close', '@pop'],
|
|
982
|
-
[/>/, 'tag.close', { switchTo: '@>tag_content=&-_tagcontent' }],
|
|
983
|
-
// '@>css_selector&rule-_sel'
|
|
984
|
-
[/>/, 'tag.close', '@pop'],
|
|
985
|
-
[/(\-?\d+)/, 'tag.$S3'],
|
|
986
|
-
[/(\%)(@id)/, ['tag.mixin.prefix', 'tag.mixin']],
|
|
987
|
-
[/\#@id/, 'tag.id'],
|
|
988
|
-
|
|
989
|
-
[
|
|
990
|
-
/\./,
|
|
991
|
-
{
|
|
992
|
-
cases: {
|
|
993
|
-
'$/==event': { token: 'tag.event-modifier.start', switchTo: '@/event-modifier' },
|
|
994
|
-
'$/==event-modifier': { token: 'tag.event-modifier.start', switchTo: '@/event-modifier' },
|
|
995
|
-
'$/==modifier': { token: 'tag.modifier.start', switchTo: '@/modifier' },
|
|
996
|
-
'$/==rule': { token: 'tag.rule-modifier.start', switchTo: '@/rule-modifier' },
|
|
997
|
-
'$/==rule-modifier': { token: 'tag.rule-modifier.start', switchTo: '@/rule-modifier' },
|
|
998
|
-
'@default': { token: 'tag.flag.start', switchTo: '@/flag' },
|
|
999
|
-
},
|
|
1000
|
-
},
|
|
1001
|
-
],
|
|
1002
|
-
|
|
1003
|
-
[
|
|
1004
|
-
/(\$@id)/,
|
|
1005
|
-
{
|
|
1006
|
-
cases: {
|
|
1007
|
-
'$/==name': 'tag.reference',
|
|
1008
|
-
'@default': 'tag.$/',
|
|
1009
|
-
},
|
|
1010
|
-
},
|
|
1011
|
-
],
|
|
1012
|
-
|
|
1013
|
-
[/\{/, 'tag.$/.interpolation.open', '@_tag_interpolation'],
|
|
1014
|
-
[/\[/, 'style.open', '@css_inline'],
|
|
1015
|
-
[/(\s*\=\s*)/, 'operator.equals.tagop.tag-$/', '@_tag_value&-value'],
|
|
1016
|
-
[/\:/, { token: 'tag.event.start', switchTo: '@/event' }],
|
|
1017
|
-
'tag_event_',
|
|
1018
|
-
// 'tag_attr_'
|
|
1019
|
-
[
|
|
1020
|
-
/(\-?@tagIdentifier)(\:@id)?/,
|
|
1021
|
-
{
|
|
1022
|
-
cases: {
|
|
1023
|
-
'$/==attr': { token: '@rematch', next: '@_tag_attr&-_tagattr' },
|
|
1024
|
-
'@default': { token: 'tag.$/' },
|
|
1025
|
-
},
|
|
1026
|
-
},
|
|
1027
|
-
],
|
|
1028
|
-
// [/\@/,token: 'tag.event.start', switchTo: '@/event']
|
|
1029
|
-
// [/\{/,token: 'tag.$/.braces.open', next: '@_tag_interpolation/0']
|
|
1030
|
-
[/\(/, { token: 'tag.$/.parens.open', next: '@_tag_parens/0' }],
|
|
1031
|
-
[/\s+/, { token: 'tag.white', switchTo: '@/attr' }],
|
|
1032
|
-
'comment_',
|
|
1033
|
-
],
|
|
1034
|
-
tag_event_: [
|
|
1035
|
-
// add an additional slot for name etc?
|
|
1036
|
-
// [/(\@)(@optid)/,['tag.event.start','tag.event.name','@_tag_event&_tagevent/$2']]
|
|
1037
|
-
[/(?=\@@optid)/, '', '@_tag_event&-_listener'],
|
|
1038
|
-
],
|
|
1039
|
-
|
|
1040
|
-
_tag_part: [[/\)|\}|\]|\>/, '@rematch', '@pop']],
|
|
1041
|
-
_tag_event: [
|
|
1042
|
-
'_tag_part',
|
|
1043
|
-
[/(\@)(@optid)/, ['tag.event.start', 'tag.event.name']],
|
|
1044
|
-
[/(\.)(@optid)/, ['tag.event-modifier.start', 'tag.event-modifier.name']],
|
|
1045
|
-
[/\(/, { token: 'tag.$/.parens.open', next: '@_tag_parens/0' }],
|
|
1046
|
-
[/(\s*\=\s*)/, 'operator.equals.tagop.tag-$/', '@_tag_value&handler'],
|
|
1047
|
-
[/\s+/, '@rematch', '@pop'],
|
|
1048
|
-
],
|
|
1049
|
-
|
|
1050
|
-
tag_attr_: [
|
|
1051
|
-
// add an additional slot for name etc?
|
|
1052
|
-
// [/(\@)(@optid)/,['tag.event.start','tag.event.name','@_tag_event&_tagevent/$2']]
|
|
1053
|
-
[/(?=@tagIdentifier(\:@id)?)/, '', '@_tag_attr&-_attribute'],
|
|
1054
|
-
],
|
|
1055
|
-
|
|
1056
|
-
_tag_attr: [
|
|
1057
|
-
'_tag_part',
|
|
1058
|
-
[/(\-?@tagIdentifier)(\:@id)?/, 'tag.attr'],
|
|
1059
|
-
[/\.(@optid)/, 'tag.event-modifierzz'],
|
|
1060
|
-
[/\(/, { token: 'tag.parens.open.$/', next: '@_tag_parens/0' }],
|
|
1061
|
-
[/(\s*\=\s*)/, 'operator.equals.tagop.tag-$/', '@_tag_value&-tagattrvalue'],
|
|
1062
|
-
[/\s+/, '@rematch', '@pop'],
|
|
1063
|
-
],
|
|
1064
|
-
|
|
1065
|
-
_tag_interpolation: [[/\}/, 'tag.$/.interpolation.close', '@pop'], 'expr_', [/\)|\]/, 'invalid']],
|
|
1066
|
-
|
|
1067
|
-
_tag_parens: [[/\)/, 'tag.$/.parens.close', '@pop'], 'arglist_', [/\]|\}/, 'invalid']],
|
|
1068
|
-
|
|
1069
|
-
_tag_value: [[/(?=(\/?\>|\s))/, '', '@pop'], 'attr_expr_'],
|
|
1070
|
-
|
|
1071
|
-
regexp_: [
|
|
1072
|
-
[
|
|
1073
|
-
/\/(?!\ )(?=([^\\\/]|\\.)+\/)/,
|
|
1074
|
-
{ token: 'regexp.slash.open', bracket: '@open', next: '@_regexp' },
|
|
1075
|
-
],
|
|
1076
|
-
[/\/\/\//, { token: 'regexp.slash.open', bracket: '@open', next: '@_hereregexp' }],
|
|
1077
|
-
[/(\/)(\/)/, ['regexp.slash.open', 'regexp.slash.close']],
|
|
1078
|
-
],
|
|
1079
|
-
|
|
1080
|
-
_regexp: [
|
|
1081
|
-
[
|
|
1082
|
-
/(\{)(\d+(?:,\d*)?)(\})/,
|
|
1083
|
-
['regexp.escape.control', 'regexp.escape.control', 'regexp.escape.control'],
|
|
1084
|
-
],
|
|
1085
|
-
[
|
|
1086
|
-
/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
|
|
1087
|
-
['regexp.escape.control', { token: 'regexp.escape.control', next: '@_regexrange' }],
|
|
1088
|
-
],
|
|
1089
|
-
[/(\()(\?:|\?=|\?!)/, ['regexp.escape.control', 'regexp.escape.control']],
|
|
1090
|
-
[/[()]/, 'regexp.escape.control'],
|
|
1091
|
-
[/@regexpctl/, 'regexp.escape.control'],
|
|
1092
|
-
[/[^\\\/]/, 'regexp'],
|
|
1093
|
-
[/@regexpesc/, 'regexp.escape'],
|
|
1094
|
-
[/\\:/, 'regexp.escape'],
|
|
1095
|
-
[/\\\./, 'regexp.invalid'],
|
|
1096
|
-
[/(\/)(\w+)/, [{ token: 'regexp.slash.close' }, { token: 'regexp.flags', next: '@pop' }]],
|
|
1097
|
-
['/', { token: 'regexp.slash.close', next: '@pop' }],
|
|
1098
|
-
[/./, 'regexp.invalid'],
|
|
1099
|
-
],
|
|
1100
|
-
|
|
1101
|
-
_regexrange: [
|
|
1102
|
-
[/-/, 'regexp.escape.control'],
|
|
1103
|
-
[/\^/, 'regexp.invalid'],
|
|
1104
|
-
[/@regexpesc/, 'regexp.escape'],
|
|
1105
|
-
[/[^\]]/, 'regexp'],
|
|
1106
|
-
[/\]/, 'regexp.escape.control', '@pop'],
|
|
1107
|
-
],
|
|
1108
|
-
|
|
1109
|
-
_hereregexp: [
|
|
1110
|
-
[/[^\\\/#]/, 'regexp'],
|
|
1111
|
-
[/\\./, 'regexp'],
|
|
1112
|
-
[/#.*$/, 'comment'],
|
|
1113
|
-
['///[igm]*', 'regexp', '@pop'],
|
|
1114
|
-
[/\//, 'regexp'],
|
|
1115
|
-
'comment_',
|
|
1116
|
-
],
|
|
1117
|
-
};
|
|
1118
|
-
|
|
1119
|
-
// states are structured:
|
|
1120
|
-
// 1 = the monarch state
|
|
1121
|
-
// 2 = the current indentation (I)
|
|
1122
|
-
// 3 = the current scope name/type (&)
|
|
1123
|
-
// 4 = various flags (F)
|
|
1124
|
-
// 5 = the monarch substate -- for identifiers++
|
|
1125
|
-
function rewriteΞstate(raw) {
|
|
1126
|
-
let state = ['$S1', '$S2', '$S3', '$S4', '$S5', '$S6'];
|
|
1127
|
-
|
|
1128
|
-
if (raw.match(/\@(pop|push|popall)/)) {
|
|
1129
|
-
return raw;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
if (raw[0] == '@') {
|
|
1133
|
-
raw = raw.slice(1);
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
if (raw.indexOf('.') >= 0) {
|
|
1137
|
-
return raw;
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
raw = rewriteΞtoken(raw);
|
|
1141
|
-
// if raw.match(/^[\w\$\.\-]+$/)
|
|
1142
|
-
// return raw
|
|
1143
|
-
|
|
1144
|
-
if (raw[0] == '>') {
|
|
1145
|
-
state[1] = '$S6\t';
|
|
1146
|
-
raw = raw.slice(1);
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
for (
|
|
1150
|
-
let iφ2 = 0, itemsφ = iter$__(raw.split(/(?=[\/\&\=\*])/)), lenφ = itemsφ.length;
|
|
1151
|
-
iφ2 < lenφ;
|
|
1152
|
-
iφ2++
|
|
1153
|
-
) {
|
|
1154
|
-
let part = itemsφ[iφ2];
|
|
1155
|
-
if (part[0] == '&') {
|
|
1156
|
-
if (part[1] == '-' || part[1] == '_') {
|
|
1157
|
-
state[2] = '$S3' + part.slice(1);
|
|
1158
|
-
} else {
|
|
1159
|
-
state[2] = '$S3-' + part.slice(1);
|
|
1160
|
-
}
|
|
1161
|
-
} else if (part[0] == '+') {
|
|
1162
|
-
state[3] = '$S4-' + part.slice(1);
|
|
1163
|
-
} else if (part[0] == '=') {
|
|
1164
|
-
state[3] = part.slice(1);
|
|
1165
|
-
} else if (part[0] == '/') {
|
|
1166
|
-
state[4] = part.slice(1);
|
|
1167
|
-
} else if (part[0] == '*') {
|
|
1168
|
-
state[5] = part.slice(1);
|
|
1169
|
-
} else {
|
|
1170
|
-
state[0] = part;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
return state.join('.');
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
function rewriteΞtoken(raw) {
|
|
1177
|
-
let orig = raw;
|
|
1178
|
-
raw = raw.replace('$/', '$S5');
|
|
1179
|
-
raw = raw.replace('$F', '$S4');
|
|
1180
|
-
raw = raw.replace('$&', '$S3');
|
|
1181
|
-
raw = raw.replace('$I', '$S2');
|
|
1182
|
-
raw = raw.replace('$T', '$S2');
|
|
1183
|
-
|
|
1184
|
-
// if orig != raw
|
|
1185
|
-
// console.log 'rewriting token',orig,raw
|
|
1186
|
-
return raw;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
function rewriteΞactions(actions, add) {
|
|
1190
|
-
if (typeof actions == 'string') {
|
|
1191
|
-
// and parts.indexOf('$') >= 0
|
|
1192
|
-
|
|
1193
|
-
actions = { token: actions };
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
if (actions && actions.token != undefined) {
|
|
1197
|
-
actions.token = rewriteΞtoken(actions.token);
|
|
1198
|
-
|
|
1199
|
-
if (typeof add == 'string') {
|
|
1200
|
-
actions.next = add;
|
|
1201
|
-
} else if (add) {
|
|
1202
|
-
Object.assign(actions, add);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
if (actions.next) {
|
|
1206
|
-
actions.next = rewriteΞstate(actions.next);
|
|
1207
|
-
}
|
|
1208
|
-
if (actions.switchTo) {
|
|
1209
|
-
actions.switchTo = rewriteΞstate(actions.switchTo);
|
|
1210
|
-
}
|
|
1211
|
-
} else if (actions && actions.cases) {
|
|
1212
|
-
// console.log 'found cases to transform!!'
|
|
1213
|
-
let cases = {};
|
|
1214
|
-
for (
|
|
1215
|
-
let oφ = actions.cases, iφ3 = 0, keysφ2 = Object.keys(oφ), lφ2 = keysφ2.length, k, v;
|
|
1216
|
-
iφ3 < lφ2;
|
|
1217
|
-
iφ3++
|
|
1218
|
-
) {
|
|
1219
|
-
k = keysφ2[iφ3];
|
|
1220
|
-
v = oφ[k];
|
|
1221
|
-
let newkey = rewriteΞtoken(k);
|
|
1222
|
-
cases[newkey] = rewriteΞactions(v);
|
|
1223
|
-
}
|
|
1224
|
-
actions.cases = cases;
|
|
1225
|
-
} else if (actions instanceof Array) {
|
|
1226
|
-
let result = [];
|
|
1227
|
-
let curr = null;
|
|
1228
|
-
for (let i = 0, itemsφ2 = iter$__(actions), lenφ2 = itemsφ2.length; i < lenφ2; i++) {
|
|
1229
|
-
let action = itemsφ2[i];
|
|
1230
|
-
if (action[0] == '@' && i == actions.length - 1 && curr) {
|
|
1231
|
-
action = { next: action };
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if (typeof action == 'object') {
|
|
1235
|
-
if (action.token != undefined || action.cases) {
|
|
1236
|
-
result.push((curr = Object.assign({}, action)));
|
|
1237
|
-
} else {
|
|
1238
|
-
Object.assign(curr, action);
|
|
1239
|
-
}
|
|
1240
|
-
} else if (typeof action == 'string') {
|
|
1241
|
-
result.push((curr = { token: rewriteΞtoken(action) }));
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
actions = result;
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
if (actions instanceof Array) {
|
|
1248
|
-
for (let i = 0, itemsφ3 = iter$__(actions), lenφ3 = itemsφ3.length; i < lenφ3; i++) {
|
|
1249
|
-
let action = itemsφ3[i];
|
|
1250
|
-
if (action.token && action.token.indexOf('$$') >= 0) {
|
|
1251
|
-
action.token = action.token.replace('$$', '$' + (i + 1));
|
|
1252
|
-
}
|
|
1253
|
-
if (action.next) {
|
|
1254
|
-
action.next = rewriteΞstate(action.next);
|
|
1255
|
-
}
|
|
1256
|
-
if (action.switchTo) {
|
|
1257
|
-
action.switchTo = rewriteΞstate(action.switchTo);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
return actions;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
function rewriteΞrule(owner, key) {
|
|
1266
|
-
let rule;
|
|
1267
|
-
|
|
1268
|
-
return (rule = owner[key]);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
for (let iφ4 = 0, keysφ3 = Object.keys(states), lφ3 = keysφ3.length, key, rules; iφ4 < lφ3; iφ4++) {
|
|
1272
|
-
key = keysφ3[iφ4];
|
|
1273
|
-
rules = states[key];
|
|
1274
|
-
let i = 0;
|
|
1275
|
-
while (i < rules.length) {
|
|
1276
|
-
let rule = rules[i];
|
|
1277
|
-
if (rule[0] instanceof Array) {
|
|
1278
|
-
rules.splice(i, 1, ...rule);
|
|
1279
|
-
continue;
|
|
1280
|
-
} else if (typeof rule == 'string') {
|
|
1281
|
-
rules[i] = { include: rule };
|
|
1282
|
-
} else if (rule[1] instanceof Array) {
|
|
1283
|
-
rule[1] = rewriteΞactions(rule[1]);
|
|
1284
|
-
} else if (rule instanceof Array) {
|
|
1285
|
-
rule.splice(1, 2, rewriteΞactions(rule[1], rule[2]));
|
|
1286
|
-
}
|
|
1287
|
-
i++;
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
const grammar = {
|
|
1292
|
-
defaultToken: 'invalid',
|
|
1293
|
-
ignoreCase: false,
|
|
1294
|
-
tokenPostfix: '',
|
|
1295
|
-
brackets: [
|
|
1296
|
-
{ open: '{', close: '}', token: 'bracket.curly' },
|
|
1297
|
-
{ open: '[', close: ']', token: 'bracket.square' },
|
|
1298
|
-
{ open: '(', close: ')', token: 'bracket.parenthesis' },
|
|
1299
|
-
],
|
|
1300
|
-
keywords: [
|
|
1301
|
-
'def',
|
|
1302
|
-
'and',
|
|
1303
|
-
'or',
|
|
1304
|
-
'is',
|
|
1305
|
-
'isnt',
|
|
1306
|
-
'not',
|
|
1307
|
-
'on',
|
|
1308
|
-
'yes',
|
|
1309
|
-
'@',
|
|
1310
|
-
'no',
|
|
1311
|
-
'off',
|
|
1312
|
-
'true',
|
|
1313
|
-
'false',
|
|
1314
|
-
'null',
|
|
1315
|
-
'this',
|
|
1316
|
-
'self',
|
|
1317
|
-
'as',
|
|
1318
|
-
'new',
|
|
1319
|
-
'delete',
|
|
1320
|
-
'typeof',
|
|
1321
|
-
'in',
|
|
1322
|
-
'instanceof',
|
|
1323
|
-
'return',
|
|
1324
|
-
'throw',
|
|
1325
|
-
'break',
|
|
1326
|
-
'continue',
|
|
1327
|
-
'debugger',
|
|
1328
|
-
'if',
|
|
1329
|
-
'elif',
|
|
1330
|
-
'else',
|
|
1331
|
-
'switch',
|
|
1332
|
-
'for',
|
|
1333
|
-
'while',
|
|
1334
|
-
'do',
|
|
1335
|
-
'try',
|
|
1336
|
-
'catch',
|
|
1337
|
-
'finally',
|
|
1338
|
-
'class',
|
|
1339
|
-
'extends',
|
|
1340
|
-
'super',
|
|
1341
|
-
'undefined',
|
|
1342
|
-
'then',
|
|
1343
|
-
'unless',
|
|
1344
|
-
'until',
|
|
1345
|
-
'loop',
|
|
1346
|
-
'of',
|
|
1347
|
-
'by',
|
|
1348
|
-
'when',
|
|
1349
|
-
'tag',
|
|
1350
|
-
'prop',
|
|
1351
|
-
'attr',
|
|
1352
|
-
'export',
|
|
1353
|
-
'import',
|
|
1354
|
-
'extend',
|
|
1355
|
-
'var',
|
|
1356
|
-
'let',
|
|
1357
|
-
'const',
|
|
1358
|
-
'require',
|
|
1359
|
-
'isa',
|
|
1360
|
-
'await',
|
|
1361
|
-
],
|
|
1362
|
-
boolean: ['true', 'false', 'yes', 'no', 'undefined', 'null'],
|
|
1363
|
-
operators: [
|
|
1364
|
-
'=',
|
|
1365
|
-
'!',
|
|
1366
|
-
'~',
|
|
1367
|
-
'?',
|
|
1368
|
-
':',
|
|
1369
|
-
'!!',
|
|
1370
|
-
'??',
|
|
1371
|
-
'&',
|
|
1372
|
-
'|',
|
|
1373
|
-
'^',
|
|
1374
|
-
'%',
|
|
1375
|
-
'<<',
|
|
1376
|
-
'!&',
|
|
1377
|
-
'>>',
|
|
1378
|
-
'>>>',
|
|
1379
|
-
'+=',
|
|
1380
|
-
'-=',
|
|
1381
|
-
'*=',
|
|
1382
|
-
'/=',
|
|
1383
|
-
'&=',
|
|
1384
|
-
'|=',
|
|
1385
|
-
'?=',
|
|
1386
|
-
'??=',
|
|
1387
|
-
'^=',
|
|
1388
|
-
'%=',
|
|
1389
|
-
'~=',
|
|
1390
|
-
'<<=',
|
|
1391
|
-
'>>=',
|
|
1392
|
-
'>>>=',
|
|
1393
|
-
'..',
|
|
1394
|
-
'...',
|
|
1395
|
-
'||=',
|
|
1396
|
-
`&&=`,
|
|
1397
|
-
'**=',
|
|
1398
|
-
'**',
|
|
1399
|
-
'|=?',
|
|
1400
|
-
'~=?',
|
|
1401
|
-
'^=?',
|
|
1402
|
-
'=?',
|
|
1403
|
-
'and',
|
|
1404
|
-
'or',
|
|
1405
|
-
],
|
|
1406
|
-
assignments: [
|
|
1407
|
-
'=',
|
|
1408
|
-
'|=?',
|
|
1409
|
-
'~=?',
|
|
1410
|
-
'^=?',
|
|
1411
|
-
'=?',
|
|
1412
|
-
'^=',
|
|
1413
|
-
'%=',
|
|
1414
|
-
'~=',
|
|
1415
|
-
'<<=',
|
|
1416
|
-
'>>=',
|
|
1417
|
-
'>>>=',
|
|
1418
|
-
'||=',
|
|
1419
|
-
`&&=`,
|
|
1420
|
-
'?=',
|
|
1421
|
-
'??=',
|
|
1422
|
-
'+=',
|
|
1423
|
-
'-=',
|
|
1424
|
-
'*=',
|
|
1425
|
-
'/=',
|
|
1426
|
-
'&=',
|
|
1427
|
-
'|=',
|
|
1428
|
-
'**=',
|
|
1429
|
-
],
|
|
1430
|
-
logic: ['>', '<', '==', '<=', '>=', '!=', '&&', '||', '===', '!=='],
|
|
1431
|
-
ranges: ['..', '...'],
|
|
1432
|
-
spread: ['...'],
|
|
1433
|
-
dot: ['.'],
|
|
1434
|
-
access: ['.', '..'],
|
|
1435
|
-
math: ['+', '-', '*', '/', '++', '--'],
|
|
1436
|
-
|
|
1437
|
-
unspaced_ops: regexify('... . .. + * ++ --'),
|
|
1438
|
-
comment: /#(\s.*)?(\n|$)/,
|
|
1439
|
-
// we include these common regular expressions
|
|
1440
|
-
symbols: /[=><!~?&%|+\-*\^,]+/,
|
|
1441
|
-
escapes: /\\(?:[abfnrtv\\"'$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
1442
|
-
postaccess: /(:(?=\w))?/,
|
|
1443
|
-
ivar: /\@[a-zA-Z_]\w*/,
|
|
1444
|
-
B: /(?=\s|$)/,
|
|
1445
|
-
br: /[\r\n]+/,
|
|
1446
|
-
constant: /[A-Z][\w\$]*(?:\-+[\w\$]+)*/,
|
|
1447
|
-
// subIdentifer: /(?:\-*[\w\$]+)*/
|
|
1448
|
-
// identifier: /[a-z_]@subIdentifer/
|
|
1449
|
-
// anyIdentifier: /[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*/
|
|
1450
|
-
// anyIdentifierOpt: /(?:@anyIdentifier)?/
|
|
1451
|
-
id: /[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*\??/,
|
|
1452
|
-
plainid: /[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*\??/,
|
|
1453
|
-
fieldid: /[\@\#]*@plainid/,
|
|
1454
|
-
propid: /[\@\#]*@plainid/,
|
|
1455
|
-
defid: /[\@\#]*@plainid/,
|
|
1456
|
-
decid: /\@@plainid/,
|
|
1457
|
-
symid: /\#+@plainid/,
|
|
1458
|
-
symref: /\#\#@plainid/,
|
|
1459
|
-
optid: /(?:@id)?/,
|
|
1460
|
-
// (?:\-+[\w\$]+)*\??
|
|
1461
|
-
esmIdentifier: /[A-Za-z_\$\@][\w\$]*(?:\-+[\w\$]+)*\??/,
|
|
1462
|
-
propertyPath: /(?:[A-Za-z_\$][A-Za-z\d\-\_\$]*\.)?(?:[A-Za-z_\$][A-Za-z\d\-\_\$]*)/,
|
|
1463
|
-
tagNameIdentifier: /(?:[\w\-]+\:)?\w+(?:\-\w+)*/,
|
|
1464
|
-
variable: /[\w\$]+(?:-[\w\$]*)*\??/,
|
|
1465
|
-
varKeyword: /var|let|const/,
|
|
1466
|
-
tagIdentifier: /-*[a-zA-Z][\w\-]*/,
|
|
1467
|
-
implicitCall: /(?!\s(?:and|or|is|isa)\s)(?=\s[\w\'\"\/\[\{])/, // not true for or etc
|
|
1468
|
-
cssModifier: /(?:\@+[\<\>\!]?[\w\-]+\+?|\.+@id\-?)/,
|
|
1469
|
-
cssPropertyPath: /[\@\.]*[\w\-\$]+(?:[\@\.]+[\w\-\$]+)*/,
|
|
1470
|
-
cssPropertyKey: /[\@\.]*[\w\-\$]+(?:[\@\.]+[\w\-\$]+)*(?:\s*\:)/,
|
|
1471
|
-
|
|
1472
|
-
cssVariable: /(?:--|\$)[\w\-\$]+/,
|
|
1473
|
-
cssPropertyName: /[\w\-\$]+/,
|
|
1474
|
-
// cssModifier: /\@[\w\-\$]+/
|
|
1475
|
-
cssPropertyKey2: /(?:@cssPropertyName(?:@cssModifier)*|@cssModifier+)(?:\s*\:)/,
|
|
1476
|
-
cssUpModifier: /\.\.[\w\-\$]+/,
|
|
1477
|
-
cssIsModifier: /\.[\w\-\$]+/,
|
|
1478
|
-
|
|
1479
|
-
regEx: /\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,
|
|
1480
|
-
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
|
|
1481
|
-
regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
|
|
1482
|
-
// The main tokenizer for our languages
|
|
1483
|
-
tokenizer: states,
|
|
1484
|
-
};
|
|
1485
|
-
|
|
1486
|
-
export default {
|
|
1487
|
-
tokens: grammar,
|
|
1488
|
-
|
|
1489
|
-
config: {
|
|
1490
|
-
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
1491
|
-
comments: {
|
|
1492
|
-
blockComment: ['###', '###'],
|
|
1493
|
-
lineComment: '#',
|
|
1494
|
-
},
|
|
1495
|
-
brackets: [
|
|
1496
|
-
['{', '}', 'delimiter.curly'],
|
|
1497
|
-
['[', ']', 'delimiter.square'],
|
|
1498
|
-
['(', ')', 'delimiter.parenthesis'],
|
|
1499
|
-
['<', '>', 'delimiter.angle'],
|
|
1500
|
-
],
|
|
1501
|
-
autoClosingPairs: [
|
|
1502
|
-
{ open: '"', close: '"', notIn: ['string', 'comment'] },
|
|
1503
|
-
{ open: "'", close: "'", notIn: ['string', 'comment'] },
|
|
1504
|
-
{ open: '{', close: '}', notIn: ['comment'] },
|
|
1505
|
-
{ open: '[', close: ']', notIn: ['string', 'comment'] },
|
|
1506
|
-
{ open: '(', close: ')', notIn: ['string', 'comment'] },
|
|
1507
|
-
{ open: '<', close: '>', notIn: ['string', 'comment', 'operators'] },
|
|
1508
|
-
],
|
|
1509
|
-
onEnterRules: [
|
|
1510
|
-
{
|
|
1511
|
-
beforeText: /^\s*(?:def|get \w|set \w|class|for|if|elif|else|while|try|with|finally|except|async).*?$/,
|
|
1512
|
-
action: { indentAction: 1 },
|
|
1513
|
-
},
|
|
1514
|
-
{
|
|
1515
|
-
beforeText: /\s*(?:do)\s*(\|.*\|\s*)?$/,
|
|
1516
|
-
action: { indentAction: 1 },
|
|
1517
|
-
},
|
|
1518
|
-
],
|
|
1519
|
-
},
|
|
1520
|
-
};
|