efront 4.24.3 → 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.
- package/#/345/233/275/351/231/205/345/214/226.yml +27 -24
- package/apps/pivot/db/list.xht +5 -0
- package/apps/pivot/home/welcome.html +1 -1
- package/coms/compile/Asm.js +252 -0
- package/coms/compile/Asm_test.js +22 -0
- package/coms/compile/Html_test.js +1 -0
- package/coms/compile/Javascript.js +1 -143
- package/coms/compile/Javascript_test.js +4 -1
- package/coms/compile/Program.js +186 -22
- package/coms/compile/common.js +16 -4
- package/coms/compile/powermap.js +2 -2
- package/coms/compile/unstruct.js +5 -5
- package/coms/compile/unstruct_test.js +3 -1
- package/coms/frame/list.js +2 -2
- package/coms/zimoli/moveupon.js +8 -5
- package/coms/zimoli/prompt.js +1 -0
- package/coms/zimoli/resize.js +3 -0
- package/coms/zimoli/tree.js +4 -1
- package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +7 -3
- package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +6 -3
- package/coms//350/214/250/350/217/260//350/257/255/350/250/200.js +1 -22
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/compile/Program.js
CHANGED
|
@@ -64,6 +64,46 @@ var trimDulp = function (list) {
|
|
|
64
64
|
}
|
|
65
65
|
return dist;
|
|
66
66
|
}
|
|
67
|
+
var setObject = function (o) {
|
|
68
|
+
o.isObject = true;
|
|
69
|
+
var needproperty = true;
|
|
70
|
+
for (var cx = 0; cx < o.length; cx++) {
|
|
71
|
+
var m = o[cx];
|
|
72
|
+
if (!needproperty) {
|
|
73
|
+
if (m.type === SCOPED && m.entry === '{') {
|
|
74
|
+
if (!m.isObject) setObject(m);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (m.type !== STAMP || m.text !== ',') continue;
|
|
78
|
+
}
|
|
79
|
+
if (m.type === STAMP && m.text === ':') {
|
|
80
|
+
needproperty = false;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (m.type === LABEL) {
|
|
84
|
+
o.splice(cx, 0, o[++cx].prev = m.next = m.next.prev = {
|
|
85
|
+
prev: m,
|
|
86
|
+
text: ':',
|
|
87
|
+
type: STAMP,
|
|
88
|
+
next: m.next,
|
|
89
|
+
});
|
|
90
|
+
m.type = PROPERTY;
|
|
91
|
+
m.text = m.text.replace(/\:$/, '');
|
|
92
|
+
m.isprop = true;
|
|
93
|
+
m.end--;
|
|
94
|
+
needproperty = false;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
m.isprop = true;
|
|
98
|
+
if (m.type === EXPRESS || m.type === STRAP) {
|
|
99
|
+
if (!/\./.test(m.text)) m.type = PROPERTY;
|
|
100
|
+
}
|
|
101
|
+
if (m.prev && m.prev.type === PROPERTY) {
|
|
102
|
+
m.prev.type = STRAP;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
67
107
|
|
|
68
108
|
var spaceDefined = require("../basic/spaces");
|
|
69
109
|
|
|
@@ -101,17 +141,130 @@ class Program {
|
|
|
101
141
|
powermap = powermap;
|
|
102
142
|
transive_reg = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|default|instanceof|throw|extends|import|from)$/;
|
|
103
143
|
straps = "if,for".split(',');
|
|
104
|
-
|
|
144
|
+
colonstrap_reg = /^(case|default)$/;
|
|
145
|
+
forceend_reg = /^(return|break|continue|end[psm])$/;
|
|
105
146
|
funcstrap_reg = /^(class|function|fn|func|async|interface|struct|enum|impl|pub)$/;
|
|
106
147
|
extends_reg = /^(extends|implements)$/;
|
|
107
148
|
structstrap_reg = /^(class|interface|struct|enum)$/;
|
|
108
149
|
control_reg = /^(if|else|switch|case|do|while|for|loop|break|continue|default|import|from|as|export|try|catch|finally|throw|await|yield|return)$/;
|
|
109
|
-
type_reg = /^(var|let|const|function|fn|func|class|interface|type|struct|enum|impl)$/;
|
|
150
|
+
type_reg = /^(var|let|const|function|fn|func|class|interface|type|struct|enum|impl|local)$/;
|
|
110
151
|
nocase = false
|
|
111
152
|
keepspace = false;
|
|
112
153
|
lastIndex = 0
|
|
154
|
+
detectLabel(o) {
|
|
155
|
+
var queue = o.queue;
|
|
156
|
+
var last = queue.last;
|
|
157
|
+
var m = o.text;
|
|
158
|
+
var type = o.type;
|
|
159
|
+
var end = o.end;
|
|
160
|
+
var inExpress = queue.inExpress;
|
|
161
|
+
if (type === SPACE);
|
|
162
|
+
else if (type !== STAMP);
|
|
163
|
+
else if (m === ";") {
|
|
164
|
+
if (last && last.isend === false) last.isend = true;
|
|
165
|
+
inExpress = false;
|
|
166
|
+
}
|
|
167
|
+
else if (last) check: switch (m) {
|
|
168
|
+
case "?":
|
|
169
|
+
if (last.isprop) {
|
|
170
|
+
o.type = EXPRESS;
|
|
171
|
+
o.isprop = true;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
if (last.type & (STAMP | STRAP) || last.istype) break;
|
|
175
|
+
inExpress = true;
|
|
176
|
+
if (!queue.question) queue.question = 1;
|
|
177
|
+
else queue.question++;
|
|
178
|
+
break;
|
|
179
|
+
case "=":
|
|
180
|
+
if (last.type === SCOPED && last.brace) {
|
|
181
|
+
if (!last.isObject) {
|
|
182
|
+
setObject(last);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
var lp = last.prev;
|
|
186
|
+
if (lp?.type === STRAP && lp.text === 'type') {
|
|
187
|
+
o.istype = true;
|
|
188
|
+
}
|
|
189
|
+
case ",":
|
|
190
|
+
if (queue.isObject) {
|
|
191
|
+
if (last.type === PROPERTY) {
|
|
192
|
+
var lp = last.prev;
|
|
193
|
+
if (!lp || lp.type === STAMP && lp.text === ',') last.short = true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
inExpress = true;
|
|
197
|
+
break;
|
|
198
|
+
case "|":
|
|
199
|
+
case "&":
|
|
200
|
+
var p = o.prev;
|
|
201
|
+
if (p?.istype) o.istype = true;
|
|
202
|
+
inExpress = true;
|
|
203
|
+
break;
|
|
204
|
+
case ":":
|
|
205
|
+
if (queue.question) {
|
|
206
|
+
queue.question--;
|
|
207
|
+
if (last.type === STAMP && last.text === '?') {
|
|
208
|
+
inExpress = false;
|
|
209
|
+
o.istype = true;
|
|
210
|
+
last.istype = true;
|
|
211
|
+
last.type = EXPRESS;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
inExpress = true;
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
if (queue.isObject) {
|
|
219
|
+
if (last.isprop) {
|
|
220
|
+
o.isExpress = false;
|
|
221
|
+
queue.inExpress = true;
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
inExpress = false;
|
|
226
|
+
if (queue.entry && (!queue.brace || queue.isClass)) {
|
|
227
|
+
o.istype = true;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
var temp = last;
|
|
231
|
+
var colonstrap_reg = this.colonstrap_reg;
|
|
232
|
+
while (temp) {
|
|
233
|
+
if (temp.type === STRAP && colonstrap_reg.test(temp.text)) {
|
|
234
|
+
break check;
|
|
235
|
+
}
|
|
236
|
+
if (!temp.isExpress) break;
|
|
237
|
+
temp = temp.prev;
|
|
238
|
+
}
|
|
239
|
+
if (!queue.isargl && last.type & (EXPRESS | STRAP | VALUE | QUOTED)) {
|
|
240
|
+
// label
|
|
241
|
+
var lp = last.prev;
|
|
242
|
+
if (lp && lp.type === STAMP && lp.text === ',') {
|
|
243
|
+
o.istype = true;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
if (!lp || lp.type !== STRAP || !lp.transive || lp.isend) {
|
|
247
|
+
last.type = LABEL;
|
|
248
|
+
last.text += ":";
|
|
249
|
+
last.end = end;
|
|
250
|
+
queue.inExpress = false;
|
|
251
|
+
return o;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
o.istype = true;
|
|
255
|
+
break;
|
|
256
|
+
default:
|
|
257
|
+
inExpress = true;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
inExpress = true;
|
|
261
|
+
}
|
|
262
|
+
if (inExpress !== queue.inExpress) {
|
|
263
|
+
o.isExpress = queue.inExpress = inExpress;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
113
266
|
twain(o1, o2) {
|
|
114
|
-
if (o1.istype || o1.needle || o2.needle) return;
|
|
267
|
+
if (o1.type === STRAP || o1.istype || o1.needle || o2.needle) return;
|
|
115
268
|
o2.istype = true;
|
|
116
269
|
}
|
|
117
270
|
compile2(s) {
|
|
@@ -144,7 +297,8 @@ class Program {
|
|
|
144
297
|
if (source.length > 1) return new RegExp(`^(${s})$`, flag);
|
|
145
298
|
return new RegExp(`^${s}$`, flag);
|
|
146
299
|
}
|
|
147
|
-
setType() {
|
|
300
|
+
setType(scope) {
|
|
301
|
+
if (this.detectLabel(scope)) return false;
|
|
148
302
|
}
|
|
149
303
|
|
|
150
304
|
exec(text) {
|
|
@@ -244,7 +398,7 @@ class Program {
|
|
|
244
398
|
}
|
|
245
399
|
else if (last.type === STRAP && !last.isend
|
|
246
400
|
|| last.type === STAMP && !last.istype && !/^(\+\+|\-\-)$/.test(last.text)
|
|
247
|
-
|| last.type === SCOPED && !last.isExpress
|
|
401
|
+
|| last.type === SCOPED && !last.isExpress && !last.istype
|
|
248
402
|
) {
|
|
249
403
|
o.unary = /^[^=;,\:]$/.test(o.text);
|
|
250
404
|
if (o.unary && /^(\+|\-)$/.test(o.text) && last && last.type === STAMP && /^(\+\+|\-\-)$/.test(last.text)) o.unary = !!last.unary;
|
|
@@ -261,7 +415,7 @@ class Program {
|
|
|
261
415
|
}
|
|
262
416
|
|
|
263
417
|
if (!o.unary && /^(\.\.\.|\*)$/.test(o.text)) {
|
|
264
|
-
if (powermap[o.text] === powermap.
|
|
418
|
+
if (powermap[o.text] === powermap.void) o.unary = true;
|
|
265
419
|
if (last?.isarg || last?.isargl || last?.isprop) {
|
|
266
420
|
o.unary = true;
|
|
267
421
|
o.istype = true;
|
|
@@ -275,7 +429,7 @@ class Program {
|
|
|
275
429
|
o.needle = true;
|
|
276
430
|
}
|
|
277
431
|
if (o.needle);
|
|
278
|
-
else if (powermap[o.text] > powermap.
|
|
432
|
+
else if (powermap[o.text] > powermap.void && !o.unary) {
|
|
279
433
|
o.needle = true;
|
|
280
434
|
}
|
|
281
435
|
queue_push(cache_stamp);
|
|
@@ -443,7 +597,7 @@ class Program {
|
|
|
443
597
|
start = index = scope.start + scope.text.length;
|
|
444
598
|
}
|
|
445
599
|
var last = queue.last;
|
|
446
|
-
if (last
|
|
600
|
+
if (last?.type === PIECE) {
|
|
447
601
|
this.lastIndex = 0;
|
|
448
602
|
var thist = this.type;
|
|
449
603
|
this.type = undefined;
|
|
@@ -467,7 +621,12 @@ class Program {
|
|
|
467
621
|
}
|
|
468
622
|
var closeTag = function () {
|
|
469
623
|
queue.inTag = false;
|
|
470
|
-
if (text.charAt(index) === m) {
|
|
624
|
+
a: if (text.charAt(index) === m) {
|
|
625
|
+
var qp = queue.prev;
|
|
626
|
+
if (!qp) break a;
|
|
627
|
+
var ptype = qp.type;
|
|
628
|
+
if (ptype & (ELEMENT | STRAP | PROPERTY | LABEL)) break a;
|
|
629
|
+
if (ptype === STAMP && !/^(\+\+|\-\-)$/.test(qp.text)) break a;
|
|
471
630
|
if ((m + m) in powermap) {
|
|
472
631
|
if (!parents[parents.length - 1].tag) {
|
|
473
632
|
undefTag();
|
|
@@ -565,7 +724,6 @@ class Program {
|
|
|
565
724
|
break loop;
|
|
566
725
|
}
|
|
567
726
|
var m = match[0];
|
|
568
|
-
|
|
569
727
|
index = match.index + m.length;
|
|
570
728
|
if (quote.tag && queue.inTag === 0) {
|
|
571
729
|
if (openTag()) {
|
|
@@ -644,6 +802,7 @@ class Program {
|
|
|
644
802
|
push_piece();
|
|
645
803
|
var scope = [];
|
|
646
804
|
scope.entry = m;
|
|
805
|
+
if (queue.istype) scope.istype = true;
|
|
647
806
|
scope.type = QUOTED;
|
|
648
807
|
push_parents(scope);
|
|
649
808
|
continue loop;
|
|
@@ -723,6 +882,9 @@ class Program {
|
|
|
723
882
|
case QUOTED:
|
|
724
883
|
if (!last.tag) break test;
|
|
725
884
|
break;
|
|
885
|
+
case VALUE:
|
|
886
|
+
case EXPRESS:
|
|
887
|
+
break test;
|
|
726
888
|
case SCOPED:
|
|
727
889
|
if (queue.inExpress && !iscomment) break test;
|
|
728
890
|
break;
|
|
@@ -851,7 +1013,7 @@ class Program {
|
|
|
851
1013
|
queue.inExpress = true;
|
|
852
1014
|
if (isdigit && lasttype === STAMP) {
|
|
853
1015
|
var prev = last.prev;
|
|
854
|
-
if ((!prev || prev.type & (STAMP | STRAP) && !/^(\+\+|\-\-)$/.test(prev.text)) && /^[+\-]+$/.test(last.text)) {
|
|
1016
|
+
if ((!prev || prev.istype || prev.type & (STAMP | STRAP) && !/^(\+\+|\-\-)$/.test(prev.text)) && /^[+\-]+$/.test(last.text)) {
|
|
855
1017
|
last.type = VALUE;
|
|
856
1018
|
last.text += m;
|
|
857
1019
|
lasttype = VALUE;
|
|
@@ -870,7 +1032,13 @@ class Program {
|
|
|
870
1032
|
continue;
|
|
871
1033
|
}
|
|
872
1034
|
|
|
873
|
-
if (scope_entry[m]) {
|
|
1035
|
+
if (scope_entry[m]) scope: {
|
|
1036
|
+
if (stamp_reg.test(m)) {
|
|
1037
|
+
var last = queue.last;
|
|
1038
|
+
if (last) {
|
|
1039
|
+
if (last.isExpress && !last.istype) break scope;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
874
1042
|
var scope = [];
|
|
875
1043
|
scope.entry = m;
|
|
876
1044
|
scope.type = SCOPED;
|
|
@@ -879,8 +1047,8 @@ class Program {
|
|
|
879
1047
|
scope.row = row;
|
|
880
1048
|
if (m === "{") {
|
|
881
1049
|
if (!last) {
|
|
882
|
-
|
|
883
|
-
|
|
1050
|
+
scope.isObject = queue.inExpress;
|
|
1051
|
+
if (queue.istype) scope.istype = true;
|
|
884
1052
|
}
|
|
885
1053
|
else if (queue.classed) {
|
|
886
1054
|
if (last.type !== STAMP || last.text !== "=>") {
|
|
@@ -893,17 +1061,12 @@ class Program {
|
|
|
893
1061
|
scope.inExpress = false;
|
|
894
1062
|
}
|
|
895
1063
|
}
|
|
896
|
-
else if (last.type === SCOPED && last.istype) {
|
|
897
|
-
scope.isClass = true;
|
|
898
|
-
}
|
|
899
1064
|
else if (last.type === STAMP) {
|
|
900
|
-
if (last.
|
|
901
|
-
scope.isClass = true;
|
|
902
|
-
}
|
|
903
|
-
else if (last.text === ':') {
|
|
1065
|
+
if (last.text === ':') {
|
|
904
1066
|
scope.isObject = queue.inExpress;
|
|
905
1067
|
}
|
|
906
1068
|
else queue.inExpress = scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(last.text);
|
|
1069
|
+
if (last.istype && scope.isObject) scope.istype = true;
|
|
907
1070
|
}
|
|
908
1071
|
else if (last.type === EXPRESS) a: {
|
|
909
1072
|
if (last.text === '...') {
|
|
@@ -960,7 +1123,8 @@ class Program {
|
|
|
960
1123
|
continue;
|
|
961
1124
|
}
|
|
962
1125
|
if (this.scope_leave[m]) {
|
|
963
|
-
|
|
1126
|
+
var last = queue.last;
|
|
1127
|
+
if (!stamp_reg.test(m) || last && !last.isExpress) console.warn(
|
|
964
1128
|
i18n`标记不匹配:`, queue.entry, m,
|
|
965
1129
|
i18n`\r\n文件位置:`, this.mindpath + ":" + `${row}:${index - colstart}`,
|
|
966
1130
|
i18n`\r\n摘要:\r\n`,
|
package/coms/compile/common.js
CHANGED
|
@@ -1328,7 +1328,10 @@ var createString = function (parsed) {
|
|
|
1328
1328
|
|| prev.type === STAMP && !prev.unary && !prev.needle && !prev.isprop
|
|
1329
1329
|
) {
|
|
1330
1330
|
if (intag || prev.type === ELEMENT && o.type === ELEMENT) break a;
|
|
1331
|
-
if (
|
|
1331
|
+
if (
|
|
1332
|
+
(o.type & ~(EXPRESS | PROPERTY) || !needhead_reg.test(o.text))
|
|
1333
|
+
&& (!prev.tag && !o.tag || prev.type === STAMP || o.type === STAMP)
|
|
1334
|
+
) {
|
|
1332
1335
|
result.push(" ");
|
|
1333
1336
|
lasttype = SPACE
|
|
1334
1337
|
}
|
|
@@ -1426,6 +1429,7 @@ var createString = function (parsed) {
|
|
|
1426
1429
|
break;
|
|
1427
1430
|
case QUOTED:
|
|
1428
1431
|
if (!o.length && o.text) {
|
|
1432
|
+
if (prev?.istype && lasttype !== SPACE) result.push(" ");
|
|
1429
1433
|
if (helpcolor) o.text = color.transform(o.text);
|
|
1430
1434
|
result.push(o.text);
|
|
1431
1435
|
break;
|
|
@@ -1468,11 +1472,19 @@ var createString = function (parsed) {
|
|
|
1468
1472
|
if (intag || o.needle || o.type & (EXPRESS | PROPERTY) && (needhead_reg.test(o.text) || lasttype & EXPRESS && needfoot_reg.test(prev?.text))) {
|
|
1469
1473
|
if (prev?.isdigit && !/^0[\dxbo]|[mni]$|[e\.]/.test(prev.text) && lasttype & ~(SPACE | COMMENT)) result.push(" ");
|
|
1470
1474
|
}
|
|
1471
|
-
else if (
|
|
1472
|
-
|
|
1475
|
+
else if (
|
|
1476
|
+
(STRAP | EXPRESS | PROPERTY | COMMENT | VALUE) & lasttype
|
|
1477
|
+
&& (STRAP | EXPRESS | PROPERTY | VALUE | LABEL) & o.type
|
|
1478
|
+
) {
|
|
1479
|
+
if (autospace || prev?.isdigit) result.push(" ");
|
|
1473
1480
|
}
|
|
1474
1481
|
else if (o.prev && o.type === STAMP && !/^[,;]/.test(o.text)) {
|
|
1475
|
-
if (result[result.length - 1] === " "
|
|
1482
|
+
if (result[result.length - 1] === " ");
|
|
1483
|
+
else if (o.text === ':') {
|
|
1484
|
+
var p = o.prev;
|
|
1485
|
+
if ((lasttype === PROPERTY || p && p.isprop || !o.isExpress));
|
|
1486
|
+
else if (autospace) result.push(' ');
|
|
1487
|
+
}
|
|
1476
1488
|
else if (lasttype === STAMP) {
|
|
1477
1489
|
var prev = o.prev;
|
|
1478
1490
|
if (autospace) if (!prev.unary || /[\+\-]$/.test(prev.text) && prev.text === o.text) result.push(" ");
|
package/coms/compile/powermap.js
CHANGED
|
@@ -7,8 +7,8 @@ var powermap = {
|
|
|
7
7
|
'instanceof,in,==,>=,<=,>,<,!=,!==,===,!in,!instanceof'/* 6 */,
|
|
8
8
|
'>>,>>>,<<'/* 7 */, '+,-'/* 8 */, '*,/,%'/* 9 */, '**'/* 10 */,
|
|
9
9
|
'++,--'/* 11 */,
|
|
10
|
-
"typeof,await,yield,
|
|
11
|
-
'
|
|
10
|
+
"typeof,await,yield,delete,void,..."/*12*/,
|
|
11
|
+
'!,~,#,new'/* 13 */,
|
|
12
12
|
"::,?.,->,."/*14*/,
|
|
13
13
|
].forEach((pp, i) => {
|
|
14
14
|
pp.split(",").forEach(p => {
|
package/coms/compile/unstruct.js
CHANGED
|
@@ -282,7 +282,7 @@ var isunary = function (o) {
|
|
|
282
282
|
var f = o.first;
|
|
283
283
|
if (!f) return false;
|
|
284
284
|
while (f) {
|
|
285
|
-
if (f.type & (STAMP | STRAP) && powermap[f.text] < powermap.
|
|
285
|
+
if (f.type & (STAMP | STRAP) && powermap[f.text] < powermap.void) return false;
|
|
286
286
|
f = f.next;
|
|
287
287
|
}
|
|
288
288
|
return true;
|
|
@@ -643,7 +643,7 @@ var _invoke = function (t, getname) {
|
|
|
643
643
|
else if (t.length) {
|
|
644
644
|
if (!isAequalA(t)) {
|
|
645
645
|
var t0 = t[0];
|
|
646
|
-
if ((t0.type === EXPRESS && /^[\.\[]/.test(t0.text) || t0.type & (STAMP | STRAP) && powermap[t0.text] < powermap.
|
|
646
|
+
if ((t0.type === EXPRESS && /^[\.\[]/.test(t0.text) || t0.type & (STAMP | STRAP) && powermap[t0.text] < powermap.void) && result.length) {
|
|
647
647
|
t.unshift(...rescan`${qname}=${qname}`);
|
|
648
648
|
relink(t);
|
|
649
649
|
}
|
|
@@ -980,7 +980,7 @@ var _express = function (body, getname, ret) {
|
|
|
980
980
|
continue;
|
|
981
981
|
}
|
|
982
982
|
if (o.type & (STRAP | STAMP)) {
|
|
983
|
-
if (o.needle) {
|
|
983
|
+
if (o.needle || o.text === 'new') {
|
|
984
984
|
exps.push(o);
|
|
985
985
|
continue;
|
|
986
986
|
}
|
|
@@ -1002,7 +1002,7 @@ var _express = function (body, getname, ret) {
|
|
|
1002
1002
|
if (maxindex < nameindex) maxindex = nameindex;
|
|
1003
1003
|
}
|
|
1004
1004
|
bx = cx + 1;
|
|
1005
|
-
if (!isor) if (!cache.length || p > cache[cache.length - 1] || p >= powermap.
|
|
1005
|
+
if (!isor) if (!cache.length || p > cache[cache.length - 1] || p >= powermap.void) {
|
|
1006
1006
|
cache.push(b, p);
|
|
1007
1007
|
continue;
|
|
1008
1008
|
}
|
|
@@ -1241,7 +1241,7 @@ function toqueue(body, getname, ret = false, result = []) {
|
|
|
1241
1241
|
continue;
|
|
1242
1242
|
}
|
|
1243
1243
|
a: if (o.type === STRAP) {
|
|
1244
|
-
if (/^(
|
|
1244
|
+
if (/^(typeof|delete|await|void|debugger)$/.test(o.text)) {
|
|
1245
1245
|
break a;
|
|
1246
1246
|
}
|
|
1247
1247
|
if (/^(var|let|const)$/i.test(o.text)) {
|
|
@@ -165,7 +165,9 @@ test(`while (a && b);`, '_ = a; if (!_) return [1, 0]; _ = b;\r\n if (!_) return
|
|
|
165
165
|
test(`while (a < b);`, '_ = a < b; if (!_) return [1, 0]; return [0, 0]', true);
|
|
166
166
|
test(`if (a() > a+b);`, '_ = a(), _0 = a + b, _ = _ > _0; if (!_) return [1, 0]; return [1, 0]', true);
|
|
167
167
|
test(`index > start && result.length < pageSize`, '_ = index > start; if (!_) return [1, 0]; _ = result.length, _ < pageSize', true);
|
|
168
|
-
unstruct.debug = true; r++;
|
|
169
168
|
test(`menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = str__v_; _1 = version[0]; _2 = str__v_1; _0 = [_0, _1, _2]; _0 = _0[str_join](""); _1 = _[str_name], _1 = _1 + _0; _[str_name] = _1`);
|
|
170
169
|
test(`a.b.c += menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = str__v_; _1 = version[0]; _2 = str__v_1; _0 = [_0, _1, _2]; _0 = _0[str_join](""); _1 = _[str_name], _1 = _1 + _0; _[str_name] = _1; _2 = a.b.c, _2 = _2 + _1; a.b.c = _2`);
|
|
171
170
|
test(`menus[0].c += menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = menus[0]; _1 = str__v_; _2 = version[0]; _3 = str__v_1; _1 = [_1, _2, _3]; _1 = _1[str_join](""); _2 = _0[str_name], _2 = _2 + _1; _0[str_name] = _2; _3 = _.c, _3 = _3 + _2; _.c = _3`);
|
|
171
|
+
unstruct.debug = true; r++;
|
|
172
|
+
test(`new Array(2).join("") + 1`, `_0 = new Array(2); _ = _0.join(""), _ + 1`);
|
|
173
|
+
test(`new window.Array(2).join("") + 1`, `_0 = new window.Array(2); _ = _0.join(""), _ + 1`);
|
package/coms/frame/list.js
CHANGED
|
@@ -52,7 +52,7 @@ function main(gtTitle, { fields: gtFields, options: gtOptions, load, remove, but
|
|
|
52
52
|
var fields1 = fields.filter(f => !f.hidden && f.inlist !== false).concat({
|
|
53
53
|
name: i18n`操作`,
|
|
54
54
|
options
|
|
55
|
-
})
|
|
55
|
+
});
|
|
56
56
|
fieldsL = gt(fields1, fieldsL);
|
|
57
57
|
};
|
|
58
58
|
if (isString(edit_ref)) prepare(edit_ref);
|
|
@@ -94,7 +94,7 @@ function main(gtTitle, { fields: gtFields, options: gtOptions, load, remove, but
|
|
|
94
94
|
load() {
|
|
95
95
|
this.data = load();
|
|
96
96
|
},
|
|
97
|
-
fields,
|
|
97
|
+
fields: fieldsL,
|
|
98
98
|
buttons,
|
|
99
99
|
hasedit: !!edit_ref,
|
|
100
100
|
data: [],
|
package/coms/zimoli/moveupon.js
CHANGED
|
@@ -29,7 +29,9 @@ if (/Firefox/.test(navigator.userAgent)) on('dragstart')(document, function (e)
|
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
var locktouch = function (target) {
|
|
32
|
+
var locktouch = function (target, handles) {
|
|
33
|
+
var resizing = moveupon.resizing;
|
|
34
|
+
if (resizing) return resizing !== handles;
|
|
33
35
|
if (target.resizable) return false;
|
|
34
36
|
if (/(input|textarea|select)/i.test(target.tagName) || getTargetIn(a => String(a.contentEditable) === 'true' || a.draggable, target)) {
|
|
35
37
|
return true;
|
|
@@ -49,7 +51,8 @@ var locktouch = function (target) {
|
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
function moveupon(target,
|
|
54
|
+
function moveupon(target, handles, initialEvent) {
|
|
55
|
+
var { start, move, end } = handles;
|
|
53
56
|
var touchLocked = false;
|
|
54
57
|
var offmouseup, offtouchend, offtouchcancel;
|
|
55
58
|
var mousemove = function (event) {
|
|
@@ -83,7 +86,7 @@ function moveupon(target, { start, move, end }, initialEvent) {
|
|
|
83
86
|
};
|
|
84
87
|
|
|
85
88
|
if (initialEvent) {
|
|
86
|
-
if (locktouch(initialEvent.target)) return;
|
|
89
|
+
if (locktouch(initialEvent.target, handles)) return;
|
|
87
90
|
if (initialEvent.type === "touchstart") {
|
|
88
91
|
extendTouchEvent(initialEvent);
|
|
89
92
|
initialEvent.preventDefault();
|
|
@@ -96,14 +99,14 @@ function moveupon(target, { start, move, end }, initialEvent) {
|
|
|
96
99
|
}
|
|
97
100
|
onmousedown(target, function (event) {
|
|
98
101
|
if (touchLocked) return;
|
|
99
|
-
if (locktouch(event.target)) return;
|
|
102
|
+
if (locktouch(event.target, handles)) return;
|
|
100
103
|
touchLocked = true;
|
|
101
104
|
hookmouse(event);
|
|
102
105
|
if (isFunction(start)) start.call(this, event);
|
|
103
106
|
});
|
|
104
107
|
ontouchstart(target, function (event) {
|
|
105
108
|
if (touchLocked) return;
|
|
106
|
-
if (locktouch(event.target)) return;
|
|
109
|
+
if (locktouch(event.target, handles)) return;
|
|
107
110
|
touchLocked = true;
|
|
108
111
|
extendTouchEvent(event);
|
|
109
112
|
hooktouch(event);
|
package/coms/zimoli/prompt.js
CHANGED
|
@@ -42,6 +42,7 @@ function prompt() {
|
|
|
42
42
|
else if (isFunction(arg) || arg instanceof RegExp) check = arg;
|
|
43
43
|
else if (isObject(arg)) {
|
|
44
44
|
if (isFunction(arg.test)) check = arg;
|
|
45
|
+
if (isFunction(arg.check)) check = arg.check;
|
|
45
46
|
if (isFunction(arg.submit)) submit = arg;
|
|
46
47
|
if (isString(arg.msg || arg.title)) msg = arg.msg || arg.title;
|
|
47
48
|
if (isHandled(arg.value)) value = arg.value;
|
package/coms/zimoli/resize.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
var resizingElements = [];
|
|
2
|
+
var currentResizing = null;
|
|
2
3
|
var getResizer = function (event) {
|
|
4
|
+
moveupon.resizing = null;
|
|
3
5
|
if (dragging) return;
|
|
4
6
|
var rect = getTargetIn(a => ~resizingElements.indexOf(a), event.target);
|
|
5
7
|
if (!rect) {
|
|
@@ -46,6 +48,7 @@ var getResizer = function (event) {
|
|
|
46
48
|
resize.height = parseFloat(computedStyle.height);
|
|
47
49
|
resize.rect = rect;
|
|
48
50
|
resize.cursor = fringe.cursor;
|
|
51
|
+
moveupon.resizing = handle;
|
|
49
52
|
return resize;
|
|
50
53
|
}
|
|
51
54
|
};
|
package/coms/zimoli/tree.js
CHANGED
|
@@ -201,6 +201,7 @@ function tree() {
|
|
|
201
201
|
css(banner, { paddingBottom: '' });
|
|
202
202
|
};
|
|
203
203
|
var time = size => (Math.log(-size / 30 + 2) * 100 | 0) / 1000;
|
|
204
|
+
var maxAnimateHeight = Math.min(element.clientHeight >> 1, screen.height >> 1) || 100;
|
|
204
205
|
if (com.isClosed() && com.length) {
|
|
205
206
|
z0();
|
|
206
207
|
setState(true);
|
|
@@ -213,6 +214,7 @@ function tree() {
|
|
|
213
214
|
} else {
|
|
214
215
|
marginTop = top.offsetTop - bottom.offsetTop - bottom.offsetHeight;
|
|
215
216
|
}
|
|
217
|
+
if (maxAnimateHeight && marginTop < -maxAnimateHeight) marginTop = -maxAnimateHeight | 0;
|
|
216
218
|
var res = transition(top, {
|
|
217
219
|
transition: `margin-top ${time(marginTop)}s ease-out`,
|
|
218
220
|
marginTop: fromOffset(marginTop)
|
|
@@ -231,7 +233,8 @@ function tree() {
|
|
|
231
233
|
}
|
|
232
234
|
setState(false);
|
|
233
235
|
z0();
|
|
234
|
-
var
|
|
236
|
+
var maxAnimateHeight = 100;
|
|
237
|
+
if (maxAnimateHeight && margin_top < -maxAnimateHeight) margin_top = -maxAnimateHeight | 0;
|
|
235
238
|
var res = transition(change_elem, { transition: `margin-top ${time(margin_top)}s ease-out`, marginTop: fromOffset(margin_top) }, false);
|
|
236
239
|
timeout(z1, res + 60);
|
|
237
240
|
}
|
|
@@ -50,17 +50,22 @@ var codecolor = function (c, encode) {
|
|
|
50
50
|
isConstValue = a => strap_reg.test(a) || value_reg.test(a);
|
|
51
51
|
}
|
|
52
52
|
var isInvoke = function (o) {
|
|
53
|
-
var
|
|
53
|
+
var p = o.prev;
|
|
54
|
+
if (p?.type === STRAP && /^(invoke|call)$/i.test(p.text)) return true;
|
|
55
|
+
o = o.next;
|
|
56
|
+
if (o?.type === STRAP && /^(proc|endp)$/i.test(o.text)) return true;
|
|
54
57
|
if (o?.type === EXPRESS && needhead_reg.test(o.text)) o = o.next;
|
|
55
58
|
if (o?.type === ELEMENT && o.istype) o = o.next;
|
|
56
59
|
if (o?.type === STAMP && o.needle) o = o.next;
|
|
57
60
|
if (o?.type === SCOPED && o.entry === "(") return true;
|
|
61
|
+
|
|
58
62
|
return false;
|
|
59
63
|
};
|
|
60
64
|
var setExpress = function (o, label) {
|
|
61
65
|
if (!o.text || o.wraped) return;
|
|
62
66
|
o.wraped = true;
|
|
63
67
|
var keys = o.text.split(".");
|
|
68
|
+
if (!keys[0] && keys.length > 1) keys.shift(), keys[0] = "." + keys[0];
|
|
64
69
|
var invoked = null;
|
|
65
70
|
var endi = keys.length - 1;
|
|
66
71
|
if (isInvoke(o)) {
|
|
@@ -86,7 +91,7 @@ var codecolor = function (c, encode) {
|
|
|
86
91
|
used[k].forEach(k in predefs ? setPredef : setOutside);
|
|
87
92
|
}
|
|
88
93
|
if (c.program) var { space_exp: spaceReg, control_reg } = c.program;
|
|
89
|
-
if (spaceReg) var unspaceReg = new RegExp(`(?:${spaces.avoid(光标)}
|
|
94
|
+
if (spaceReg) var unspaceReg = new RegExp(`(?:${spaces.avoid(光标)})+`, 'g');
|
|
90
95
|
var wraptext = function (t, l) {
|
|
91
96
|
if (unspaceReg) t = t.replace(unspaceReg, a => {
|
|
92
97
|
if (encode) a = encode(a);
|
|
@@ -159,7 +164,6 @@ var codecolor = function (c, encode) {
|
|
|
159
164
|
setExpress(o, 'method');
|
|
160
165
|
}
|
|
161
166
|
else setExpress(o, 'property');
|
|
162
|
-
|
|
163
167
|
break;
|
|
164
168
|
case EXPRESS:
|
|
165
169
|
setExpress(o, o.istype || o.isdef || o.next?.needle ? 'predef' : 'express');
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
if (ta === " " && isEqual(tb, anchorChar)) {
|
|
203
203
|
col++;
|
|
204
204
|
}
|
|
205
|
-
else if (isEqual(ta, anchorChar) && !isEqual(tb, anchorChar)) {
|
|
205
|
+
else if (anchorChar && tb && isEqual(ta, anchorChar) && !isEqual(tb, anchorChar)) {
|
|
206
206
|
col++;
|
|
207
207
|
}
|
|
208
208
|
else if (anchorChar === " " && isEqual(ta, followChar) && !isEqual(tf, followChar)) {
|
|
@@ -286,6 +286,8 @@
|
|
|
286
286
|
};
|
|
287
287
|
var updatechar = function (event) {
|
|
288
288
|
if (event.defaultPrevented) return;
|
|
289
|
+
anchorChar = "";
|
|
290
|
+
followChar = '';
|
|
289
291
|
coderid++;
|
|
290
292
|
var { anchorNode, anchorOffset } = document_selection;
|
|
291
293
|
if (!coder || !anchorNode) return;
|
|
@@ -452,7 +454,7 @@
|
|
|
452
454
|
document.execCommand('forwardDelete');
|
|
453
455
|
}
|
|
454
456
|
else if (data in pairsmap) {
|
|
455
|
-
if (inText) {
|
|
457
|
+
if (inText && anchorChar) {
|
|
456
458
|
if (/^'/.test(data)) return;
|
|
457
459
|
}
|
|
458
460
|
patchAfter = pairsmap[data];
|
|
@@ -460,7 +462,7 @@
|
|
|
460
462
|
}
|
|
461
463
|
else {
|
|
462
464
|
if (data in pairsmap) {
|
|
463
|
-
if (inText) {
|
|
465
|
+
if (inText && anchorChar) {
|
|
464
466
|
if (/^'/.test(data)) return;
|
|
465
467
|
}
|
|
466
468
|
patchAfter = pairsmap[data];
|
|
@@ -482,6 +484,7 @@
|
|
|
482
484
|
}
|
|
483
485
|
if (patchAfter) {
|
|
484
486
|
insertText(patchAfter, true);
|
|
487
|
+
followChar = patchAfter;
|
|
485
488
|
markAnchorOffset();
|
|
486
489
|
}
|
|
487
490
|
return patchAfter;
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
var { SCOPED, QUOTED, SPACE, STAMP, STRAP, EXPRESS, PROPERTY } = compile$common;
|
|
2
|
-
var asm = new compile$
|
|
3
|
-
asm.straps = [
|
|
4
|
-
"include", "includelib",
|
|
5
|
-
"typedef",
|
|
6
|
-
"proto",
|
|
7
|
-
'equ', "and", 'or', 'not', "sizeof",
|
|
8
|
-
"invoke", "offset", 'addr',
|
|
9
|
-
"end", "start",
|
|
10
|
-
"proc", "endp", "uses",
|
|
11
|
-
"macro", 'struct', "ends",
|
|
12
|
-
".if", ".elseif", '.else', '.break', '.endif', '.while', '.endw', "db", 'real4', 'real8', 'dw', 'dd', 'dq', 'byte', 'word', 'dword', 'qword', 'tword', 'dt',
|
|
13
|
-
];
|
|
14
|
-
asm.control_reg = /^\.[\w]+$/;
|
|
15
|
-
asm.stamps = [",", ":", "<", ">", "=", "&", "|", "*", "~", "!", "+", "-", '/'];
|
|
16
|
-
asm.quotes = [
|
|
17
|
-
["'", "'"],
|
|
18
|
-
['"', '"']
|
|
19
|
-
];
|
|
20
|
-
asm.comments = [
|
|
21
|
-
[";", /(?=[\r\n\u2028\u2029])/]
|
|
22
|
-
];
|
|
23
|
-
|
|
2
|
+
var asm = new compile$Asm;
|
|
24
3
|
var go = new compile$Javascript;
|
|
25
4
|
go.straps = ["var", 'for', 'package', "import", 'type', 'func', 'struct', 'return', 'go', 'const', 'if', 'else', 'switch', 'case', 'default', 'range'];
|
|
26
5
|
go.istype = function (o) {
|