efront 3.34.11 → 3.35.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.
Files changed (76) hide show
  1. package/apps/moue/content//344/275/240/345/245/275/344/270/226/347/225/214.vue +21 -0
  2. package/apps/moue/content//344/275/240/345/245/275/345/274/200/345/217/221/350/200/205.html +1 -0
  3. package/apps/moue/{home/index.js → content//344/275/240/345/245/275/345/274/200/345/217/221/350/200/205.js} +4 -2
  4. package/apps/moue/content//344/275/240/345/245/275/345/274/200/345/217/221/350/200/205.less +4 -0
  5. package/apps/moue/home/index2.vue +97 -18
  6. package/apps/moue/index.html +1 -1
  7. package/coms/basic/ArrayFill.md +9 -0
  8. package/coms/basic/awaitable.md +10 -0
  9. package/coms/basic/backEach.md +7 -0
  10. package/coms/basic/combine.md +23 -0
  11. package/coms/basic/renderExpress.js +1 -1
  12. package/coms/basic/wait.js +5 -0
  13. package/coms/basic_/readme.md +27 -9
  14. package/coms/compile/#/350/257/264/346/230/216.md +1 -0
  15. package/coms/compile/Html.js +263 -0
  16. package/coms/compile/Html_test.js +5 -0
  17. package/coms/compile/Javascript.js +594 -0
  18. package/coms/compile/Program.js +664 -0
  19. package/coms/compile/autoenum.js +179 -0
  20. package/coms/compile/autoenum_test.js +17 -0
  21. package/coms/compile/autoeval.js +50 -0
  22. package/coms/compile/autoeval_test.js +28 -0
  23. package/coms/compile/autoiota.js +121 -0
  24. package/coms/compile/breakcode.js +83 -0
  25. package/coms/compile/common.js +1063 -0
  26. package/coms/compile/downLevel.js +901 -0
  27. package/coms/compile/downLevel_test.js +111 -0
  28. package/coms/compile/formatcode.js +57 -0
  29. package/coms/compile/iso8859.js +9 -0
  30. package/coms/compile/iso8859_test.js +2 -0
  31. package/coms/compile/keywords.js +6 -0
  32. package/coms/compile/namelist.js +154 -0
  33. package/coms/compile/namelist_test.js +7 -0
  34. package/coms/compile/polyfill.js +31 -0
  35. package/coms/compile/required.js +20 -0
  36. package/coms/compile/richcss.js +237 -0
  37. package/coms/compile/richcss_test.js +7 -0
  38. package/coms/compile/scanner.js +653 -0
  39. package/coms/compile/scanner2.js +202 -0
  40. package/coms/compile/scanner2_test.js +110 -0
  41. package/coms/compile/scanner_test.js +10 -0
  42. package/coms/compile/unstruct.js +712 -0
  43. package/coms/compile/unstruct_test.js +54 -0
  44. package/coms/compile/washcode.js +237 -0
  45. package/coms/compile/washcode_test.js +17 -0
  46. package/coms/docs/helps.js +71 -0
  47. package/coms/docs/markdown.js +248 -0
  48. package/coms/frame/route.js +1 -1
  49. package/coms/reptile/colored_console.js +2 -1
  50. package/coms/zimoli/cless.js +1 -0
  51. package/coms/zimoli/css.js +1 -9
  52. package/coms/zimoli/html.js +1 -1
  53. package/coms/zimoli/menu.js +1 -1
  54. package/coms/zimoli/menuItem.html +1 -1
  55. package/coms/zimoli/menuItem.js +1 -1
  56. package/coms/zimoli/render.js +14 -3
  57. package/coms/zimoli/text.js +1 -1
  58. package/coms/zimoli/transition.js +4 -4
  59. package/coms/zimoli/tree.js +2 -2
  60. package/coms/zimoli/zimoli.js +39 -12
  61. package/docs/compare.md +5 -5
  62. package/docs/components.jsp +17 -0
  63. package/docs/index.html +16 -26
  64. package/docs/main.xht +182 -0
  65. package/docs/mark.xht +166 -0
  66. package/docs/welcome.jsp +7 -0
  67. package/docs//345/221/275/344/273/244.xht +100 -0
  68. package/docs//347/211/210/346/234/254/350/257/264/346/230/216.md +9 -0
  69. package/docs//347/273/204/344/273/266.xht +87 -0
  70. package/package.json +1 -1
  71. package/public/efront.js +1 -1
  72. package/readme.md +6 -11
  73. package/apis/docs/getAllComponents.js +0 -69
  74. package/apps/moue/home/index.html +0 -1
  75. package/apps/moue/home/index.less +0 -0
  76. package/docs/main.js +0 -17
@@ -0,0 +1,664 @@
1
+ const {
2
+ /* 1 */COMMENT,
3
+ /* 2 */SPACE,
4
+ /* 4 */STRAP,
5
+ /* 8 */STAMP,
6
+ /* 16 */VALUE,
7
+ /* 32 */QUOTED,
8
+ /* 64 */PIECE,
9
+ /* 128 */EXPRESS,
10
+ /* 256 */SCOPED,
11
+ /* 512 */LABEL,
12
+ /*1024 */PROPERTY,
13
+ createString,
14
+ number_reg,
15
+ } = require("./common");
16
+ var combine = require("../basic/combine");
17
+ var setObject = function (o) {
18
+ o.isObject = true;
19
+ var needproperty = true;
20
+ for (var cx = 0; cx < o.length; cx++) {
21
+ var m = o[cx];
22
+ if (!needproperty) {
23
+ if (m.type === SCOPED && m.entry === '{') {
24
+ if (!m.isObject) setObject(m);
25
+ continue;
26
+ }
27
+ if (m.type !== STAMP || m.text !== ',') continue;
28
+ }
29
+ if (m.type === STAMP && m.text === ':') {
30
+ needproperty = false;
31
+ continue;
32
+ }
33
+ if (m.type === LABEL) {
34
+ o.splice(cx, 0, o[++cx].prev = m.next = m.next.prev = {
35
+ prev: m,
36
+ text: ':',
37
+ type: STAMP,
38
+ next: m.next,
39
+ });
40
+ m.type = PROPERTY;
41
+ m.text = m.text.replace(/\:$/, '');
42
+ m.isprop = true;
43
+ m.end--;
44
+ needproperty = false;
45
+ continue;
46
+ }
47
+ m.isprop = true;
48
+ if (m.type === EXPRESS || m.type === QUOTED) {
49
+ if (!/\./.test(m.text)) m.type = PROPERTY;
50
+ }
51
+ if (m.prev && m.prev.type === PROPERTY) {
52
+
53
+ m.prev.type = STRAP;
54
+ }
55
+ }
56
+ };
57
+ var sortRegExpSource = function (a, b) {
58
+ if (a.indexOf(b) >= 0) return -1;
59
+ if (b.indexOf(a) >= 0) return 1;
60
+ return 0;
61
+ };
62
+ var createQuotedMap = function (entry) {
63
+ var map = {};
64
+ var end = {};
65
+ entry.forEach(k => {
66
+ var [a, b] = k.slice(-2);
67
+ if (a instanceof RegExp) a = stringsFromRegExp(a);
68
+ if (b instanceof RegExp) b = stringsFromRegExp(b);
69
+ combine([].concat(a), [].concat(b)).forEach(([a, b]) => {
70
+ map[a] = b;
71
+ end[b] = a;
72
+ });
73
+ });
74
+ return [map, end];
75
+
76
+ }
77
+ var stringsFromRegExp = function (reg) {
78
+ // 只处理有限长度无嵌套无分支的表达式
79
+ var source = reg.source;
80
+ var queue = [];
81
+ for (var cx = 0, dx = source.length; cx < dx; cx++) {
82
+ var s = source[cx];
83
+ if (source[cx] === "\\") {
84
+ var s = source[++cx];
85
+ queue.push(s);
86
+ }
87
+ else if (s === "?") {
88
+ queue[queue.length - 1] = [queue[queue.length - 1][0], ""];
89
+ }
90
+ else {
91
+ queue.push(s);
92
+ }
93
+ }
94
+ var res = combine(...queue).map(a => a.join(""));
95
+ return res;
96
+ }
97
+
98
+ class Program {
99
+ quotes = [
100
+ [/'/, /'/, /\\[\s\S]/],
101
+ [/"/, /"/, /\\[\s\S]/],
102
+ ["/", /\/[a-z]*/, /\\[\s\S]|\[(\\[\s\S]|[^\]])+\]/],
103
+ ["`", "`", /\\[\s\S]/, ["${", "}"]],
104
+ ]
105
+ tags = [
106
+ [["<", "</"], /\/?>/, null, ["=", "'", '"', "{", "}"], [/<!--/, /--!?>/]]
107
+ ];
108
+ comments = [
109
+ ["//", /(?=[\r\n\u2028\u2029])/],
110
+ ["/*", "*/"],
111
+ [/<!--/, /--!?>/],
112
+ ]
113
+ scopes = [
114
+ ["(", ")"],
115
+ ["[", "]"],
116
+ ["{", "}"],
117
+ ]
118
+ stamps = "/=+;|:?<>-!~%^&*,".split("")
119
+ value_reg = /^(false|true|null)$/
120
+ number_reg = number_reg;
121
+ Code = Array;
122
+ transive_reg = /^(new|void|switch|case|break|continue|return|throw|extends|import)$/
123
+ straps = "if,for".split(',');
124
+ colonstrap_reg = /^(case|default)$/;
125
+ forceend_reg = /^(return|break|continue)$/;
126
+ classstrap_reg = /^(class)$/;
127
+ extends_reg = /^(extends)$/;
128
+ export_reg = /^(export)$/;
129
+ spaces = [
130
+ "\\u0002",
131
+ "\\b-\\r",// "\\b"/*8*/, "\\t"/*9*/, "\\n"/*10*/, "\\v"/*11*/, "\\f"/*12*/, "\\r"/*13*/,
132
+ " "/*32*/,
133
+ "\\u007f", "\\u00a0", "\\u00ad", "\\u034f", "\\u061c",
134
+ "\\u115f", "\\u1160",
135
+ "\\u17b4", "\\u17b5",
136
+ "\\u180b-\\u180e",
137
+ "\\u1cbb", "\\u1cbc",
138
+ "\\u2000-\\u200f",
139
+ "\\u2028-\\u202f",
140
+ "\\u205f-\\u206f",
141
+ "\\u2800", "\\u3000", "\\u3164",
142
+ "\\ufe00-\\ufe0f",
143
+ "\\ufeff", "\\uffa0",
144
+ "\\ufff0-\\ufff8",
145
+ "\\u{133fc}",
146
+ "\\u{1d173}-\\u{1d17a}"
147
+ ]
148
+ nocase = false
149
+ lastIndex = 0
150
+ compile(s) {
151
+ return s.replace(/\\[\s\S]|[\[\]\(\)\{\}\+\.\-\*\?\$\^\|\\\/]/g, function (m) {
152
+ if (m.length > 1) {
153
+ return m;
154
+ }
155
+ return "\\" + m;
156
+ });
157
+ }
158
+ createRegExp(source, g) {
159
+ source = source.map(s => {
160
+ if (s instanceof RegExp) return s.source;
161
+ if (s instanceof Array) return s.slice().sort(sortRegExpSource).map(s => this.compile(s)).join("|");
162
+ return this.compile(s);
163
+ });
164
+ var flag = this.nocase ? "i" : "";
165
+ var s = source.join("|");
166
+ if (g) return new RegExp(`${s}`, "g" + flag);
167
+ if (source.length > 1) return new RegExp(`^(${s})$`, flag);
168
+ return new RegExp(`^${s}$`, flag);
169
+ }
170
+ setType() {
171
+ }
172
+
173
+ exec(text) {
174
+ if (!this.entry_reg) this.commit();
175
+ var index = this.lastIndex;
176
+ var parents = [];
177
+ var lasttype;
178
+ var Code = this.Code;
179
+ var queue = new Code();
180
+ queue.__proto__ = Code.prototype;
181
+ var origin = queue;
182
+ var colonstrap_reg = this.colonstrap_reg;
183
+ var forceend_reg = this.forceend_reg;
184
+ var program = this;
185
+ var queue_push = function (scope) {
186
+ var last = queue.last;
187
+ Object.defineProperty(scope, 'queue', { value: queue, enumerable: false });
188
+ scope.prev = last;
189
+ if (scope.type !== COMMENT && scope.type !== SPACE) {
190
+ if (program.setType(scope) === false) {
191
+ last = scope.prev;
192
+ last.end = scope.end;
193
+ last.text = text.slice(last.start, last.end);
194
+ return;
195
+ }
196
+ if (last) last.next = scope;
197
+ queue.last = scope;
198
+ for (var cx = queue.length - 1; cx >= 0; cx--) {
199
+ var o = queue[cx];
200
+ if (o === last) break;
201
+ o.next = scope;
202
+ }
203
+ if (!queue.first) queue.first = scope;
204
+ }
205
+ scope.row = row;
206
+ scope.col = scope.start - colstart;
207
+ queue.push(scope);
208
+ };
209
+ var row = 1, colstart = -1;
210
+ var save = (type) => {
211
+ if (lasttype === STAMP && type === STAMP && !/[,;\:\?]/.test(m)) {
212
+ var scope = queue[queue.length - 1];
213
+ if (/=>$/i.test(scope.text) ||
214
+ /[=>]$/.test(scope.text) && /[^>=]/.test(m) ||
215
+ /[?]$/.test(scope.text) && /[^?\.=\:]/.test(m) ||
216
+ /[,;]$/.test(scope.text) ||
217
+ scope.end !== start) {
218
+ } else {
219
+ scope.end = end;
220
+ scope.text = text.slice(scope.start, scope.end);
221
+ program.setType(scope);
222
+ return;
223
+ }
224
+ }
225
+ var last = queue.last;
226
+ if (type === SPACE) {
227
+ if (last && last.type === STRAP && forceend_reg.test(last.text)) {
228
+ last.isend = true;
229
+ queue.inExpress = false;
230
+ }
231
+ }
232
+ else if (type !== STAMP);
233
+ else if (m === ";") queue.inExpress = false;
234
+ else if (last) check: switch (m) {
235
+ case "?":
236
+ queue.inExpress = true;
237
+ if (!queue.question) queue.question = 1;
238
+ else queue.question++;
239
+ break;
240
+ case "=":
241
+ if (last.type === SCOPED && last.entry === "{") {
242
+ if (!last.isObject) {
243
+ setObject(last);
244
+ }
245
+ }
246
+ case ",":
247
+ if (queue.isObject) {
248
+ if (last.type === PROPERTY) {
249
+ last.short = true;
250
+ }
251
+ }
252
+ queue.inExpress = true;
253
+ break;
254
+ case ":":
255
+ if (queue.question) {
256
+ queue.question--;
257
+ queue.inExpress = true;
258
+ break;
259
+ }
260
+ if (queue.isObject) {
261
+ if (last.type === PROPERTY || last.isprop) {
262
+ queue.inExpress = true;
263
+ break;
264
+ }
265
+ if (last.type === SCOPED && (!last.prev || !last.prev.type === STAMP && last.prev.text === ",")) {
266
+ queue.inExpress = true;
267
+ }
268
+ break;
269
+ }
270
+ var temp = last;
271
+ while (temp) {
272
+ if (temp.type === STRAP && colonstrap_reg.test(temp.text)) {
273
+ queue.inExpress = false;
274
+ break check;
275
+ }
276
+ if (!temp.isExpress) break;
277
+ temp = temp.prev;
278
+ }
279
+ queue.inExpress = false;
280
+ if (last.type === EXPRESS) {
281
+ // label
282
+ last.type = LABEL;
283
+ last.text += ":";
284
+ last.end = end;
285
+ return;
286
+ }
287
+ break;
288
+ default:
289
+ queue.inExpress = true;
290
+ }
291
+ else {
292
+ queue.inExpress = true;
293
+ }
294
+ var scope = {
295
+ type,
296
+ start,
297
+ end,
298
+ isExpress: queue.inExpress,
299
+ text: m
300
+ }
301
+ if (isdigit) scope.isdigit = true;
302
+ lasttype = type;
303
+ queue_push(scope);
304
+ };
305
+ var space_exp = this.space_exp;
306
+ var openTag = function () {
307
+ queue.inTag = true;
308
+ var m1 = text.slice(start, match.index);
309
+ var s = space_exp.exec(m1);
310
+ if (s) var tag = m1.slice(0, s.index);
311
+ else {
312
+ tag = m1;
313
+ }
314
+ if (queue.tag) {
315
+ if (queue.last.text === quote.tag[1]) {
316
+ while (p && p.tag && p.tag !== p.tag) ps.push(p), p = parents[--pi];
317
+ if (p && ps.length) {
318
+ var pie = queue.pop();
319
+ queue.last = pie.prev;
320
+ queue = p;
321
+ while (ps.length) queue_push(ps.shift());
322
+ queue_push(pie);
323
+ }
324
+ m = tag;
325
+ save(PIECE);
326
+ queue.closed = true;
327
+ var p = queue;
328
+ var pi = parents.length;
329
+ var ps = [];
330
+ }
331
+
332
+ }
333
+ else {
334
+ queue.tag = tag;
335
+ m = m1;
336
+ save(PIECE);
337
+ }
338
+ if (queue.closed) {
339
+ index = match.index;
340
+ }
341
+ };
342
+ var closeTag = function () {
343
+ queue.inTag = false;
344
+ if (queue.closed) return;
345
+ return false;
346
+ };
347
+ var push_quote = function () {
348
+ var scope = [];
349
+ scope.entry = m;
350
+ scope.type = SCOPED;
351
+ scope.inExpress = true;
352
+ scope.leave_map = quote.leave;
353
+ end = match.index;
354
+ m = text.slice(start, end);
355
+ save(PIECE);
356
+ push_parents(scope);
357
+ };
358
+ var push_parents = function (scope) {
359
+ scope.queue = queue;
360
+ scope.prev = queue.last;
361
+ parents.push(queue);
362
+ queue = scope;
363
+ lasttype = null;
364
+ }
365
+ var pop_parents = function () {
366
+ var scope = queue;
367
+ queue = parents.pop();
368
+ queue_push(scope);
369
+ lasttype = scope.type;
370
+ }
371
+
372
+ loop: while (index < text.length) {
373
+ if (queue.type === QUOTED) {
374
+ var quote = this.quote_map[queue.entry];
375
+ var reg = quote.reg;
376
+ start = index;
377
+ while (index < text.length) {
378
+ reg.lastIndex = index;
379
+ var match = reg.exec(text);
380
+ if (!match) {
381
+ index = text.length;
382
+ break loop;
383
+ }
384
+ var m = match[0];
385
+ index = match.index + m.length;
386
+ if (quote.tag && queue.inTag === 0) {
387
+ openTag();
388
+ index = start = match.index;
389
+ continue;
390
+ }
391
+ if (quote.end.test(m)) {
392
+ end = match.index;
393
+ if (queue.tag && closeTag() === false) {
394
+ save(PIECE);
395
+ start = index;
396
+ continue loop;
397
+ }
398
+ queue.leave = m;
399
+ if (start < end) {
400
+ m = text.slice(start, end);
401
+ save(PIECE);
402
+ }
403
+ break;
404
+ }
405
+ a: if (quote.tag) {
406
+ var mi = quote.tag.indexOf(m);
407
+ if (mi < 0) break a;
408
+ if (mi === 0) {
409
+ var scope = [];
410
+ scope.entry = m;
411
+ scope.type = QUOTED;
412
+ scope.start = index;
413
+ push_parents(scope);
414
+ queue.inTag = 0;
415
+ start = index;
416
+ continue;
417
+ }
418
+ save(PIECE);
419
+ queue.inTag = 0;
420
+ start = index;
421
+ continue;
422
+ }
423
+ if (m in quote.entry) {
424
+ push_quote();
425
+ continue loop;
426
+ }
427
+ }
428
+ queue.end = match.index;
429
+ pop_parents();
430
+ continue;
431
+ }
432
+ var reg = this.entry_reg;
433
+ var start = reg.lastIndex = index;
434
+ var match = reg.exec(text);
435
+ if (!match) return null;
436
+ var end = match[0].length + match.index;
437
+ this.lastIndex = index = end;
438
+ var m = match[0];
439
+ test: if (this.quote_map.hasOwnProperty(m)) {
440
+ var last = queue.last;
441
+ if (this.stamp_reg.test(m) && last) {
442
+ if ((VALUE | EXPRESS) & last.type) break test;
443
+ if (last.type === QUOTED && !last.tag) break test;
444
+ if (last.type === SCOPED && queue.inExpress) break test;
445
+ if (lasttype === STAMP && m === last.text) break test;
446
+ }
447
+ var scope = [];
448
+ var quote = this.quote_map[m];
449
+ scope.type = this.comment_entry.test(m) ? COMMENT : QUOTED;
450
+ scope.start = start;
451
+ push_parents(scope);
452
+ if (quote.tag) {
453
+ queue.entry = m;
454
+ queue.inTag = 0;
455
+ continue loop;
456
+ }
457
+
458
+ var m0 = m;
459
+ var reg = quote.reg;
460
+ while (index < text.length) {
461
+ reg.lastIndex = index;
462
+ var match = reg.exec(text);
463
+ if (!match) {
464
+ index = text.length;
465
+ break;
466
+ }
467
+ var m = match[0];
468
+ index = this.lastIndex = match.index + m.length;
469
+ if (quote.length === 2) {
470
+ break;
471
+ }
472
+ if (quote.end.test(m)) {
473
+ break;
474
+ }
475
+ if (quote.length === 3) {
476
+ continue;
477
+ }
478
+ if (quote.length >= 4 && m in quote.entry) {
479
+ queue.entry = m0;
480
+ start += m0.length;
481
+ push_quote();
482
+ continue loop;
483
+ }
484
+ }
485
+ queue.inExpress = true;
486
+ queue.end = index;
487
+ queue.text = text.slice(queue.start, index);
488
+ row += queue.text.replace(/[^\r\n\u2028\u2029]+/g, ':').replace(/\r\n/g, ',').replace(/:/g, '').length;
489
+ pop_parents();
490
+ continue;
491
+ }
492
+ var parent = parents[parents.length - 1];
493
+ if (parent && this.quote_map[parent.entry] && queue.leave_map[m] === queue.entry) {
494
+ delete queue.leave_map;
495
+ queue.end = end;
496
+ queue.leave = m;
497
+ pop_parents();
498
+ continue;
499
+ }
500
+ if (this.space_reg.test(m)) {
501
+ if (/[\r\n\u2028\u2029]/.test(m)) {
502
+ m = m.replace(/^[^\r\n\u2028\u2029]+/, '').replace(/\r\n|\r|\n|\u2028|\u2029/g, "\r\n");
503
+ row += m.replace(/[^\r\n]+/g, '').length >> 1;
504
+ colstart = match.index + m.replace(/[^\r\n]+$/, '').length - 1;
505
+ save(SPACE);
506
+ }
507
+ lasttype = SPACE;
508
+ continue;
509
+ }
510
+ if (this.strap_reg.test(m)) {
511
+ if (!this.classstrap_reg.test(m)) queue.inExpress = this.transive_reg.test(m);
512
+ else {
513
+ var last = queue.last;
514
+ if (!last) queue.inExpress = false;
515
+ else if (last.type === STAMP) {
516
+ queue.inExpress = !/^(;|\+\+|\-\-)$/.test(last.text);
517
+ }
518
+ else if (last.type !== STRAP) {
519
+ queue.inExpress = false;
520
+ }
521
+ }
522
+ save(STRAP);
523
+ continue;
524
+ }
525
+ var isdigit = this.number_reg.test(m);
526
+ if (this.value_reg.test(m) || isdigit) {
527
+ save(VALUE);
528
+ queue.inExpress = true;
529
+ continue;
530
+ }
531
+ if (this.express_reg.test(m)) {
532
+ var last = queue.last;
533
+ if (last && last.type === STRAP && this.classstrap_reg.test(last.text));
534
+ else queue.inExpress = true;
535
+ save(EXPRESS);
536
+ continue;
537
+ }
538
+
539
+ if (this.scope_entry[m]) {
540
+ var scope = [];
541
+ scope.entry = m;
542
+ scope.type = SCOPED;
543
+ var last = queue.last;
544
+ if (m === "{") {
545
+ if (!last) {
546
+ scope.isObject = queue.inExpress;
547
+ }
548
+ else if (queue.classed > 0) {
549
+ if (last.type !== STAMP || last.text !== "=>") {
550
+ queue.classed--;
551
+ scope.isClass = true;
552
+ scope.extend += this.extends_reg.test(last.text);
553
+ scope.inExpress = false;
554
+ }
555
+ }
556
+ else if (last.type === STAMP) {
557
+ if (last.text === ':') {
558
+ scope.isObject = queue.inExpress;
559
+ }
560
+ else scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(last.text);
561
+ }
562
+ else if (last.type === STRAP) {
563
+ if (queue[queue.length - 1].type === SPACE && forceend_reg.test(last.text));
564
+ else if (this.export_reg.test(last.text));
565
+ else scope.isObject = queue.inExpress;
566
+ }
567
+ }
568
+ else {
569
+ if (!last || (last.type & (SCOPED | STAMP))) queue.inExpress = true;
570
+ scope.isExpress = queue.inExpress;
571
+ scope.inExpress = true;
572
+ }
573
+ scope.start = match.index;
574
+ push_parents(scope);
575
+ continue;
576
+ }
577
+ if (this.scope_leave[m] && queue.entry === this.scope_leave[m]) {
578
+ var lastUncomment = queue.last;
579
+ if (lastUncomment) {
580
+ if (lastUncomment.type === PROPERTY) {
581
+ lastUncomment.short = true;
582
+ }
583
+ }
584
+
585
+ queue.end = end;
586
+ queue.leave = m;
587
+ pop_parents();
588
+ continue;
589
+ }
590
+
591
+ if (this.stamp_reg.test(m)) {
592
+ save(STAMP);
593
+ }
594
+
595
+ }
596
+ if (queue !== origin) throw console.log(createString(origin), createString([queue])), new Error("代码异常结束");
597
+ return queue;
598
+ }
599
+ commit() {
600
+ this.strap_reg = this.createRegExp(this.straps);
601
+ this.comment_entry = this.createRegExp(this.comments.map(m => m[0]));
602
+ var stamps = this.stamps.join("");
603
+ stamps = this.compile(stamps);
604
+ this.stamp_reg = new RegExp(`^[${stamps}]$`);
605
+ var tokens = {};
606
+ var quote_map = {};
607
+ this.quote_map = quote_map;
608
+ this.tags.forEach(t => t.tag = t[0]);
609
+ var quoteslike = this.comments.concat(this.quotes, this.tags);
610
+ quoteslike.forEach(q => {
611
+ var a = q[0];
612
+ if (a instanceof RegExp) a = stringsFromRegExp(a);
613
+ if (typeof a === "string" && a.length === 1) tokens[a] = true;
614
+ if (a instanceof Array) {
615
+ a.forEach(a => quote_map[a] = q);
616
+ }
617
+ else quote_map[a] = q;
618
+ var r = q.slice(q[2] ? 2 : 3).concat(q[1]).map(q => {
619
+ if (q instanceof Array) {
620
+ q = q[q.length - 2];
621
+ }
622
+ if (q instanceof RegExp) {
623
+ return q.source;
624
+ }
625
+ return this.compile(q);
626
+ });
627
+ if (q.tag) r = r.concat(q.tag.slice().sort(sortRegExpSource));
628
+ r = r.join("|");
629
+ q.reg = new RegExp(r, 'g');
630
+ q.end = this.createRegExp([q[1]]);
631
+ if (q.length >= 4) {
632
+ var entry = q.slice(3);
633
+ if (q.tag) entry.push([q.tag, q[1]]);
634
+ [q.entry, q.leave] = createQuotedMap(entry);
635
+ }
636
+ });
637
+ var scope_entry = {};
638
+ this.scope_entry = scope_entry;
639
+ this.scope_leave = {};
640
+ var scope_leave = this.scope_leave;
641
+ this.scopes.forEach(s => {
642
+ var [a, b] = s;
643
+ scope_entry[a] = b;
644
+ scope_leave[b] = a;
645
+ tokens[a] = true;
646
+ tokens[b] = true;
647
+ });
648
+ this.stamps.forEach(s => {
649
+ tokens[s] = true;
650
+ });
651
+ var scopes = this.scopes.map(a => a.join("")).join("");
652
+ scopes = this.compile(scopes);
653
+ var spaces = this.spaces.join("");
654
+ tokens = Object.keys(tokens).join("");
655
+ tokens = this.compile(tokens) + spaces;
656
+ var express = `[^${tokens}]+`;
657
+ this.express_reg = new RegExp(`^${express}$`, 'u');
658
+ this.space_reg = new RegExp(`^[${spaces}]+$`, 'u');
659
+ this.space_exp = new RegExp(`[${spaces}]+`, 'u');
660
+ var quotes = this.createRegExp(quoteslike.map(q => q[0]), true).source;
661
+ this.entry_reg = new RegExp([`[${spaces}]+|${quotes}|[${scopes}]|${this.number_reg.source.replace(/^\^|\$$/g, "")}[^${tokens}]*|${express}|[${stamps}]`], "giu");
662
+ }
663
+ }
664
+ module.exports = Program;