efront 3.24.2 → 3.24.3

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,64 +0,0 @@
1
- "use strict";
2
- var Scanner = function (dataString, syntax) {
3
- this.source = dataString;
4
- this.syntax = syntax.syntax;
5
- this.entry = syntax.entry;
6
- var Token = this.token = syntax.token;
7
- var block = this.block = new Token(syntax.entry, 0);
8
- block.scanner = this;
9
- this.blocks = this.block.children = [];
10
- this.source = dataString;
11
- }
12
- Scanner.prototype = {
13
- scan(index = 0, type = this.entry, collection = this.blocks, parent = this.block) {
14
- var regInfo = this.syntax[type];
15
- var dataString = this.source;
16
- var Block = this.token;
17
- if (!regInfo) return index;
18
- if (!(regInfo instanceof Array)) {
19
- regInfo = [regInfo];
20
- }
21
- var reg = regInfo[0];
22
- loop: while (index < dataString.length) {
23
- reg.lastIndex = index;
24
- var res = reg.exec(dataString, collection);
25
- if (res) {
26
- index = reg.lastIndex;
27
- var inc = 0;
28
- while (res[++inc] === undefined) {
29
- if (inc >= regInfo.length) break loop;
30
- }
31
- var matchType = regInfo[inc];
32
- if (!matchType) continue;
33
- var savedIndex = reg.lastIndex - res[inc].length;
34
- var children = [];
35
- var block = new Block(matchType, savedIndex);
36
- block.parent = parent;
37
- block.children = children;
38
- block.root = this.block;
39
- block.scanner = this;
40
- index = this.scan(index, matchType, children, block);
41
- if (collection && savedIndex < index) {
42
- if (collection.length) {
43
- var lastChild = collection[collection.length - 1];
44
- block.prev = lastChild;
45
- lastChild.next = block;
46
- }
47
- collection.push(block);
48
- }
49
- block.end = index;
50
- } else if (/y/.test(reg.flags)) {
51
- throw new Error(`unexcepted token ${dataString[index]}`);
52
- } else {
53
- index = dataString.length;
54
- }
55
- }
56
- return index;
57
- }
58
- }
59
- var scan = function (data, syntax) {
60
- var scanner = new Scanner(data, syntax);
61
- scanner.scan();
62
- return scanner.blocks;
63
- };
64
- module.exports = scan;
@@ -1,6 +0,0 @@
1
- var keyword = `NaN Infinity break do in typeof case else instanceof var let catch export new void class extends return while const finally super with continue for switch yield debugger function this default if throw delete import try enum await null true false arguments eval`;
2
- var keywords = {};
3
- keyword.split(/\s+/g).forEach(function (key) {
4
- keywords[key] = true;
5
- });
6
- module.exports = keywords;
@@ -1,142 +0,0 @@
1
- var js_keywords = `
2
- if,in,do,
3
- var,for,new,try,let,
4
- this,else,case,void,with,enum,elif,from,
5
- async,while,break,catch,throw,const,yield,class,await
6
- return,typeof,delete,switch,export,import,
7
- default,finally,extends,
8
- function,continue,debugger,Infinity,abstract,nonlocal,
9
- null|true|false|NaN|Infinity|undefined|arguments
10
- instanceof,implements
11
- `;
12
- var c_java_go_python = `
13
- go,or,as,is,
14
- len,map,int,and,
15
- make,func,goto,chan,type,sync,byte,char,long,auto,pass,open
16
- label,purge,stack,
17
- defer,range,final,float,short,super,union,model,
18
- global,assert,except,lambda,
19
- inline,select,struct,public,native,static,strict,throws,double,extern,signed,sizeof
20
- package,private,boolean,
21
- typedef
22
- interface,transient,
23
- fullthrough
24
- synchronized
25
- _Bool,_Complex,_Imaginary
26
- _Alignas,_Alignof,_Atomic,_Static_assert,_Noreturn,_Thread_local,_Generic
27
- False,None,True
28
- strictfp,volatile,unsigned,restrict,
29
- `
30
-
31
- var others = `
32
- fi,md,rd,rm,cd,ls
33
- rem,
34
- ren,
35
- clc,cld,cli,chs,cls,dir,
36
- cmp
37
- ins,
38
- dec,inc,pop,ptr,
39
- seg,set,
40
- lea
41
- shl,shr
42
- cat
43
- popa,popf,fstp,fist,fadd,fsub,fmul,fdiv,fild
44
- endp,ends,proc,idiv,imul,
45
- call,chcp,
46
- code,data,even,
47
- loop,push,
48
- test,find,
49
- open,
50
- exit,
51
- move,
52
- copy,
53
- echo,
54
- help,
55
- type,
56
- popd,
57
- more,
58
- wmic,
59
- setx
60
- clear,print,
61
- pushd,
62
- assoc,ftype,mkdir,xcopy,
63
- enter,bound,cupid,group,raise,start,local
64
- subst,
65
- title,
66
- fistp,fiadd,fisub,fimul,fidiv,
67
- rename,
68
- assume,offset,
69
- segment,startup,
70
- template
71
- `;
72
- var keywords = [js_keywords, c_java_go_python, others].join("|").trim().split(/[,\r\n\s\|]+/).join("|");
73
- keywords = new RegExp(`^(${keywords})$`, 'i');
74
- var source = `abcdefghijklmnopqrstuvwxyz`;
75
- source += source.toUpperCase() + "_$";
76
- var number = source + '0123456789';
77
- // source += "ªµºΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψω";
78
- source += function () {
79
- var reg = /\xAA\xB5\xBA\xC0-\xD5\xD8-\xF2\xF8-\u02af\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA/;
80
- var dist = [];
81
- reg.source.replace(/\\[xu]([0-9a-f]+)(?:\-\\[xu]([0-9a-f]+))?/ig, function (_, a, b) {
82
- a = parseInt(a, 16);
83
- if (!b) {
84
- dist.push(a);
85
- return;
86
- }
87
- b = parseInt(b, 16);
88
- while (a <= b) dist.push(a++);
89
- });
90
- return String.fromCharCode.apply(String, dist);
91
- }();
92
- var source_length = source.length;
93
- var counts = [
94
- source_length,
95
- source_length * 64,
96
- source_length * 64 * 64,
97
- source_length * 64 * 64 * 64,
98
- source_length * 64 * 64 * 64 * 64
99
- ];
100
- function create(n, length) {
101
- var rest = [];
102
- while (length > 0) {
103
- rest[length] = (number[n & 0b111111]);
104
- length--;
105
- n = n >>> 6;
106
- }
107
- rest[0] = source[n];
108
- return rest.join("");
109
- }
110
- function namelist(count, prevent, skip) {
111
- var dist = [];
112
- if (!prevent) prevent = {};
113
- var skip0 = skip;
114
- for (var cy = 0, dy = counts.length; cy < dy; cy++) {
115
- if (count <= 0) break;
116
- var limit = counts[cy];
117
- if (skip >= limit) {
118
- skip -= limit;
119
- continue;
120
- }
121
- if (skip) count += skip;
122
- count -= limit;
123
- for (var cx = skip | 0, dx = count < 0 ? limit + count : limit; cx < dx; cx++) {
124
- var a = create(cx, cy);
125
- if (keywords.test(a) || a in prevent) {
126
- if (dx < limit) {
127
- dx++;
128
- count++;
129
- } else {
130
- count++;
131
- }
132
- } else {
133
- dist.push(a);
134
- }
135
- }
136
- skip0 += dx - skip;
137
- skip = 0;
138
- }
139
- dist.skip = skip0;
140
- return dist;
141
- }
142
- module.exports = namelist;
@@ -1,7 +0,0 @@
1
- var namelist = require("./namelist");
2
- var start = new Date;
3
- namelist(1000000, {});
4
- var a = namelist(600, {});
5
- var a = namelist(60, { A: true, _: true, a: 1, s: 1, b: 1, m: 1, aa: 1, a_: 1 });
6
- console.log(a);
7
- console.log("生成1百万个变量名,耗时",new Date - start);
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var scanner2 = require("../compile/scanner2");
3
- var strings = require("../basic/strings");
4
- function getRequired(data) {
5
- var code = scanner2(data);
6
- var { used, envs } = code;
7
- if (envs.require) var require = used.require;
8
- if (require instanceof Array) require.map(r => {
9
- if (r.next && r.next.type === code.SCOPED) {
10
- var s = r.next;
11
- var f = s.first;
12
- if (f && f.type === code.QUOTED && !f.length && /^[`'"]/.test(f.text)) {
13
- return strings.decode(f.text);
14
- }
15
- }
16
- })
17
- else require = [];
18
- return require;
19
- }
20
- module.exports = getRequired;