efront 4.24.3 → 4.25.1

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.
@@ -1,20 +1,23 @@
1
- - zh-CN: 英文
2
- en: English
1
+ - zh-CN: "不能有特殊符号\"$1\""
2
+ en: "Cannot have special symbol '$1'"
3
3
 
4
- - zh-CN: 英语
5
- en: English
4
+ - zh-CN: 不启用
5
+ en: Disable
6
6
 
7
- - zh-CN: 中文繁体
8
- en: Traditional Chinese
7
+ - zh-CN: 禁用
8
+ en: Disable
9
9
 
10
- - zh-CN: 繁体中文
11
- en: Traditional Chinese
10
+ - zh-CN: 无法在当前浏览器操作!
11
+ en: Cannot operate in the current browser!
12
12
 
13
- - zh-CN: 返回
14
- en: Return
13
+ - zh-CN: 无法在当前浏览器操作!
14
+ en: Cannot operate in the current browser!
15
15
 
16
- - zh-CN: 返回
17
- en: Back
16
+ - zh-CN: 确定
17
+ en: Confirm
18
+
19
+ - zh-CN: 确认
20
+ en: Confirm
18
21
 
19
22
  - zh-CN: "参数异常: $1"
20
23
  en: "Parameter exception: $1"
@@ -22,23 +25,23 @@
22
25
  - zh-CN: 参数异常:$1
23
26
  en: "Parameter exception: $1"
24
27
 
25
- - zh-CN: 确定
26
- en: Confirm
28
+ - zh-CN: 返回
29
+ en: Return
27
30
 
28
- - zh-CN: 确认
29
- en: Confirm
31
+ - zh-CN: 返回
32
+ en: Back
30
33
 
31
- - zh-CN: 无法在当前浏览器操作!
32
- en: Cannot operate in the current browser!
34
+ - zh-CN: 中文繁体
35
+ en: Traditional Chinese
33
36
 
34
- - zh-CN: 无法在当前浏览器操作!
35
- en: Cannot operate in the current browser!
37
+ - zh-CN: 繁体中文
38
+ en: Traditional Chinese
36
39
 
37
- - zh-CN: 不启用
38
- en: Disable
40
+ - zh-CN: 英文
41
+ en: English
39
42
 
40
- - zh-CN: 禁用
41
- en: Disable
43
+ - zh-CN: 英语
44
+ en: English
42
45
 
43
46
  - zh-CN: 商店
44
47
  en: Store
@@ -46,6 +46,11 @@
46
46
  load();
47
47
  var adddb = async function () {
48
48
  var a = await prompt(i18n`请输入名称`, {
49
+ check(a) {
50
+ if (a = /[\*\?\|\/\\\>\<"\:\.]/.exec(a)) {
51
+ return i18n`不能有特殊符号"${a[0]}"`;
52
+ }
53
+ },
49
54
  async submit(a) {
50
55
  await data.from('dbadd', { id: a, name: a });
51
56
  }
@@ -62,8 +62,8 @@
62
62
  <span>
63
63
  <progbar danger:="memery[0]/memery[1]<.05" :current="memeryUsed" :total="memery[1]"></progbar>
64
64
  <div>
65
+ <span -bind="size(memery[1])"></span> \
65
66
  <span -bind="size(memery[0])"></span>
66
- / <span -bind="size(memery[1])"></span>
67
67
  </div>
68
68
  </span>
69
69
  </padding>
@@ -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);