efront 4.24.2 → 4.25.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 (54) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +42 -24
  2. package/apps/pivot/auth/login.js +4 -4
  3. package/apps/pivot/cert/edit.js +1 -1
  4. package/apps/pivot/cert/list.js +1 -1
  5. package/apps/pivot/cert/main.xht +2 -3
  6. package/apps/pivot/db/list.xht +5 -0
  7. package/apps/pivot/dht/list.js +6 -7
  8. package/apps/pivot/dict/edit.js +1 -1
  9. package/apps/pivot/dict/list.js +8 -6
  10. package/apps/pivot/home/welcome.html +1 -1
  11. package/apps/pivot/link/room.js +3 -3
  12. package/apps/pivot/log/count.js +22 -22
  13. package/apps/pivot/main.js +8 -2
  14. package/apps/pivot/proxy/edit.js +1 -1
  15. package/apps/pivot/proxy/list.js +4 -5
  16. package/apps/pivot/share/list.js +3 -3
  17. package/apps/pivot/task/edit.js +1 -1
  18. package/apps/pivot/task/list.js +1 -1
  19. package/apps/pivot/token/edit.js +1 -1
  20. package/apps/pivot/token/list.js +1 -1
  21. package/apps/pivot/wow/root.js +0 -3
  22. package/coms/basic/i18n.js +18 -5
  23. package/coms/basic/migrate.js +43 -0
  24. package/coms/compile/Asm.js +252 -0
  25. package/coms/compile/Asm_test.js +22 -0
  26. package/coms/compile/Html_test.js +1 -0
  27. package/coms/compile/Javascript.js +1 -143
  28. package/coms/compile/Javascript_test.js +4 -1
  29. package/coms/compile/Program.js +186 -22
  30. package/coms/compile/common.js +16 -4
  31. package/coms/compile/powermap.js +2 -2
  32. package/coms/compile/unstruct.js +5 -5
  33. package/coms/compile/unstruct_test.js +3 -1
  34. package/coms/explorer/context.js +2 -2
  35. package/coms/explorer/main.js +1 -1
  36. package/coms/frame/edit.html +1 -1
  37. package/coms/frame/edit.js +13 -6
  38. package/coms/frame/list.js +75 -42
  39. package/coms/frame/route.js +11 -6
  40. package/coms/pivot/plist.js +8 -5
  41. package/coms/zimoli/autodragchildren.js +5 -1
  42. package/coms/zimoli/moveupon.js +8 -5
  43. package/coms/zimoli/prompt.js +1 -0
  44. package/coms/zimoli/render.js +1 -0
  45. package/coms/zimoli/resize.js +3 -0
  46. package/coms/zimoli/tree.js +4 -1
  47. package/coms/zimoli/zimoli.js +13 -2
  48. package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +7 -3
  49. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +6 -3
  50. package/coms//350/214/250/350/217/260//350/257/255/350/250/200.js +1 -22
  51. package/docs/main.xht +21 -17
  52. package/docs//345/221/275/344/273/244.xht +33 -32
  53. package/package.json +1 -1
  54. package/public/efront.js +1 -1
@@ -0,0 +1,252 @@
1
+ const {
2
+ STAMP,
3
+ STRAP,
4
+ LABEL,
5
+ EXPRESS,
6
+ COMMENT,
7
+ SPACE,
8
+ PROPERTY,
9
+ QUOTED,
10
+ VALUE,
11
+ saveTo,
12
+ SCOPED,
13
+ mergeTo,
14
+ } = common;
15
+ var createScoped = function (code = this) {
16
+ var scopes = [];
17
+ var vars = null;
18
+ var used = null;
19
+ var scoped = null;
20
+ var push = function () {
21
+ scopes.push(scoped);
22
+ scoped = [];
23
+ vars = Object.create(null);
24
+ used = Object.create(null);
25
+ scoped.vars = vars;
26
+ scoped.used = used;
27
+ };
28
+ var pop = function () {
29
+ var envs = Object.create(null);
30
+ var { used: used1, vars: vars1 } = scoped;
31
+ var used0 = Object.create(null);
32
+ for (var k in used1) {
33
+ if (!(k in vars1)) {
34
+ envs[k] = true;
35
+ used0[k] = used1[k];
36
+ }
37
+ }
38
+ scoped.envs = envs;
39
+ var s = scoped;
40
+ scoped = scopes.pop();
41
+ if (scoped) {
42
+ mergeTo(scoped.used, used0);
43
+ used = scoped.used;
44
+ vars = scoped.vars;
45
+ }
46
+ return s;
47
+ };
48
+ var pvar = function (c) {
49
+ var p = c.prev;
50
+ if (!p || p.type !== EXPRESS) return;
51
+ vars[p.text] = true;
52
+ };
53
+ var dvar = function (c) {
54
+ var n = c.next;
55
+ while (n.type === EXPRESS) {
56
+ saveTo(used, n.text, n);
57
+ vars[n.text] = true;
58
+ c = n;
59
+ n = n.next;
60
+ if (n.type === SCOPED) {
61
+ save(n);
62
+ c = n;
63
+ n = n.next;
64
+ }
65
+ if (n.type === STAMP) {
66
+ if (n.text === ":") {
67
+ c = n;
68
+ n = n.next;
69
+ if (n.type === EXPRESS) {
70
+ saveTo(used, n.text, n);
71
+ c = n;
72
+ n = n.next;
73
+ }
74
+ if (n.type === VALUE) c = n, n = n.next;
75
+ }
76
+ }
77
+ if (!n || n.type !== STAMP || n.text !== ',') {
78
+ return c;
79
+ }
80
+ n = n.next;
81
+ }
82
+ return c;
83
+ }
84
+ var save = function (code) {
85
+ var c = code.first;
86
+ a: for (var c = code.first; c; c = c.next)switch (c.type) {
87
+ case STRAP: switch (c.text.toLowerCase()) {
88
+ case "endp":
89
+ case "ends":
90
+ case "endm":
91
+ pop();
92
+ break;
93
+ case "proc":
94
+ case "macro":
95
+ case "struct":
96
+ pvar(c);
97
+ push();
98
+ c = dvar(c);
99
+ var n = c.next;
100
+ if (n.type === STRAP && n.text === 'uses') {
101
+ n = n.next;
102
+ while (n.type === VALUE) c = n, n = n.next;
103
+ }
104
+ if (n.type === STAMP && n.text === ',') n = n.next;
105
+ c = dvar(c);
106
+ break;
107
+ case "local":
108
+ c = dvar(c);
109
+ break;
110
+ }
111
+ break;
112
+ case EXPRESS:
113
+ case LABEL:
114
+ var tack = /^[^\.\?\:]+/.exec(c.text);
115
+ if (!tack) continue;
116
+ tack = tack[0];
117
+ if (c.kind) vars[tack] = true;
118
+ saveTo(used, tack, c);
119
+
120
+ }
121
+ }
122
+ push();
123
+ save(code);
124
+ return pop();
125
+ }
126
+ class Asm extends Program {
127
+ nocase = true;
128
+ value_reg = new RegExp(`^(${["byte", "tbyte", "word", "dword", "qword",
129
+ "ah", "ch", "dh", "bh", "al", "cl", "dl", "bl",
130
+ "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
131
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
132
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
133
+ "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
134
+ "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w",
135
+ "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b",
136
+ "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
137
+ "es", "cs", "ss", "ds", "fs", "gs",
138
+ "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7",
139
+ "tmm0", "tmm1", "tmm2", "tmm3", "tmm4", "tmm5", "tmm6", "tmm7",
140
+ "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
141
+ "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7",
142
+ "zmm0", "zmm1", "zmm2", "zmm3", "zmm4", "zmm5", "zmm6", "zmm7",
143
+ "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7", "st",
144
+ "dup",
145
+ 'equ',
146
+ "db", 'real4', 'real8', 'dw', 'dd', 'dq', 'byte', 'word', 'dword', 'qword', 'tword', 'dt',
147
+ ].join("|")})$`, 'i');
148
+ straps = [
149
+ "include", "includelib",
150
+ "typedef",
151
+ "ptr",
152
+ "proto",
153
+ "and", 'or', 'not', "sizeof",
154
+ "invoke", "offset", 'addr',
155
+ "local",
156
+ "end",
157
+ "enter",
158
+ "movzx", "mov", "movq", "movss", "movsd", "movd",
159
+ "addss", "subss", "mulss", "divss", "sqrtss", "ucomiss", "maxss", "minss",
160
+ "fucom", "fucomp", "fucompp", "fucomi", "fucomip", "fcom", "fcomp", "fcompp",
161
+ "fwait", "frndint",
162
+ "fldz", "fld1", "fldpi", "fldl2t", "fldlg2", "fldln2", "fldl2e",
163
+ "fxtract", "fxch", "fincstp", "fdecstp",
164
+ "fprem", "fprem1",
165
+ "fild", "fld",
166
+ "fstcw", "fldcw",
167
+ "sahf", "fstsw", "fclex",
168
+ "fst", "fistp", "fstp", "fbld", "fbstp",
169
+ "fchs", "fabs", "fsin", "fptan", "fyl2x", "f2xm1", "fscale",
170
+ "finit", "fcos", "ffree", "fmulp", "fdivp",
171
+ "faddp", "fsubp", "fsubrp", "fadd", "fsub", "fmul", "fdiv",
172
+ "fist", "fiadd", "fisub", "fimul", "fidiv",
173
+ "imul", "shr", "shr_cl", "sar", "sar_cl", "shl", "shl_cl", "mul", "div",
174
+ "inc", "dec", "add", "sub", "test", "pause",
175
+ "lock", "xchg", "cmpxchg", "cmpxchg8b", "cmp",
176
+ "lea", "neg", "not", "and", "or", "xor",
177
+ "pushad", "pusha", "popad", "popa", "pushfd", "popfd", "push", "pop",
178
+ "align", "nop", "int3", "rdtsc",
179
+ "je", "jz", "jne", "jnz", "jo", "jno", "js", "jns", "jp", "jnp", "jae", "ja", "jbe", "jb", "jge", "jnl", "jle", "jng", "jl", "jg",
180
+ "jmp",
181
+ "incopy",
182
+ "call", "stdcall", "cominvk",
183
+ "ret", "retn",
184
+ "leave",
185
+ "proc", "endp", "uses",
186
+ "macro", 'struct', "ends",
187
+ ".if", ".elseif", '.else', '.break', '.endif', '.while', '.endw',
188
+ ".until",
189
+ ".model", "option",
190
+ ];
191
+ control_reg = /^\.[\w]+$/;
192
+ transive_reg = /^(\.(if|elseif|endif|while)|local|addr|offset|proc)$/;
193
+ stamps = [",", ":", "<", ">", "=", "&", "|", "*", "~", "!", "+", "-", '/'];
194
+ quotes = [
195
+ ["'", "'"],
196
+ ['"', '"']
197
+ ];
198
+ scopes = [
199
+ ["(", ")"],
200
+ ["[", "]"],
201
+ ["{", "}"],
202
+ ["<", ">"],
203
+ ];
204
+ tags = [];
205
+ comments = [
206
+ [";", /(?=[\r\n\u2028\u2029])/]
207
+ ];
208
+ setType(o) {
209
+ if (this.detectLabel(o)) return false;
210
+ var q = o.queue;
211
+ var prev = q[q.length - 1];
212
+ if (o.type === STRAP) {
213
+ switch (o.text.toLowerCase()) {
214
+ case "struct":
215
+ if (!q.inObject) q.inObject = 1;
216
+ else q.inObject++;
217
+ if (prev?.type === EXPRESS) prev.istype = true;
218
+ break;
219
+ case "ends": q.inObject--;
220
+ if (prev?.type === PROPERTY) prev.istype = true, prev.type = EXPRESS;
221
+ break;
222
+ case "ptr":
223
+ if (prev?.type & (VALUE | EXPRESS)) prev.istype = true;
224
+ }
225
+ return;
226
+ }
227
+ if (q.inObject) {
228
+ if (prev?.type === SPACE && o.type === EXPRESS) {
229
+ o.type = PROPERTY;
230
+ }
231
+ if (prev?.type === PROPERTY && o.type & (EXPRESS | VALUE)) {
232
+ o.istype = true;
233
+ }
234
+ return;
235
+ }
236
+ if (o.type === STAMP && o.text === ":") {
237
+ o.istype = true;
238
+ return;
239
+ }
240
+ if (prev?.type === STAMP && prev.text === ":") {
241
+ o.istype = true;
242
+ return;
243
+ }
244
+ if (prev?.type === EXPRESS && o.type & (EXPRESS | VALUE)) {
245
+ if (!/^(dup)$/i.test(o.text)) prev.kind = o.text;
246
+ o.istype = true;
247
+ }
248
+ }
249
+ };
250
+ Asm.prototype.createScoped = createScoped;
251
+
252
+ Asm.prototype.createString = common.createString;
@@ -0,0 +1,22 @@
1
+ var asm = new Asm;
2
+ var test = function (str, exp = str) {
3
+ var code = scanner2(str, asm);
4
+ assert(String(code), exp);
5
+ }
6
+ test('a abc<1, 0, 0>');
7
+ test('eax < 1');
8
+ test('.if eax < 1 .break');
9
+ test('.if eax < 1 .break');
10
+ test('.while ecx<edx mov al,BYTE ptr[ecx]', '.while ecx < edx mov al, BYTE ptr[ecx]');
11
+ test(`
12
+ .386
13
+ .data
14
+ a dd ?
15
+ .code
16
+ a PROC
17
+ local p[SIZE], q
18
+ xor eax, eax
19
+ ret
20
+ a endp
21
+ start:
22
+ end start`);
@@ -46,3 +46,4 @@ test(`<meta charset="utf-8" />`);
46
46
  test('a><a></a>', 'a > <a></a>');
47
47
  test('X', 'X');
48
48
  test('<input -class="{actived:actived===f}"/>', 'scoped.envs.actived', true);
49
+ test('<i>>_</i>', '<i>>_</i>');
@@ -40,7 +40,6 @@ return,typeof,delete,switch,export,import,static
40
40
  default,finally,extends
41
41
  function,continue,debugger
42
42
  instanceof`.trim().split(/[,\s]+/);
43
- var colonstrap_reg = /^(case|default)$/;
44
43
  class Javascript extends Program {
45
44
  straps = straps;
46
45
  value_reg = /^(false|true|null|Infinity|NaN|undefined|eval|this|arguments)$/
@@ -240,149 +239,8 @@ var isShortMethodEnd = function (o) {
240
239
  return o.isprop;
241
240
  };
242
241
 
243
- var setObject = function (o) {
244
- o.isObject = true;
245
- var needproperty = true;
246
- for (var cx = 0; cx < o.length; cx++) {
247
- var m = o[cx];
248
- if (!needproperty) {
249
- if (m.type === SCOPED && m.entry === '{') {
250
- if (!m.isObject) setObject(m);
251
- continue;
252
- }
253
- if (m.type !== STAMP || m.text !== ',') continue;
254
- }
255
- if (m.type === STAMP && m.text === ':') {
256
- needproperty = false;
257
- continue;
258
- }
259
- if (m.type === LABEL) {
260
- o.splice(cx, 0, o[++cx].prev = m.next = m.next.prev = {
261
- prev: m,
262
- text: ':',
263
- type: STAMP,
264
- next: m.next,
265
- });
266
- m.type = PROPERTY;
267
- m.text = m.text.replace(/\:$/, '');
268
- m.isprop = true;
269
- m.end--;
270
- needproperty = false;
271
- continue;
272
- }
273
- m.isprop = true;
274
- if (m.type === EXPRESS || m.type === STRAP) {
275
- if (!/\./.test(m.text)) m.type = PROPERTY;
276
- }
277
- if (m.prev && m.prev.type === PROPERTY) {
278
- m.prev.type = STRAP;
279
- }
280
- }
281
- };
282
- var detectLabel = function (o) {
283
- var queue = o.queue;
284
- var last = queue.last;
285
- var m = o.text;
286
- var type = o.type;
287
- var end = o.end;
288
- var inExpress = queue.inExpress;
289
- if (type === SPACE);
290
- else if (type !== STAMP);
291
- else if (m === ";") {
292
- if (last && last.isend === false) last.isend = true;
293
- inExpress = false;
294
- }
295
- else if (last) check: switch (m) {
296
- case "?":
297
- if (last.isprop) {
298
- o.type = EXPRESS;
299
- o.isprop = true;
300
- break;
301
- }
302
- inExpress = true;
303
- if (!queue.question) queue.question = 1;
304
- else queue.question++;
305
- break;
306
- case "=":
307
- if (last.type === SCOPED && last.brace) {
308
- if (!last.isObject) {
309
- setObject(last);
310
- }
311
- }
312
- var lp = last.prev;
313
- if (lp?.type === STRAP && lp.text === 'type') {
314
- o.istype = true;
315
- }
316
- case ",":
317
- if (queue.isObject) {
318
- if (last.type === PROPERTY) {
319
- var lp = last.prev;
320
- if (!lp || lp.type === STAMP && lp.text === ',') last.short = true;
321
- }
322
- }
323
- inExpress = true;
324
- break;
325
- case ":":
326
-
327
- if (queue.question) {
328
- queue.question--;
329
- if (last.type === STAMP && last.text === '?') {
330
- inExpress = false;
331
- o.istype = true;
332
- last.istype = true;
333
- last.type = EXPRESS;
334
- }
335
- else {
336
- inExpress = true;
337
- }
338
- break;
339
- }
340
- if (queue.isObject) {
341
- if (last.isprop) {
342
- o.isExpress = false;
343
- queue.inExpress = true;
344
- return;
345
- }
346
- }
347
- inExpress = false;
348
- if (queue.entry && (!queue.brace || queue.isClass)) {
349
- o.istype = true;
350
- break;
351
- }
352
- var temp = last;
353
- while (temp) {
354
- if (temp.type === STRAP && colonstrap_reg.test(temp.text)) {
355
- break check;
356
- }
357
- if (!temp.isExpress) break;
358
- temp = temp.prev;
359
- }
360
- if (!queue.isargl && last.type & (EXPRESS | STRAP | VALUE | QUOTED)) {
361
- // label
362
- var lp = last.prev;
363
- if (!lp || lp.type !== STRAP || !lp.transive || lp.isend) {
364
- last.type = LABEL;
365
- last.text += ":";
366
- last.end = end;
367
- queue.inExpress = false;
368
- return o;
369
- }
370
- }
371
- o.istype = true;
372
- break;
373
- default:
374
- inExpress = true;
375
- }
376
- else {
377
- inExpress = true;
378
- }
379
- if (inExpress !== queue.inExpress) {
380
- o.isExpress = queue.inExpress = inExpress;
381
- }
382
- }
383
-
384
242
  Javascript.prototype.setType = function (o) {
385
- if (detectLabel(o)) return false;
243
+ if (this.detectLabel(o)) return false;
386
244
  var last = o.prev;
387
245
  if (last?.type === STRAP && o.type === STRAP && this.type_reg.test(last.text)) {
388
246
  if (/^(yield|await|async)$/.test(o.text)) o.type = EXPRESS;
@@ -119,7 +119,10 @@ a ? function () {} : function () {}
119
119
  declare module 'buffer' {}
120
120
  a <= 1;
121
121
  `)
122
-
122
+ testTypescript(`
123
+ var a: TypeA
124
+ var a: TypeA, b: TypeB
125
+ `);
123
126
  var testPress = function (text, expect) {
124
127
  var code = scanner2(text);
125
128
  code.press(false);