efront 4.34.1 → 4.35.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.
- package/coms/basic/Matrix.js +3 -1
- package/coms/basic/color.js +258 -78
- package/coms/basic/color_test.js +23 -2
- package/coms/basic/crc.js +6 -2
- package/coms/basic/data.js +3 -3
- package/coms/basic/decodeASN1.js +2 -2
- package/coms/basic/math.js +321 -0
- package/coms/basic/math.md +265 -0
- package/coms/basic/math_test.xht +56 -0
- package/coms/basic/pinyin.js +40 -0
- package/coms/basic/pinyin_test.js +40 -0
- package/coms/basic/wait.js +1 -1
- package/coms/basic_/JSON.js +24 -4
- package/coms/compile/Html.js +1 -0
- package/coms/compile/Javascript.js +14 -0
- package/coms/compile/Javascript_test.js +4 -3
- package/coms/compile/Program.js +82 -45
- package/coms/compile/autoenum.js +498 -138
- package/coms/compile/autoenum_test.js +70 -4
- package/coms/compile/autoeval.js +616 -18
- package/coms/compile/autoeval_test.js +55 -2
- package/coms/compile/common.js +27 -15
- package/coms/compile/common_test.js +12 -2
- package/coms/compile/downLevel.js +60 -7
- package/coms/compile/downLevel_test.js +22 -8
- package/coms/compile/powermap.js +2 -2
- package/coms/compile/rescan.js +2 -2
- package/coms/compile/scanner2.js +25 -1
- package/coms/compile/translate.js +18 -7
- package/coms/compile/unstruct.js +44 -2
- package/coms/compile/unstruct_test.js +14 -9
- package/coms/compile//347/256/227/345/274/217.js +276 -0
- package/coms/compile//347/256/227/345/274/217_test.js +26 -0
- package/coms/compile//347/264/240/351/246/250.js +60 -23
- package/coms/compile//347/264/240/351/246/250_test.js +8 -3
- package/coms/docs/markdown.js +4 -0
- package/coms/frame/ChatRTC.js +60 -18
- package/coms/frame/chat-rtc.xht +20 -18
- package/coms/frame/chat.js +38 -21
- package/coms/frame/chat.less +8 -3
- package/coms/reptile/colors.js +1 -0
- package/coms/zimoli/prompt.js +12 -2
- package/coms/zimoli/render.js +0 -1
- package/coms//350/214/250/350/217/260//344/270/212/350/211/262.xht +4 -0
- package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +14 -4
- 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,40 @@
|
|
|
1
|
+
var saved = 0, lack = false;
|
|
2
|
+
|
|
3
|
+
var ck = function (c) {
|
|
4
|
+
var py = pinyin.pinyin(c);
|
|
5
|
+
var code = c.codePointAt(0);
|
|
6
|
+
if (py === c) {
|
|
7
|
+
if (code - saved > 1 && lack) console.log(String.fromCodePoint(saved), saved, saved.toString(16), 'end');
|
|
8
|
+
if (code - saved > 1 || !lack) {
|
|
9
|
+
console.log(c, code, code.toString(16), 'start');
|
|
10
|
+
}
|
|
11
|
+
lack = true;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
if (lack) {
|
|
15
|
+
console.log(String.fromCodePoint(saved), saved, saved.toString(16), 'end');
|
|
16
|
+
}
|
|
17
|
+
lack = false;
|
|
18
|
+
}
|
|
19
|
+
saved = code;
|
|
20
|
+
}
|
|
21
|
+
var check = function (start, end = start) {
|
|
22
|
+
if (typeof start === 'string') {
|
|
23
|
+
for (var c of start) ck(c);
|
|
24
|
+
}
|
|
25
|
+
else for (var cx = start, dx = end; cx <= dx; cx++) {
|
|
26
|
+
var c = String.fromCodePoint(cx);
|
|
27
|
+
ck(c);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
check(0x3105, 0x3129);// 注音
|
|
31
|
+
check(0x3400, 0x4dbf);// cjk扩充A
|
|
32
|
+
check(0x4e00, 0x9fff);// cjk汉字
|
|
33
|
+
check(0x20000, 0x2A6Df);// cjk 扩充B
|
|
34
|
+
check(0x2A700, 0x2B73F);// cjk 扩充C
|
|
35
|
+
check(0x2B740, 0x2B81F);// cjk 扩充D
|
|
36
|
+
check(0x2B820, 0x2CEAF);// cjk 扩充E
|
|
37
|
+
check(0x2CEB0, 0x2EBEF);// cjk 扩充F
|
|
38
|
+
check(0x30000, 0x3134F);// cjk 扩充G
|
|
39
|
+
check(0x31350, 0x323AF);// cjk 扩充H
|
|
40
|
+
check(0x3ebf0, 0x3ee5F);// cjk 扩充I
|
package/coms/basic/wait.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function wait(call, time = 80, step = +time >>>
|
|
1
|
+
async function wait(call, time = 80, step = +time >>> 8 | 20) {
|
|
2
2
|
var res;
|
|
3
3
|
if (isFunction(call)) while (!(res = await call()) && time > 0) await new Promise(ok => setTimeout(ok, step)), time -= step;
|
|
4
4
|
else res = new Promise(ok => setTimeout(ok, call));
|
package/coms/basic_/JSON.js
CHANGED
|
@@ -25,7 +25,7 @@ var scan_number = function (str, start) {
|
|
|
25
25
|
return false;
|
|
26
26
|
};
|
|
27
27
|
var scan_null = function (str, start) {
|
|
28
|
-
var reg = /null|false|true/g;
|
|
28
|
+
var reg = /null|false|true|\-?Infinity/g;
|
|
29
29
|
reg.lastIndex = start;
|
|
30
30
|
var match = reg.exec(str);
|
|
31
31
|
if (match && match.index === start) {
|
|
@@ -38,6 +38,13 @@ var scan_null = function (str, start) {
|
|
|
38
38
|
break;
|
|
39
39
|
case "t":
|
|
40
40
|
data = true;
|
|
41
|
+
break;
|
|
42
|
+
case "I":
|
|
43
|
+
data = Infinity;
|
|
44
|
+
break;
|
|
45
|
+
case "-":
|
|
46
|
+
data = -Infinity;
|
|
47
|
+
break;
|
|
41
48
|
}
|
|
42
49
|
return reg.lastIndex;
|
|
43
50
|
}
|
|
@@ -121,9 +128,14 @@ var _safeparse = function (str, start) {
|
|
|
121
128
|
case "n":
|
|
122
129
|
case "f":
|
|
123
130
|
case "t":
|
|
131
|
+
case "I":
|
|
124
132
|
start = scan_null(str, start);
|
|
125
133
|
break;
|
|
126
134
|
default:
|
|
135
|
+
if (str.charAt(start + 1) === 'I') {
|
|
136
|
+
start = scan_null(str, start);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
127
139
|
start = scan_number(str, start);
|
|
128
140
|
}
|
|
129
141
|
if (start === false)
|
|
@@ -153,7 +165,8 @@ var stringify = function (object, filter, space) {
|
|
|
153
165
|
var res = getString(object, filter, space);
|
|
154
166
|
if (res.length) return res.join('');
|
|
155
167
|
}
|
|
156
|
-
var toString = strings
|
|
168
|
+
var toString = strings?.encode;
|
|
169
|
+
var keepNaN = false;
|
|
157
170
|
/**
|
|
158
171
|
*
|
|
159
172
|
* @param {object} object
|
|
@@ -188,7 +201,8 @@ var getString = function (object, filter, space) {
|
|
|
188
201
|
return object;
|
|
189
202
|
}
|
|
190
203
|
case "number":
|
|
191
|
-
if (
|
|
204
|
+
if (keepNaN) return String(object);
|
|
205
|
+
if (isNaN(object) || object === Infinity || object === -Infinity) {
|
|
192
206
|
object = null;
|
|
193
207
|
}
|
|
194
208
|
case "boolean":
|
|
@@ -252,6 +266,12 @@ var getString = function (object, filter, space) {
|
|
|
252
266
|
return result;
|
|
253
267
|
};
|
|
254
268
|
var JSON = {
|
|
269
|
+
toJS(o, f, t) {
|
|
270
|
+
keepNaN = true;
|
|
271
|
+
var r = stringify(o, f, t);
|
|
272
|
+
keepNaN = false;
|
|
273
|
+
return r;
|
|
274
|
+
},
|
|
255
275
|
parse: parse,
|
|
256
276
|
stringify: stringify
|
|
257
|
-
};
|
|
277
|
+
};
|
package/coms/compile/Html.js
CHANGED
|
@@ -32,6 +32,7 @@ const {
|
|
|
32
32
|
replace,
|
|
33
33
|
skipAssignment,
|
|
34
34
|
insertAfter,
|
|
35
|
+
insertBefore,
|
|
35
36
|
pickSentence,
|
|
36
37
|
unshort,
|
|
37
38
|
} = require("./common");
|
|
@@ -51,6 +52,11 @@ class Javascript extends Program {
|
|
|
51
52
|
forceend_reg = /^(return|yield|break|continue|debugger|async)$/;
|
|
52
53
|
defaultType = EXPRESS;
|
|
53
54
|
lbtype = true;
|
|
55
|
+
constructor() {
|
|
56
|
+
super();
|
|
57
|
+
this.powermap = Object.assign({}, this.powermap);
|
|
58
|
+
delete this.powermap["#"];
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
var propresolve_reg = /^(static|get|set|async|readonly|private|pub)$/;
|
|
56
62
|
|
|
@@ -474,10 +480,16 @@ function detour(o, ie) {
|
|
|
474
480
|
}
|
|
475
481
|
var text = o.text.replace(/^\.\.\./, '');
|
|
476
482
|
var hasdot = o.text.length !== text.length;
|
|
483
|
+
if (text === 'new.target') text = 'undefined';
|
|
477
484
|
if (context.avoidMap) {
|
|
478
485
|
var m = /^[^\.\[\]]+/.exec(o.text);
|
|
479
486
|
if (m) { context.avoidMap[m[0]] = true; }
|
|
480
487
|
}
|
|
488
|
+
var match = /^([^\#\.]*)\.#/.exec(text);
|
|
489
|
+
if (match) {
|
|
490
|
+
var [, varname] = match;
|
|
491
|
+
o.hidden = varname;
|
|
492
|
+
}
|
|
481
493
|
text = text.replace(/\.([^\.\[\!\=\:]+)/g, (_, a) => ie === undefined || context.strap_reg.test(a) || /#/.test(a) ? `[${strings.recode(a)}]` : _);
|
|
482
494
|
if (hasdot) text = "..." + text;
|
|
483
495
|
o.text = text;
|
|
@@ -586,6 +598,8 @@ function detour(o, ie) {
|
|
|
586
598
|
}
|
|
587
599
|
else if (o.queue.isClass) {
|
|
588
600
|
if (o.text === 'constructor') break;
|
|
601
|
+
var hidden = /^#/.test(o.text);
|
|
602
|
+
if (hidden) o.hidden = true;
|
|
589
603
|
var text = strings.recode(o.text);
|
|
590
604
|
if (o.prev) {
|
|
591
605
|
var prev = o.prev;
|
|
@@ -45,8 +45,8 @@ testDetour('1.e-10.a', '1e-10["a"]')
|
|
|
45
45
|
testDetour('1.e+10.a', '1e+10["a"]')
|
|
46
46
|
testDetour('0x1.a', '0x1["a"]')
|
|
47
47
|
testDetour('0b1.a', '0b1["a"]')
|
|
48
|
-
testDetour('01.a', '0o1["a"]')
|
|
49
|
-
testDetour('08.a', '08["a"]')
|
|
48
|
+
testDetour('01 .a', '0o1["a"]')
|
|
49
|
+
testDetour('08 .a', '08["a"]')
|
|
50
50
|
testDetour('0o1.a', '0o1["a"]')
|
|
51
51
|
testDetour('0o1n.a', '0o1n["a"]')
|
|
52
52
|
testDetour('0o1m.a', '0o1m["a"]')
|
|
@@ -150,4 +150,5 @@ testStar(`var a=class {a=1\r\nasync * a(){
|
|
|
150
150
|
}
|
|
151
151
|
}}`, {});
|
|
152
152
|
|
|
153
|
-
assert(scanner2(`#`)[0].type, common.
|
|
153
|
+
assert(scanner2(`#`)[0].type, common.EXPRESS)
|
|
154
|
+
assert(scanner2(`1*2`)[1].type, common.STAMP)
|
package/coms/compile/Program.js
CHANGED
|
@@ -11,11 +11,8 @@ const {
|
|
|
11
11
|
/* 512 */LABEL,
|
|
12
12
|
/*1024 */PROPERTY,
|
|
13
13
|
/*2048 */ELEMENT,
|
|
14
|
-
pickAssignment,
|
|
15
|
-
createString,
|
|
16
14
|
setqueue,
|
|
17
15
|
number_reg,
|
|
18
|
-
digit_reg,
|
|
19
16
|
} = require("./common");
|
|
20
17
|
var combine = require("../basic/combine");
|
|
21
18
|
var sortRegster = require("../basic/sortRegister");
|
|
@@ -70,18 +67,37 @@ var setObject = function (o) {
|
|
|
70
67
|
var needproperty = true;
|
|
71
68
|
for (var cx = 0; cx < o.length; cx++) {
|
|
72
69
|
var m = o[cx];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
var { type } = m;
|
|
71
|
+
switch (type) {
|
|
72
|
+
case STAMP: switch (m.text) {
|
|
73
|
+
case ",":
|
|
74
|
+
var p = m.prev;
|
|
75
|
+
if (p?.type === PROPERTY) p.short = true;
|
|
76
|
+
needproperty = true;
|
|
77
|
+
continue;
|
|
78
|
+
case "...":
|
|
79
|
+
needproperty = false;
|
|
80
|
+
continue;
|
|
81
|
+
case ":":
|
|
82
|
+
case "=":
|
|
83
|
+
var p = m.prev;
|
|
84
|
+
if (p?.isprop) needproperty = false;
|
|
85
|
+
default:
|
|
86
|
+
if (needproperty) m.isprop = true;
|
|
87
|
+
continue;
|
|
77
88
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
case SCOPED:
|
|
90
|
+
if (m.entry === "{") {
|
|
91
|
+
if (!needproperty) {
|
|
92
|
+
if (!m.isObject) setObject(m);
|
|
93
|
+
}
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (needproperty) m.isprop = true;
|
|
97
|
+
continue;
|
|
83
98
|
}
|
|
84
|
-
if (
|
|
99
|
+
if (!needproperty) continue;
|
|
100
|
+
if (type === LABEL) {
|
|
85
101
|
o.splice(cx, 0, o[++cx].prev = m.next = m.next.prev = new Node({
|
|
86
102
|
prev: m,
|
|
87
103
|
text: ':',
|
|
@@ -95,16 +111,26 @@ var setObject = function (o) {
|
|
|
95
111
|
needproperty = false;
|
|
96
112
|
continue;
|
|
97
113
|
}
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
|
|
115
|
+
if (type & (EXPRESS | STRAP)) {
|
|
116
|
+
m.isprop = true;
|
|
117
|
+
m.type = PROPERTY;
|
|
118
|
+
var p = m.prev;
|
|
119
|
+
if (p && p.type === PROPERTY) {
|
|
120
|
+
p.type = STRAP;
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
}
|
|
124
|
+
var last = o.last;
|
|
125
|
+
if (last?.type === PROPERTY) last.short = true;
|
|
106
126
|
};
|
|
107
127
|
|
|
128
|
+
var setIon = function (last, powermap) {
|
|
129
|
+
while (last && last.type === STAMP && powermap[last.text] !== powermap["="]) {
|
|
130
|
+
last.ion = true;
|
|
131
|
+
last = last.prev;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
108
134
|
|
|
109
135
|
var spaceDefined = require("../basic/spaces");
|
|
110
136
|
|
|
@@ -134,18 +160,17 @@ class Program {
|
|
|
134
160
|
["{", "}"],
|
|
135
161
|
["<%", "%>"],
|
|
136
162
|
]
|
|
137
|
-
stamps = "
|
|
163
|
+
stamps = "/=+;|:?<>-!'~%^&*,".split("");
|
|
138
164
|
prefix = '&^%?:'.split('');
|
|
139
165
|
value_reg = /^(false|true|null)$/
|
|
140
166
|
number_reg = number_reg;
|
|
141
|
-
digit_reg = digit_reg;
|
|
142
167
|
Code = Array;
|
|
143
168
|
powermap = powermap;
|
|
144
169
|
transive_reg = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|default|instanceof|throw|extends|import|from)$/;
|
|
145
170
|
straps = "if,for".split(',');
|
|
146
171
|
colonstrap_reg = /^(case|default)$/;
|
|
147
172
|
forceend_reg = /^(return|break|continue|end[psm])$/;
|
|
148
|
-
funcstrap_reg = /^(class|function|fn|func|async|interface|struct|enum|impl|pub)$/;
|
|
173
|
+
funcstrap_reg = /^(class|function|fn|func|async|interface|struct|enum|impl|pub|define)$/;
|
|
149
174
|
extends_reg = /^(extends|implements)$/;
|
|
150
175
|
structstrap_reg = /^(class|interface|struct|enum)$/;
|
|
151
176
|
control_reg = /^(if|else|switch|case|do|while|for|loop|break|continue|default|import|from|as|export|try|catch|finally|throw|await|yield|return)$/;
|
|
@@ -337,22 +362,19 @@ class Program {
|
|
|
337
362
|
var type_reg = this.type_reg;
|
|
338
363
|
var digit_reg = this.digit_reg;
|
|
339
364
|
var comment_entry = this.comment_entry;
|
|
340
|
-
var
|
|
341
|
-
|
|
342
|
-
row += rowsOf(m);
|
|
343
|
-
var reg = /[\r\n\u2028\u2029]/g;
|
|
365
|
+
var setRows = (m, start) => {
|
|
366
|
+
var reg = /(\r\n|\n|\r|\u2028|\u2029)/g;
|
|
344
367
|
reg.lastIndex = 0;
|
|
345
368
|
var index = 0;
|
|
346
369
|
do {
|
|
347
|
-
|
|
370
|
+
row++;
|
|
348
371
|
var match = reg.exec(m);
|
|
372
|
+
if (match) index = match.index + match[0].length;
|
|
349
373
|
} while (match);
|
|
374
|
+
row--;
|
|
350
375
|
colstart = start + index - 1;
|
|
351
376
|
};
|
|
352
377
|
var queue_push = (scope) => {
|
|
353
|
-
if (scope.type & (SPACE | COMMENT | PIECE | QUOTED)) {
|
|
354
|
-
if (scope.text) setRows(scope.text);
|
|
355
|
-
}
|
|
356
378
|
var last = queue.last;
|
|
357
379
|
scope.queue = queue;
|
|
358
380
|
scope.prev = last;
|
|
@@ -404,10 +426,10 @@ class Program {
|
|
|
404
426
|
if (powermap[o.text] > powermap["="]) o.unary = true;
|
|
405
427
|
}
|
|
406
428
|
else if (last.type === STRAP && !last.isend
|
|
407
|
-
|| last.type === STAMP && !last.istype &&
|
|
429
|
+
|| last.type === STAMP && !last.istype && (last.unary || powermap[last.text] < powermap["++"])
|
|
408
430
|
|| last.type === SCOPED && !last.isExpress && !last.istype
|
|
409
431
|
) {
|
|
410
|
-
o.unary = /^[^=;,\:]$/.test(o.text);
|
|
432
|
+
o.unary = /^[^=;,\:']$/.test(o.text);
|
|
411
433
|
if (o.unary && /^(\+|\-)$/.test(o.text) && last && last.type === STAMP && /^(\+\+|\-\-)$/.test(last.text)) o.unary = !!last.unary;
|
|
412
434
|
}
|
|
413
435
|
if (/^(\+\+|\-\-)$/.test(o.text)) {
|
|
@@ -419,6 +441,7 @@ class Program {
|
|
|
419
441
|
p = queue[queue.length - ++i];
|
|
420
442
|
}
|
|
421
443
|
o.unary = !p || p.type & (SPACE | STAMP | STRAP) || p.type === EXPRESS && p.prev && p.prev.type === STAMP && /^(\+\+|\-\-)$/.test(p.prev.text) && p.prev.unary;
|
|
444
|
+
if (!o.unary) o.ion = true;
|
|
422
445
|
}
|
|
423
446
|
|
|
424
447
|
if (!o.unary && /^(\.\.\.|\*)$/.test(o.text)) {
|
|
@@ -439,6 +462,9 @@ class Program {
|
|
|
439
462
|
else if (powermap[o.text] > powermap.void && !o.unary) {
|
|
440
463
|
o.needle = true;
|
|
441
464
|
}
|
|
465
|
+
if (!o.unary && last?.type & STAMP && (powermap[last.text] < powermap[o.text] || powermap[o.text] >= powermap["*"])) {
|
|
466
|
+
setIon(last, powermap);
|
|
467
|
+
}
|
|
442
468
|
queue_push(cache_stamp);
|
|
443
469
|
if (cache_stamp.istype && cache_stamp.unary && powermap[cache_stamp.text] == powermap[":"]) cache_stamp.unary = false;
|
|
444
470
|
if (cache_stamp === queue.last && cache_stamp.isExpress && cache_stamp.text in powermap && !cache_stamp.needle) queue.inExpress = true;
|
|
@@ -474,7 +500,6 @@ class Program {
|
|
|
474
500
|
last.end = end;
|
|
475
501
|
return;
|
|
476
502
|
}
|
|
477
|
-
|
|
478
503
|
var scope = new Node({
|
|
479
504
|
type,
|
|
480
505
|
start,
|
|
@@ -484,6 +509,9 @@ class Program {
|
|
|
484
509
|
isExpress: queue.inExpress,
|
|
485
510
|
text: m
|
|
486
511
|
});
|
|
512
|
+
if (type & (SPACE | COMMENT | PIECE | QUOTED)) {
|
|
513
|
+
if (m) setRows(m, start);
|
|
514
|
+
}
|
|
487
515
|
lasttype = type;
|
|
488
516
|
if (type === STAMP) {
|
|
489
517
|
cache_stamp = scope;
|
|
@@ -696,6 +724,7 @@ class Program {
|
|
|
696
724
|
return;
|
|
697
725
|
}
|
|
698
726
|
var scope = queue;
|
|
727
|
+
setIon(scope.last, powermap);
|
|
699
728
|
queue = parents.pop();
|
|
700
729
|
queue_push(scope);
|
|
701
730
|
lasttype = scope.type;
|
|
@@ -705,9 +734,9 @@ class Program {
|
|
|
705
734
|
if (index > start) {
|
|
706
735
|
var piece = queue[queue.length - 1];
|
|
707
736
|
if (piece && piece.type === PIECE) {
|
|
708
|
-
|
|
737
|
+
var pend = piece.end;
|
|
709
738
|
piece.text = text.slice(piece.start, index);
|
|
710
|
-
setRows(
|
|
739
|
+
setRows(text.slice(pend, index), pend);
|
|
711
740
|
piece.end = index;
|
|
712
741
|
}
|
|
713
742
|
else {
|
|
@@ -822,10 +851,11 @@ class Program {
|
|
|
822
851
|
|
|
823
852
|
var start = entry_reg.lastIndex = index;
|
|
824
853
|
var match = entry_reg.exec(text);
|
|
825
|
-
if (!match)
|
|
854
|
+
if (!match) throw console.log(text.charCodeAt(index), text.charAt(index), start, index, text.length), new Error('编译器内部异常');
|
|
826
855
|
var end = match[0].length + match.index;
|
|
827
856
|
index = end;
|
|
828
857
|
var m = match[0];
|
|
858
|
+
if (!m) throw console.log(m, match.index), new Error('编译器内部异常,解析错误');
|
|
829
859
|
if (cache_stamp && !stamp_reg.test(m)) push_stamp();
|
|
830
860
|
var last = cache_stamp || queue.last;
|
|
831
861
|
|
|
@@ -854,6 +884,7 @@ class Program {
|
|
|
854
884
|
}
|
|
855
885
|
}
|
|
856
886
|
else if (stamp_reg.test(m) && last) {
|
|
887
|
+
if (!quote.tag && lasttype === EXPRESS) break test;
|
|
857
888
|
if (last.type === STAMP && last === cache_stamp && powermap.hasOwnProperty(last.text + m)) break test;
|
|
858
889
|
if (last.istype || last.isprop || last.isargl) {
|
|
859
890
|
isTypeTag = true;
|
|
@@ -945,6 +976,7 @@ class Program {
|
|
|
945
976
|
queue.inExpress = true;
|
|
946
977
|
queue.end = index;
|
|
947
978
|
queue.text = text.slice(start, index);
|
|
979
|
+
setRows(queue.text, start);
|
|
948
980
|
pop_parents();
|
|
949
981
|
continue;
|
|
950
982
|
}
|
|
@@ -1133,7 +1165,7 @@ class Program {
|
|
|
1133
1165
|
if (this.scope_leave[m] && queue.entry === this.scope_leave[m]) {
|
|
1134
1166
|
if (last?.type === PROPERTY) {
|
|
1135
1167
|
var lp = last.prev;
|
|
1136
|
-
if (!lp || lp
|
|
1168
|
+
if (!lp && queue.isObject || lp?.type === STAMP && lp.text === ',') last.short = true;
|
|
1137
1169
|
}
|
|
1138
1170
|
|
|
1139
1171
|
queue.end = end;
|
|
@@ -1146,11 +1178,7 @@ class Program {
|
|
|
1146
1178
|
var last = queue.last;
|
|
1147
1179
|
if (!stamp_reg.test(m) || last && !last.isExpress) console.warn(
|
|
1148
1180
|
i18n`标记不匹配:`, queue.entry, m,
|
|
1149
|
-
i18n`\r\n文件位置:`, this.mindpath + ":" + `${row}
|
|
1150
|
-
i18n`\r\n摘要:\r\n`,
|
|
1151
|
-
index - queue.start < 200
|
|
1152
|
-
? text.slice(queue.start, index)
|
|
1153
|
-
: text.slice(queue.start, queue.start + 100) + "..." + text.slice(index - 97, index)
|
|
1181
|
+
i18n`\r\n文件位置:`, this.mindpath + ":" + `${row}`,
|
|
1154
1182
|
);
|
|
1155
1183
|
}
|
|
1156
1184
|
save(STAMP);
|
|
@@ -1173,10 +1201,9 @@ class Program {
|
|
|
1173
1201
|
if (queue !== origin) {
|
|
1174
1202
|
var last = queue.last || queue;
|
|
1175
1203
|
console.warn(
|
|
1176
|
-
"代码异常结束",
|
|
1204
|
+
"代码异常结束",
|
|
1177
1205
|
`\r\n - 祖先标记: ${parents.slice(1).map(p => `${p.entry || ""}<red2>${p.tag || p.text || ""}</red2><gray>${p.row}:${p.col}</gray>`).join('')}`,
|
|
1178
1206
|
`\r\n - 内层入口: <yellow>${this.mindpath}</yellow>:${last.row}:${last.col} ${last.text || last.entry}`,
|
|
1179
|
-
`\r\n ----- 快照: ${createString(pickAssignment(queue.last || queue))}`,
|
|
1180
1207
|
);
|
|
1181
1208
|
while (queue !== origin) {
|
|
1182
1209
|
queue.error = "代码异常结束";
|
|
@@ -1184,6 +1211,7 @@ class Program {
|
|
|
1184
1211
|
pop_parents();
|
|
1185
1212
|
}
|
|
1186
1213
|
}
|
|
1214
|
+
setIon(origin.last, powermap);
|
|
1187
1215
|
return origin;
|
|
1188
1216
|
}
|
|
1189
1217
|
commit() {
|
|
@@ -1250,7 +1278,16 @@ class Program {
|
|
|
1250
1278
|
this.prefix_reg = prefix_reg;
|
|
1251
1279
|
var numbers = number_reg.source.replace(/^\^|\$$/g, "");
|
|
1252
1280
|
this.digit_reg = new RegExp(/^[+\-]?/.source + numbers, number_reg.flags);
|
|
1253
|
-
this.entry_reg = new RegExp([
|
|
1281
|
+
this.entry_reg = new RegExp([
|
|
1282
|
+
spaceDefined.reg.source,
|
|
1283
|
+
quotes_entries,
|
|
1284
|
+
scopes,
|
|
1285
|
+
numbers,
|
|
1286
|
+
`(?:${spaceDefined.avoid(tokens)})+`,
|
|
1287
|
+
express,
|
|
1288
|
+
powers_entries,
|
|
1289
|
+
stamps && `[${stamps}]`
|
|
1290
|
+
].filter(a => !!a).join("|"), "gi");
|
|
1254
1291
|
var stamps = this.stamps.slice();
|
|
1255
1292
|
for (var k in this.powermap) {
|
|
1256
1293
|
if (k.length === 1 && stamps.indexOf(k) < 0) stamps.push(k);
|