efront 4.36.6 → 4.37.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 +9 -0
- package/apps/pivot/db/config.xht +1 -0
- package/apps/pivot/main.js +1 -0
- package/apps/pivot/todo/edit.xht +0 -1
- package/apps/pivot/todo/list.xht +12 -8
- package/coms/basic/#loader.js +0 -1
- package/coms/basic/SAFE_CIRCLE_DEPTH.js +1 -0
- package/coms/basic/cross_.js +6 -4
- package/coms/basic/encode62.js +3 -3
- package/coms/basic/math.md +1 -1
- package/coms/basic/randomUUID.js +17 -0
- package/coms/basic/verifyUUID.js +18 -0
- package/coms/basic_/&power.js +1 -1
- package/coms/basic_/JSON.js +4 -3
- package/coms/basic_/JSON_test.js +19 -11
- package/coms/compile/Javascript.js +16 -12
- package/coms/compile/auto-const.js +55 -16
- package/coms/compile/autoprop.js +274 -0
- package/coms/compile/common.js +81 -8
- package/coms/compile/const_test.js +2 -1
- package/coms/compile/downLevel.js +2 -2
- package/coms/compile/getMaped.js +25 -21
- package/coms/compile/namelist.js +4 -0
- package/coms/compile/scanner.js +21 -13
- package/coms/compile/scanner_test.js +11 -10
- package/coms/compile/translate.js +1 -1
- package/coms/crypt/encode62.js +3 -3
- package/coms/pivot/DB.js +9 -0
- package/coms/pivot/todo.xht +2 -1
- package/coms/reptile/cross.js +8 -1
- package/coms/zimoli/popup.js +8 -1
- package/coms/zimoli/scrollbar.js +5 -2
- package/coms/zimoli/scrollbar.less +26 -2
- package/coms/zimoli/table.less +3 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/public//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +2 -2
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
var {
|
|
2
|
+
STAMP,
|
|
3
|
+
EXPRESS,
|
|
4
|
+
SCOPED,
|
|
5
|
+
QUOTED,
|
|
6
|
+
PROPERTY,
|
|
7
|
+
STRAP,
|
|
8
|
+
getDeclared,
|
|
9
|
+
pickAssignment,
|
|
10
|
+
createString,
|
|
11
|
+
snapExpressFoot,
|
|
12
|
+
collectArgument,
|
|
13
|
+
collectProperty,
|
|
14
|
+
skipAssignment,
|
|
15
|
+
snapAssignmentHead
|
|
16
|
+
} = require("./common.js");
|
|
17
|
+
var strings = require('../basic/strings.js');
|
|
18
|
+
var namelist = require("./namelist.js");
|
|
19
|
+
var keepSet = new Set;
|
|
20
|
+
var skip = 0;
|
|
21
|
+
function addKeepName(a) {
|
|
22
|
+
if (!a || keepSet.has(a)) return;
|
|
23
|
+
keepSet.add(a);
|
|
24
|
+
}
|
|
25
|
+
[
|
|
26
|
+
{},
|
|
27
|
+
Object.prototype,
|
|
28
|
+
[],
|
|
29
|
+
Array.prototype,
|
|
30
|
+
Uint8Array.prototype,
|
|
31
|
+
"",
|
|
32
|
+
String.prototype,
|
|
33
|
+
false,
|
|
34
|
+
Boolean.prototype,
|
|
35
|
+
0,
|
|
36
|
+
Number.prototype,
|
|
37
|
+
/0/,
|
|
38
|
+
RegExp.prototype,
|
|
39
|
+
function () { },
|
|
40
|
+
Function.prototype,
|
|
41
|
+
Promise.prototype,
|
|
42
|
+
].forEach(o => {
|
|
43
|
+
if (o) for (var n of Object.getOwnPropertyNames(o)) {
|
|
44
|
+
addKeepName(n);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
[
|
|
48
|
+
'constructor', 'readBigUInt64LE', 'readBigUInt64BE', 'readBigUint64LE',
|
|
49
|
+
'readBigUint64BE', 'readBigInt64LE', 'readBigInt64BE', 'writeBigUInt64LE',
|
|
50
|
+
'writeBigUInt64BE', 'writeBigUint64LE', 'writeBigUint64BE', 'writeBigInt64LE',
|
|
51
|
+
'writeBigInt64BE', 'readUIntLE', 'readUInt32LE', 'readUInt16LE',
|
|
52
|
+
'readUInt8', 'readUIntBE', 'readUInt32BE', 'readUInt16BE',
|
|
53
|
+
'readUintLE', 'readUint32LE', 'readUint16LE', 'readUint8',
|
|
54
|
+
'readUintBE', 'readUint32BE', 'readUint16BE', 'readIntLE',
|
|
55
|
+
'readInt32LE', 'readInt16LE', 'readInt8', 'readIntBE',
|
|
56
|
+
'readInt32BE', 'readInt16BE', 'writeUIntLE', 'writeUInt32LE',
|
|
57
|
+
'writeUInt16LE', 'writeUInt8', 'writeUIntBE', 'writeUInt32BE',
|
|
58
|
+
'writeUInt16BE', 'writeUintLE', 'writeUint32LE', 'writeUint16LE',
|
|
59
|
+
'writeUint8', 'writeUintBE', 'writeUint32BE', 'writeUint16BE',
|
|
60
|
+
'writeIntLE', 'writeInt32LE', 'writeInt16LE', 'writeInt8',
|
|
61
|
+
'writeIntBE', 'writeInt32BE', 'writeInt16BE', 'readFloatLE',
|
|
62
|
+
'readFloatBE', 'readDoubleLE', 'readDoubleBE', 'writeFloatLE',
|
|
63
|
+
'writeFloatBE', 'writeDoubleLE', 'writeDoubleBE', 'asciiSlice',
|
|
64
|
+
'base64Slice', 'base64urlSlice', 'latin1Slice', 'hexSlice',
|
|
65
|
+
'ucs2Slice', 'utf8Slice', 'asciiWrite', 'base64Write',
|
|
66
|
+
'base64urlWrite', 'latin1Write', 'hexWrite', 'ucs2Write',
|
|
67
|
+
'utf8Write', 'parent', 'offset', 'copy',
|
|
68
|
+
'toString', 'equals', 'inspect', 'compare',
|
|
69
|
+
'indexOf', 'lastIndexOf', 'includes', 'fill',
|
|
70
|
+
'write', 'toJSON', 'subarray', 'slice',
|
|
71
|
+
'swap16', 'swap32', 'swap64', 'toLocaleString',
|
|
72
|
+
"callee", "null", "true", "false", "boolean", "string", "number",
|
|
73
|
+
"function", "object", "undefined", "symbol", "get", "set", "value",
|
|
74
|
+
"enumerable", "configurable", "require", "from"
|
|
75
|
+
].forEach(a => keepSet.add(a));
|
|
76
|
+
function addPropSeek(dec, used) {
|
|
77
|
+
for (var d of dec) {
|
|
78
|
+
for (var o of used[d]) addKeepEqual(o);
|
|
79
|
+
}
|
|
80
|
+
if (dec.attributes) for (var [name, node] of dec.attributes) {
|
|
81
|
+
addKeepName(name);
|
|
82
|
+
if (node.attributes) addPropSeek(node, used);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function forPropName(o, add) {
|
|
86
|
+
var ks = o.text.split('.').slice(1).forEach(add);
|
|
87
|
+
var n = o.next;
|
|
88
|
+
while (n) {
|
|
89
|
+
if (n.type === EXPRESS) {
|
|
90
|
+
if (/\.$/.test(o.text));
|
|
91
|
+
else if (!/^\./.test(n.text)) break;
|
|
92
|
+
n.text.split('.').forEach(add);
|
|
93
|
+
o = n;
|
|
94
|
+
n = o.next;
|
|
95
|
+
}
|
|
96
|
+
else if (n.type === SCOPED) {
|
|
97
|
+
if (n.entry === '{') break;
|
|
98
|
+
if (n.entry === '(') {
|
|
99
|
+
if (add === addKeepName && n.prev === o) {
|
|
100
|
+
addKeepParam(n);
|
|
101
|
+
}
|
|
102
|
+
o = n;
|
|
103
|
+
n = n.next;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
var f = n.first;
|
|
107
|
+
if (!f || f !== n.last || f.type !== QUOTED || f.length) {
|
|
108
|
+
o = n;
|
|
109
|
+
n = o.next;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
add(strings.decode(n.text));
|
|
113
|
+
o = n;
|
|
114
|
+
n = o.next;
|
|
115
|
+
}
|
|
116
|
+
else break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function addKeepEnv(o) {
|
|
120
|
+
forPropName(o, addKeepName);
|
|
121
|
+
addKeepEqual(o);
|
|
122
|
+
}
|
|
123
|
+
function addHideExp(o) {
|
|
124
|
+
forPropName(o, addHideName)
|
|
125
|
+
}
|
|
126
|
+
var keeping = new Set;
|
|
127
|
+
function addKeepEqual(o) {
|
|
128
|
+
var p = o.prev;
|
|
129
|
+
if (p && p.type === STRAP && p.text === 'new') p = p.prev;
|
|
130
|
+
if (!p || p.type !== STAMP || p.text !== "=") return;
|
|
131
|
+
var h = snapAssignmentHead(p);
|
|
132
|
+
if (keeping.has(h)) return;
|
|
133
|
+
keeping.add(h);
|
|
134
|
+
while (h !== p) {
|
|
135
|
+
switch (h.type) {
|
|
136
|
+
case STAMP: break;
|
|
137
|
+
case EXPRESS:
|
|
138
|
+
if (h.scoped && h.tack === h.text) {
|
|
139
|
+
var { used } = h.scoped;
|
|
140
|
+
for (var o of used[h.tack]) {
|
|
141
|
+
if (o === h) continue;
|
|
142
|
+
forPropName(o, addKeepName);
|
|
143
|
+
addKeepEqual(o);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case SCOPED:
|
|
148
|
+
if (h.entry !== '{' || !h.first) break;
|
|
149
|
+
var dec = getDeclared(h.first)[0];
|
|
150
|
+
|
|
151
|
+
var { used } = h.scoped;
|
|
152
|
+
addPropSeek(dec, used);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
h = h.next;
|
|
156
|
+
}
|
|
157
|
+
keeping.delete(h);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function addKeepParam(o) {
|
|
161
|
+
if (keeping.has(o)) return;
|
|
162
|
+
keeping.add(o);
|
|
163
|
+
switch (o.type) {
|
|
164
|
+
case SCOPED:
|
|
165
|
+
if (!o.brace) {
|
|
166
|
+
var args = collectArgument(o);
|
|
167
|
+
for (var a of args) {
|
|
168
|
+
if (a.length !== 1) continue;
|
|
169
|
+
addKeepParam(a[0]);
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
if (!o.isObject) break;
|
|
175
|
+
var props = collectProperty(o);
|
|
176
|
+
for (var k in props) {
|
|
177
|
+
var v = props[k];
|
|
178
|
+
addKeepName(k);
|
|
179
|
+
if (v.length !== 1) continue;
|
|
180
|
+
addKeepParam(v[0]);
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
case EXPRESS:
|
|
184
|
+
case PROPERTY:
|
|
185
|
+
if (o.isprop) {
|
|
186
|
+
addKeepName(o.text);
|
|
187
|
+
if (o.short) {
|
|
188
|
+
var { used } = o.scoped;
|
|
189
|
+
used[o.tack].forEach(addKeepParam);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
var { used } = o.scoped;
|
|
195
|
+
used[o.tack].forEach(a => {
|
|
196
|
+
var eq = a.equal;
|
|
197
|
+
if (eq && eq.text === '=') {
|
|
198
|
+
var n = eq.next;
|
|
199
|
+
if (!n.isObject) return;
|
|
200
|
+
var n1 = skipAssignment(eq.next);
|
|
201
|
+
if (n1 !== n.next) return;
|
|
202
|
+
addKeepParam(n);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
case QUOTED:
|
|
208
|
+
if (!o.length) {
|
|
209
|
+
addKeepString(o.text);
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
keeping.delete(o);
|
|
215
|
+
}
|
|
216
|
+
var hideMap = new Map;
|
|
217
|
+
function addHideName(text) {
|
|
218
|
+
if (hideMap.has(text) || keepSet.has(text)) return;
|
|
219
|
+
var name = namelist(1, keepSet, skip);
|
|
220
|
+
skip = name.skip;
|
|
221
|
+
var replace = `"${name[0]}"/* ${text} */`;
|
|
222
|
+
hideMap.set(text, replace);
|
|
223
|
+
return replace;
|
|
224
|
+
}
|
|
225
|
+
function addHideString(text) {
|
|
226
|
+
text = strings.decode(text);
|
|
227
|
+
addHideName(text);
|
|
228
|
+
}
|
|
229
|
+
function addKeepString(text) {
|
|
230
|
+
text = strings.decode(text);
|
|
231
|
+
addKeepName(text);
|
|
232
|
+
}
|
|
233
|
+
function addKeepCode(code) {
|
|
234
|
+
for (var o of code) {
|
|
235
|
+
switch (o.type) {
|
|
236
|
+
case SCOPED:
|
|
237
|
+
addKeepCode(o);
|
|
238
|
+
break;
|
|
239
|
+
case QUOTED:
|
|
240
|
+
if (o.length) {
|
|
241
|
+
addKeepCode(o);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
var text = o.text;
|
|
245
|
+
if (!/^['"`]/.test(text)) break;
|
|
246
|
+
text = strings.decode(text);
|
|
247
|
+
addKeepString(o.text);
|
|
248
|
+
break;
|
|
249
|
+
case PROPERTY:
|
|
250
|
+
// if (o.kind) addHideName(o.text);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function addKeepBody(code) {
|
|
255
|
+
addKeepCode(code);
|
|
256
|
+
var { used, envs } = code;
|
|
257
|
+
if (used.this && !envs.module && !envs.exports) {
|
|
258
|
+
used.this.forEach(addKeepEnv);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function autoprop(text) {
|
|
262
|
+
text = strings.decode(text);
|
|
263
|
+
if (keepSet.has(text)) return strings.encode(text);
|
|
264
|
+
if (hideMap.has(text)) return hideMap.get(text);
|
|
265
|
+
return strings.encode(text);
|
|
266
|
+
}
|
|
267
|
+
module.exports = autoprop;
|
|
268
|
+
autoprop.addKeepName = addKeepName;
|
|
269
|
+
autoprop.addHideName = addHideName;
|
|
270
|
+
autoprop.addKeepEnv = addKeepEnv;
|
|
271
|
+
autoprop.addHideExp = addHideExp;
|
|
272
|
+
autoprop.addKeepEqual = addKeepEqual;
|
|
273
|
+
autoprop.addMapedString = addHideString;
|
|
274
|
+
autoprop.addKeepBody = addKeepBody;
|
package/coms/compile/common.js
CHANGED
|
@@ -323,6 +323,7 @@ var getFunctionHeadBeforeScoped = function (p) {
|
|
|
323
323
|
}
|
|
324
324
|
function snapAssignmentHead(o) {
|
|
325
325
|
// 只检查一级
|
|
326
|
+
if (o.type === STAMP && o.prev) o = o.prev;
|
|
326
327
|
while (o && getprev(o)) {
|
|
327
328
|
var p = getprev(o);
|
|
328
329
|
while (p.type === LABEL) {
|
|
@@ -549,11 +550,20 @@ var snapExpressFoot = function (o) {
|
|
|
549
550
|
}
|
|
550
551
|
return o;
|
|
551
552
|
};
|
|
553
|
+
var patchScoped = function (os, scoped) {
|
|
554
|
+
for (var u of os) {
|
|
555
|
+
u.scoped = scoped;
|
|
556
|
+
if (u.kind) {
|
|
557
|
+
while (u && !u.equal) u = u.queue;
|
|
558
|
+
if (u) u.scoped = scoped;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
};
|
|
552
562
|
var createScoped = function (parsed, wash) {
|
|
553
563
|
var used = Object.create(null); var vars = Object.create(null), lets = vars;
|
|
554
564
|
var scoped = [], funcbody = scoped, argscope = scoped, thisscope = scoped, labelused = used;
|
|
555
565
|
funcbody.isroot = true;
|
|
556
|
-
scoped
|
|
566
|
+
Object.defineProperty(scoped, 'body', { value: parsed, enumerable: false, configurable: true });
|
|
557
567
|
scoped.isfunc = true;
|
|
558
568
|
var dec = function (map, o) {
|
|
559
569
|
var kind = o.text;
|
|
@@ -917,10 +927,11 @@ var createScoped = function (parsed, wash) {
|
|
|
917
927
|
var n = skipAssignment(o);
|
|
918
928
|
scoped.arraw = o;
|
|
919
929
|
while (o !== n) {
|
|
920
|
-
|
|
930
|
+
n1 = run(o, 0);
|
|
921
931
|
if (n1 === o || n1?.entry === "{") o = getnext(n1);
|
|
922
932
|
else o = n1;
|
|
923
933
|
}
|
|
934
|
+
o = n1;
|
|
924
935
|
}
|
|
925
936
|
else {
|
|
926
937
|
var n = skipSentenceQueue(o);
|
|
@@ -948,6 +959,7 @@ var createScoped = function (parsed, wash) {
|
|
|
948
959
|
}
|
|
949
960
|
}
|
|
950
961
|
else {
|
|
962
|
+
patchScoped(used[k], scoped);
|
|
951
963
|
caps[k] = used[k];
|
|
952
964
|
}
|
|
953
965
|
}
|
|
@@ -1007,6 +1019,7 @@ var createScoped = function (parsed, wash) {
|
|
|
1007
1019
|
scoped.used = used;
|
|
1008
1020
|
scoped.vars = vars;
|
|
1009
1021
|
scoped.caps = used;
|
|
1022
|
+
for (var k in used) patchScoped(used[k], scoped);
|
|
1010
1023
|
var envs = Object.create(null);
|
|
1011
1024
|
for (var u in used) {
|
|
1012
1025
|
if (!(u in vars)) {
|
|
@@ -1086,10 +1099,9 @@ var getDeclared = function (o, kind, queue) {
|
|
|
1086
1099
|
prop = `[${prop}]`;
|
|
1087
1100
|
}
|
|
1088
1101
|
else if (o.isdigit) prop = `[${prop}]`;
|
|
1089
|
-
else if (!/^\[[\s\S]*\]$/.test(prop)) prop = "." + prop;
|
|
1090
|
-
skiped.push(o);
|
|
1091
1102
|
var n = getnext(o);
|
|
1092
1103
|
if (n?.type === STAMP && n.text === ":") {
|
|
1104
|
+
skiped.push(o);
|
|
1093
1105
|
o = getnext(n);
|
|
1094
1106
|
}
|
|
1095
1107
|
}
|
|
@@ -1139,7 +1151,7 @@ var getDeclared = function (o, kind, queue) {
|
|
|
1139
1151
|
var n = getnext(o);
|
|
1140
1152
|
if (n) {
|
|
1141
1153
|
if (n.type === STAMP && n.text === ":" || n.type === STRAP && n.text === "as") {
|
|
1142
|
-
prop =
|
|
1154
|
+
prop = o.text;
|
|
1143
1155
|
o = getnext(n);
|
|
1144
1156
|
continue;
|
|
1145
1157
|
}
|
|
@@ -1250,6 +1262,7 @@ var saveTo = function (used, k, o) {
|
|
|
1250
1262
|
};
|
|
1251
1263
|
|
|
1252
1264
|
var mergeTo = function (used, used0) {
|
|
1265
|
+
if (used === used0) return;
|
|
1253
1266
|
for (var k in used0) {
|
|
1254
1267
|
var v = used0[k];
|
|
1255
1268
|
if (!used[k]) used[k] = [];
|
|
@@ -1882,8 +1895,11 @@ var insertAfter = function () {
|
|
|
1882
1895
|
if (next) next.prev = o;
|
|
1883
1896
|
else queue.last = o;
|
|
1884
1897
|
};
|
|
1885
|
-
var unshort = function (o,
|
|
1886
|
-
|
|
1898
|
+
var unshort = function (o, name) {
|
|
1899
|
+
if (!name || typeof name === 'string') {
|
|
1900
|
+
name = { text: name || o.text, short: false, isprop: true, type: PROPERTY };
|
|
1901
|
+
}
|
|
1902
|
+
insertBefore.call(o.queue, o, name, { text: ':', type: STAMP });
|
|
1887
1903
|
o.isprop = false;
|
|
1888
1904
|
o.type = EXPRESS;
|
|
1889
1905
|
delete o.short;
|
|
@@ -1964,7 +1980,62 @@ var isDeclareOnly = function (o) {
|
|
|
1964
1980
|
if (!n) return true;
|
|
1965
1981
|
if (n.type !== STAMP || /^[,;]$/.test(n.text)) return true;
|
|
1966
1982
|
return false;
|
|
1967
|
-
}
|
|
1983
|
+
};
|
|
1984
|
+
|
|
1985
|
+
var collectArgument = function (q) {
|
|
1986
|
+
var t = q.first;
|
|
1987
|
+
var index = 0;
|
|
1988
|
+
var args = [];
|
|
1989
|
+
while (t) {
|
|
1990
|
+
var n = t.next;
|
|
1991
|
+
while (n && (n.type !== STAMP || n.text !== ',')) n = n.next;
|
|
1992
|
+
var start = q.indexOf(t, index);
|
|
1993
|
+
var end = n ? q.indexOf(n.prev, start) + 1 : q.indexOf(q.last) + 1;
|
|
1994
|
+
index = end;
|
|
1995
|
+
args.push(q.slice(start, end));
|
|
1996
|
+
if (!n) break;
|
|
1997
|
+
t = n.next;
|
|
1998
|
+
}
|
|
1999
|
+
return args;
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
var collectProperty = function (q) {
|
|
2003
|
+
var t = q.first;
|
|
2004
|
+
var defined = Object.create(null);
|
|
2005
|
+
var index = 0;
|
|
2006
|
+
while (t) {
|
|
2007
|
+
if (!(t.type === PROPERTY || t.isprop)) {
|
|
2008
|
+
t = t.next;
|
|
2009
|
+
continue;
|
|
2010
|
+
}
|
|
2011
|
+
var n = t.next;
|
|
2012
|
+
if (n && n.isprop) {
|
|
2013
|
+
if (n.type & (EXPRESS | QUOTED | STRAP) || n.type === SCOPED && n.entry === '[') {
|
|
2014
|
+
t = t.next;
|
|
2015
|
+
continue;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
var text = strings.decode(t.text);
|
|
2019
|
+
if (t.short) {
|
|
2020
|
+
defined[text] = [t];
|
|
2021
|
+
t = t.next;
|
|
2022
|
+
continue;
|
|
2023
|
+
}
|
|
2024
|
+
var n = t.next;
|
|
2025
|
+
while (n && (n.type !== STAMP || n.text !== ':') && (n.type !== SCOPED || n.entry !== '(')) n = n.next;
|
|
2026
|
+
if (n.type === STAMP) n = n.next;
|
|
2027
|
+
var start = q.indexOf(n, index);
|
|
2028
|
+
while (n && (n.type !== STAMP || n.text !== ',')) n = n.next;
|
|
2029
|
+
var end = n ? q.indexOf(n.prev, start) + 1 : q.indexOf(q.last) + 1;
|
|
2030
|
+
index = end;
|
|
2031
|
+
while (end > start && q[end - 1].type & (SPACE | COMMENT)) end--;
|
|
2032
|
+
if (text) defined[text] = q.slice(start, end);
|
|
2033
|
+
var text = strings.decode(t.text);
|
|
2034
|
+
if (!n) break;
|
|
2035
|
+
t = n.next;
|
|
2036
|
+
}
|
|
2037
|
+
return defined;
|
|
2038
|
+
};
|
|
1968
2039
|
|
|
1969
2040
|
export {
|
|
1970
2041
|
/* 1 */COMMENT,
|
|
@@ -1996,6 +2067,8 @@ export {
|
|
|
1996
2067
|
createExpressList,
|
|
1997
2068
|
snapSentenceHead,
|
|
1998
2069
|
pickArgument,
|
|
2070
|
+
collectArgument,
|
|
2071
|
+
collectProperty,
|
|
1999
2072
|
pickSentence,
|
|
2000
2073
|
pickExpress,
|
|
2001
2074
|
snapAssignmentHead,
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function a() { SAFE_CIRCLE_DEPTH }
|
|
2
|
+
console.log(SPACE, COMMENT, a.toString());
|
|
@@ -8,9 +8,9 @@ var {
|
|
|
8
8
|
snapExpressFoot, isEval, canbeTemp, rename, isHalfSentence, skipFunction, getDeclared, skipAssignment, skipSentenceQueue, createScoped, createString, splice, relink, rolink, pickSentence, snapExpressHead, needBreakBetween } = require("./common");
|
|
9
9
|
var splice2 = function (q, from, to, ...a) {
|
|
10
10
|
var cx = q.indexOf(from);
|
|
11
|
-
if (cx < 0) throw console.log(splice2.caller, console.format(`\r\n<red2>${i18n`自`}</red2>`), from && createString([from]), console.format(`\r\n<yellow>${i18n`至`}</yellow>`), to && createString([to]), console.format(`\r\n<cyan>${i18n`码列`}</cyan>`), createString(pickSentence(from))), i18n
|
|
11
|
+
if (cx < 0) throw console.log(splice2.caller, console.format(`\r\n<red2>${i18n`自`}</red2>`), from && createString([from]), console.format(`\r\n<yellow>${i18n`至`}</yellow>`), to && createString([to]), console.format(`\r\n<cyan>${i18n`码列`}</cyan>`), createString(pickSentence(from))), new Error(i18n`结构异常`);
|
|
12
12
|
var dx = to ? q.indexOf(to, cx) : q.length;
|
|
13
|
-
if (dx < 0) throw console.log(splice2.caller, console.format(`\r\n<yellow>${i18n`自`}</yellow>`), from && createString([from]), console.format(`\r\n<red2>${i18n`至`}</red2>`), to && createString([to]), console.format(`\r\n<cyan>${i18n`码列`}</cyan>`), createString(pickSentence(from))), i18n
|
|
13
|
+
if (dx < 0) throw console.log(splice2.caller, console.format(`\r\n<yellow>${i18n`自`}</yellow>`), from && createString([from]), console.format(`\r\n<red2>${i18n`至`}</red2>`), to && createString([to]), console.format(`\r\n<cyan>${i18n`码列`}</cyan>`), createString(pickSentence(from))), new Error(i18n`结构异常`);
|
|
14
14
|
return splice(q, cx, dx - cx, ...a);
|
|
15
15
|
};
|
|
16
16
|
var insert1 = function (q, r, ...a) {
|
package/coms/compile/getMaped.js
CHANGED
|
@@ -2,32 +2,36 @@ var split = require("../basic/$split");
|
|
|
2
2
|
function getMaped(refpath, mmap, m) {
|
|
3
3
|
var refs = refpath.slice();
|
|
4
4
|
refs.pop();
|
|
5
|
+
m = m.replace(/\-([\S])/g, (_, a) => a.toUpperCase()).replace(/\.[^\.\\\/]+$/, '');
|
|
5
6
|
var a = split(m);
|
|
6
|
-
for (var cx = 0; cx < a.length; cx++)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
cx
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
for (var cx = 0; cx < a.length; cx++) {
|
|
8
|
+
var b = a[cx];
|
|
9
|
+
switch (b) {
|
|
10
|
+
case "..":
|
|
11
|
+
if (cx > 0) {
|
|
12
|
+
a.splice(cx - 1, 2);
|
|
13
|
+
cx -= 2;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
a.splice(cx, 1);
|
|
17
|
+
cx--;
|
|
18
|
+
refs.pop();
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
case ".":
|
|
22
|
+
case "":
|
|
23
|
+
a.splice(cx, 1);
|
|
24
|
+
cx--;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
do {
|
|
29
|
+
var rlength = refs.length;
|
|
23
30
|
var tmp = refs.concat(a);
|
|
24
31
|
var r = tmp.join("$");
|
|
25
|
-
if (r in mmap)
|
|
26
|
-
r = mmap[r];
|
|
27
|
-
return r;
|
|
28
|
-
}
|
|
32
|
+
if (r in mmap) return mmap[r];
|
|
29
33
|
refs.pop();
|
|
30
|
-
}
|
|
34
|
+
} while (rlength > 0);
|
|
31
35
|
if (m in mmap) {
|
|
32
36
|
var r = mmap[m];
|
|
33
37
|
return r;
|
package/coms/compile/namelist.js
CHANGED
|
@@ -120,11 +120,15 @@ var preventList = function (k) {
|
|
|
120
120
|
var preventObject = function (k) {
|
|
121
121
|
return k in this;
|
|
122
122
|
};
|
|
123
|
+
var preventSet = function (k) {
|
|
124
|
+
return this.has(k);
|
|
125
|
+
};
|
|
123
126
|
var preventNull = function () { return false };
|
|
124
127
|
function namelist(count, prevent, skip) {
|
|
125
128
|
var dist = [];
|
|
126
129
|
if (!prevent) prevent = preventNull;
|
|
127
130
|
else if (prevent instanceof Array) prevent = preventList.bind(prevent);
|
|
131
|
+
else if (prevent instanceof Set || prevent instanceof Map) prevent = preventSet.bind(prevent);
|
|
128
132
|
else prevent = preventObject.bind(prevent);
|
|
129
133
|
var skip0 = skip;
|
|
130
134
|
for (var cy = 0, dy = counts.length; cy < dy; cy++) {
|
package/coms/compile/scanner.js
CHANGED
|
@@ -300,6 +300,9 @@ function block_code_scanner(index, blocks = [], keepdeep = Infinity) {
|
|
|
300
300
|
saved_index = index;
|
|
301
301
|
}
|
|
302
302
|
} : function () { };
|
|
303
|
+
var spaceback = function (tempIndex) {
|
|
304
|
+
return tempIndex;
|
|
305
|
+
}
|
|
303
306
|
var lookback = function (tempIndex) {
|
|
304
307
|
while (tempIndex >= saved_index && /\s/.test(this[tempIndex])) tempIndex--;
|
|
305
308
|
if (tempIndex < saved_index) {
|
|
@@ -331,13 +334,14 @@ function block_code_scanner(index, blocks = [], keepdeep = Infinity) {
|
|
|
331
334
|
var c = this[index];
|
|
332
335
|
switch (c) {
|
|
333
336
|
case "/": // /
|
|
334
|
-
save(block_code_scanner);
|
|
335
337
|
var d = this[index + 1];
|
|
336
338
|
//内部的d 数字与字符的速度差别不大
|
|
337
339
|
if (d === "*") { // u /* */
|
|
340
|
+
save(block_code_scanner);
|
|
338
341
|
index = multi_comment_scanner.call(this, index + 1);
|
|
339
342
|
save(multi_comment_scanner);
|
|
340
343
|
} else if (d === "/") { // x3 //
|
|
344
|
+
save(block_code_scanner);
|
|
341
345
|
index = single_comment_scanner.call(this, index + 1);
|
|
342
346
|
save(single_comment_scanner);
|
|
343
347
|
} else { // /reg/
|
|
@@ -349,23 +353,27 @@ function block_code_scanner(index, blocks = [], keepdeep = Infinity) {
|
|
|
349
353
|
// return/a/
|
|
350
354
|
//switch case break,while continue,break abcd;
|
|
351
355
|
var tempIndex = lookback.call(this, index - 1);
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
isReg
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
356
|
+
if (/^[\]\)]$/.test(this[tempIndex])) isReg = false;
|
|
357
|
+
else {
|
|
358
|
+
isReg = tempIndex <= start_index || /[[|,+=*~?:&\^{\(\/><;%\-!]/.test(this[tempIndex]);
|
|
359
|
+
if (!isReg && tempIndex >= start_index + 5) {
|
|
360
|
+
var last_pice = this.slice(Math.max(tempIndex - 50, 0), tempIndex + 1);
|
|
361
|
+
isReg = /(return|typeof|instanceof|in|new|void|delete|else)\s*$|([)};:{]|[^\.\s]\s+)(continue|break|case)\s*$/.test(last_pice);
|
|
362
|
+
isReg = isReg || /([)};:{]|[^\.\s]\s+)(?:continue|break)\s+([\w\u0100-\u2027\u2030-\uffff]+?)$/.test(last_pice);
|
|
363
|
+
if (!isReg && !/\r\n\u2028\u2029/.test(last_pice)) {
|
|
364
|
+
var variabled_name_reg = /[\w\u0100-\u2027\u2030-\uffff]/;
|
|
365
|
+
if (variabled_name_reg.test(this[tempIndex])) {
|
|
366
|
+
while (tempIndex > 8 && variabled_name_reg.test(this[tempIndex])) tempIndex--;
|
|
367
|
+
var tempIndex2 = lookback.call(this, tempIndex);
|
|
368
|
+
if (tempIndex2 >= 8 && !/\r\n\u2028\u2029/.test(this.slice(tempIndex2, tempIndex))) {
|
|
369
|
+
isReg = /([)};:{]|[^\.\s]\b\s*)(continue|break)$/.test(this.slice(tempIndex2 - 8, tempIndex2 + 1));
|
|
370
|
+
}
|
|
364
371
|
}
|
|
365
372
|
}
|
|
366
373
|
}
|
|
367
374
|
}
|
|
368
375
|
if (isReg) {
|
|
376
|
+
save(block_code_scanner);
|
|
369
377
|
index = regexp_quote_scanner.call(this, index);
|
|
370
378
|
save(regexp_quote_scanner);
|
|
371
379
|
} else {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var res = scanner(`this[-1024/* loaded */]/this[ -1023 /* total*/] `)
|
|
2
|
+
var res = scanner(`isString(data) && /\|/["test"](seeker)`)
|
|
3
|
+
var res = scanner(`typeof1/1/g`)
|
|
4
|
+
var res = scanner(`typeof/1/g`)
|
|
5
|
+
var res = scanner(`=
|
|
6
|
+
//
|
|
7
|
+
//
|
|
8
|
+
//
|
|
9
|
+
`+
|
|
10
|
+
String(/^\s*@?\s*if\s+(\/i\s+)?(not\s+)?(?:(cmdextversion|errorlevel)\s+(.+?)|(.+?)\s*(\=\=|\b(?:equ|neq|lss|leq|gtr|geq)\b)\s*(.+?)|exist\s+(["])(.+?)\8|defined\s+(.+?))\s+([\s\S]*?)$/i))
|
|
11
|
+
console.log(res)
|
|
@@ -211,7 +211,7 @@ function translate([imap, supports], code) {
|
|
|
211
211
|
splice(t.queue, i, e + 1 - i, tn);
|
|
212
212
|
break;
|
|
213
213
|
case 公式:
|
|
214
|
-
var JJSON = require('../basic_/JSON');
|
|
214
|
+
var JJSON = require('../basic_/JSON.js');
|
|
215
215
|
var formula = t.formula.iscup ? t.formula.map(a => JJSON.toJS(a)).join(",") : JJSON.toJS(t.formula);
|
|
216
216
|
var node = scanner2(`(${formula})`)[0];
|
|
217
217
|
replace(t, node);
|
package/coms/crypt/encode62.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
module.exports = encode62;
|
|
3
3
|
var encodeUTF8 = require("../basic/encodeUTF8");
|
|
4
4
|
var decodeUTF8 = require("../basic/decodeUTF8");
|
|
5
|
-
var src = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
5
|
+
var src = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split("");
|
|
6
6
|
var map = {};
|
|
7
|
-
src.
|
|
7
|
+
src.forEach((s, i) => map[s] = i);
|
|
8
8
|
|
|
9
9
|
function encode62(string) {
|
|
10
10
|
string = String(string)
|
|
11
11
|
string = string.length + string + "2017-08-19";
|
|
12
|
-
var buff = src.
|
|
12
|
+
var buff = src.slice();
|
|
13
13
|
for (var cx = 0, dx = buff.length + src.length, sl = string.length, cl = buff.length; cx < dx; cx++) {
|
|
14
14
|
var s1 = string.charCodeAt(cx % sl) % cl;
|
|
15
15
|
var s2 = cx % cl;
|
package/coms/pivot/DB.js
CHANGED
|
@@ -44,6 +44,15 @@ var bind = function (hostname) {
|
|
|
44
44
|
DB.query = function (type, queryObj, size = 100, queryStart) {
|
|
45
45
|
return DB.search(type, queryObj, size, '', queryStart);
|
|
46
46
|
};
|
|
47
|
+
Object.defineProperty(DB, 'base', {
|
|
48
|
+
get() {
|
|
49
|
+
return api.base;
|
|
50
|
+
},
|
|
51
|
+
set(v) {
|
|
52
|
+
host = v + '/';
|
|
53
|
+
return api.base = v;
|
|
54
|
+
},
|
|
55
|
+
})
|
|
47
56
|
return DB;
|
|
48
57
|
};
|
|
49
58
|
var db = bind(location.host || location.href);
|