efront 4.35.5 → 4.35.7

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.
@@ -11,10 +11,10 @@ var test_self = function () {
11
11
  test(null) // null;
12
12
  test(undefined); // 空字符串
13
13
  test(1); // 1
14
- test([0]);
14
+ test([0]);
15
15
  test(["00"]);
16
- test({"0":"00"});
17
- test({"00":"00"});
16
+ test({ "0": "00" });
17
+ test({ "00": "00" });
18
18
  test(true); // true
19
19
  test(false); // false
20
20
  test(NaN); // NaN
@@ -353,10 +353,8 @@ function test_encode() {
353
353
  function JSAM_test() {
354
354
  test_self();
355
355
  test_json();
356
- JSAM.debug = true;
357
356
  test_deep();
358
357
  test_parse();
359
- JSAM.debug = false;
360
358
  test_time();
361
359
  test_encode();
362
360
  }
@@ -140,7 +140,7 @@ var funcmap = {
140
140
  log(x, n) {
141
141
  return `<msub><mo>log</mo>${n}</msub>${x}`
142
142
  },
143
- ln(x){
143
+ ln(x) {
144
144
  return `<mo>ln</mo>${x}`
145
145
  },
146
146
  "div"(...args) {
@@ -326,7 +326,7 @@ function toString(obj, p, deep) {
326
326
  var origin = obj[k];
327
327
  if (k === '..') {
328
328
  var [prefix, rep, dots, e] = origin;
329
- prefix = String(prefix);
329
+ prefix = String(prefix).replace(/^\-/, '–');
330
330
  if (typeof rep === 'number') rep = String(rep);
331
331
  if (rep && !/\./.test(prefix)) prefix += '.';
332
332
  if (typeof e === 'number') e = String(e);
@@ -340,7 +340,7 @@ function toString(obj, p, deep) {
340
340
  else rep = mn(rep);
341
341
  if (dots) dots = mn(dots);
342
342
  else dots = '';
343
- if (e) e = `<mo>×</mo><msup><mn>10</mn><mn>${e}</mn></msup>`;
343
+ if (e) e = `<mo>×</mo><msup><mn>10</mn><mn>${String(e).replace(/^\-/, '–')}</mn></msup>`;
344
344
  else e = '';
345
345
  prefix = mn(prefix);
346
346
  return mrow([prefix, rep, dots, e].join(''), e ? p >= pmap["*"] : false, deep);
@@ -5,7 +5,6 @@ var escapeMap = {
5
5
  "\b": "\\b",
6
6
  "\f": "\\f",
7
7
  "\v": "\\u000b",
8
- "\\": "\\\\",
9
8
  "\u2028": "\\u2028",
10
9
  "\u2029": "\\u2029",
11
10
  };
@@ -21,7 +21,7 @@ var punc_2 = {
21
21
  return +n + s;
22
22
  },
23
23
  "/"(n, s) {
24
- if (!n) return;
24
+ if (!n || s) return;
25
25
  return 1 / n + s;
26
26
  }
27
27
  };
@@ -51,9 +51,6 @@ var punc_3 = {
51
51
  return (n1 >> n2) + s;
52
52
  },
53
53
  "<<"(n1, n2, s) {
54
- if (s && n1.length + +n2 > 15) {
55
- return BigInt(n1) << BigInt(n2) + s;
56
- }
57
54
  return (n1 << n2) + s;
58
55
  },
59
56
  ">"(n1, n2, s) {
@@ -99,6 +96,7 @@ function calc_(arg1, punc, arg2) {
99
96
  var [, n, s] = match;
100
97
  var f = punc_s && punc in punc_s ? punc_s[punc] : punc_2[punc];
101
98
  if (!f) return;
99
+ if (s === 'n' && n.length > 15) n = BigInt(n);
102
100
  return f(n, s, arg2);
103
101
  }
104
102
  var match1 = nreg.exec(arg1);
@@ -138,7 +136,12 @@ function calc_(arg1, punc, arg2) {
138
136
  s = 'i'; s2 = '';
139
137
  break a;
140
138
  }
141
- if (s === s2) return f(n1, n2, s);
139
+ if (s === s2) {
140
+ if (s === 'n') {
141
+ if (n1.length + n2.length > 15) n1 = BigInt(n1), n2 = BigInt(n2);
142
+ }
143
+ return f(n1, n2, s);
144
+ }
142
145
  return;
143
146
  }
144
147
  return f(n1, n2, s || s2);
@@ -147,6 +150,10 @@ function calc_(arg1, punc, arg2) {
147
150
  // 除法不考虑虚数
148
151
  if (s === s2) {
149
152
  if (/^[lmnuf]+$/i.test(s)) {
153
+ if (/^[lnu]+$/.test(s)) {
154
+ n1 = BigInt(n1);
155
+ n2 = BigInt(n2);
156
+ }
150
157
  return f(n1, n2, s);
151
158
  }
152
159
  return f(n1, n2, "");
@@ -156,6 +163,18 @@ function calc_(arg1, punc, arg2) {
156
163
  return f(n1, n2, s);
157
164
  }
158
165
  if (s !== s2) return;
166
+ if (s === 'n') {
167
+ switch (punc) {
168
+ case "**":
169
+ if (n1.length * n2 > 15) n1 = BigInt(n1), n2 = BigInt(n2);
170
+ break;
171
+ case "<<":
172
+ if (n1.length + +n2 > 15) n1 = BigInt(n1), n2 = BigInt(n2);
173
+ break;
174
+ default:
175
+ if (n1.length > 15 || n2.length > 15) n1 = BigInt(n1), n2 = BigInt(n2);
176
+ }
177
+ }
159
178
  return f(n1, n2, s);
160
179
  }
161
180
 
@@ -90,4 +90,8 @@ t("1<<0", '1');
90
90
  t("1<<3", '8');
91
91
  t("(1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)",'1335')
92
92
  t("(1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)","7973")
93
- t("(1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)","21522")
93
+ t("(1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)","21522")
94
+ t('1n<<32n','4294967296n');
95
+ t('4294967296n*4294967296n','18446744073709551616n');
96
+ t('4294967296n*2147483648n','9223372036854775808n');
97
+ t('0x20000000n*0x1000000n','9007199254740992n');
@@ -1,3 +1,3 @@
1
1
  function wrapHtml(htmldata) {
2
- return htmldata ? "`" + String(htmldata).trim().replace(/>\s+</g, "><").replace(/\\[^`]/g, "\\$&") + "`" : '``';
2
+ return htmldata ? `\`${String(htmldata).replace(/>\s+</g, "><").trim()}\`` : '``';
3
3
  }
@@ -6,7 +6,7 @@ const {
6
6
  createString,
7
7
  } = require("./common");
8
8
  var powermap = require("./powermap");
9
- var number_rep = /^[+-]?([\d\.]+)(?:e([+-]?\d+))?$/;
9
+ var number_rep = /^([+-]?[\d\.]+)(?:e([+-]?\d+))?$/;
10
10
  class Math extends Program {
11
11
  number_reg = /^(\d+(?:\.\d+){0,2}|(?:\.\d+){1,2}|(?:\d+\.){1,3})\.*(?:e[+-]?\d+)?$/;
12
12
  powermap = Object.assign({}, powermap);
@@ -1,5 +1,6 @@
1
1
  var JSON = require('../basic_/JSON')
2
2
  var t = function (text, want) {
3
+ 算式.debug = t.debug;
3
4
  var obj = 算式(text);
4
5
  if (t.debug) console.log(JSON.toJS(obj, null, 4))
5
6
  };
@@ -23,8 +24,9 @@ t(`H[+]`)
23
24
  t(`H[2-]`)
24
25
  t(`H'*1`)
25
26
  t(`cos(theta,2)*E +(1 - cos(theta))*K'*K+sin(theta)*[0,-K_2,K_1;K_2,0,-K_0;-K_1,K_0,0]`)
26
- t.debug = true;
27
27
  t(`group(
28
28
  x+y=10 tab(circle,1),
29
29
  x*y=25 tab(circle,2)
30
- )`)
30
+ )`)
31
+ t.debug = true;
32
+ t(`a + -2`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.35.5",
3
+ "version": "4.35.7",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {