efront 4.21.3 → 4.21.4
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 +93 -66
- package/coms/basic/parseNumber.js +12 -7
- package/coms/basic/percent.js +28 -0
- package/coms/basic/refilm.js +24 -5
- package/coms/basic/refilm_decode.js +6 -2
- package/coms/basic/refilm_decode_test.js +1 -0
- package/coms/compile/Html_test.js +5 -0
- package/coms/compile/Javascript.js +12 -2
- package/coms/compile/Javascript_test.js +3 -0
- package/coms/compile/Program.js +119 -43
- package/coms/compile/common.js +7 -1
- package/coms/compile/scanner2.js +53 -7
- package/coms/compile/translate.js +1 -1
- package/coms/zimoli/XMLHttpRequest.js +16 -13
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +4 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme-en.md +3 -5
- package/readme.md +3 -4
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
- zh-CN: 正在联网验证,请耐心等待..
|
|
2
|
+
en: "Network verification in progress, please be patient"
|
|
3
|
+
|
|
4
|
+
- zh-CN: 验证失败!
|
|
5
|
+
en: Verification failed!
|
|
6
|
+
|
|
7
|
+
- zh-CN: 已为您添加/更新以下权限
|
|
8
|
+
en: We have added/updated the following permissions for you
|
|
9
|
+
|
|
10
|
+
- zh-CN: 发现异常属性:$1
|
|
11
|
+
en: "Abnormal attribute found: $1"
|
|
12
|
+
|
|
13
|
+
- zh-CN: 标记不匹配
|
|
14
|
+
en: Tag mismatch
|
|
15
|
+
|
|
16
|
+
- zh-CN: 文件位置
|
|
17
|
+
en: File location
|
|
18
|
+
|
|
19
|
+
- zh-CN: 摘要
|
|
20
|
+
en: Summary
|
|
21
|
+
|
|
22
|
+
- zh-CN: "类型不支持: $1"
|
|
23
|
+
en: "Type not supported: $1"
|
|
24
|
+
|
|
25
|
+
- zh-CN: 原始数据大小为$1,目标文件大小为$2,压缩率为$3
|
|
26
|
+
en: "The original data size is $1, the target file size is $2, and the compression ratio is $3"
|
|
27
|
+
|
|
1
28
|
- zh-CN: 路径$1未找到入口文件
|
|
2
29
|
en: Path $1 entry file not found
|
|
3
30
|
|
|
@@ -292,11 +319,11 @@
|
|
|
292
319
|
- zh-CN: 当前环境无法启用证书更新服务,nodeJs版本为$1
|
|
293
320
|
en: "The current environment cannot enable certificate update service, nodeJs version is $1"
|
|
294
321
|
|
|
295
|
-
- zh-CN:
|
|
296
|
-
en: "In $1, $2 references the following $3 paths
|
|
322
|
+
- zh-CN: $1中,由$2引用了如下$3个路径
|
|
323
|
+
en: "In $1, $2 references the following $3 paths"
|
|
297
324
|
|
|
298
|
-
- zh-CN:
|
|
299
|
-
en: "Error reading, path
|
|
325
|
+
- zh-CN: 读取出错了,路径
|
|
326
|
+
en: "Error reading, path"
|
|
300
327
|
|
|
301
328
|
- zh-CN: 创建账户
|
|
302
329
|
en: Create account
|
|
@@ -382,8 +409,8 @@
|
|
|
382
409
|
- zh-CN: 已取消
|
|
383
410
|
en: Canceled
|
|
384
411
|
|
|
385
|
-
- zh-CN:
|
|
386
|
-
en:
|
|
412
|
+
- zh-CN: 输入原密码
|
|
413
|
+
en: Enter the original password
|
|
387
414
|
|
|
388
415
|
- zh-CN: 数据过载..
|
|
389
416
|
en: Data overload..
|
|
@@ -463,8 +490,8 @@
|
|
|
463
490
|
- zh-CN: 加载共享路径出错
|
|
464
491
|
en: Error loading shared path
|
|
465
492
|
|
|
466
|
-
- zh-CN:
|
|
467
|
-
en:
|
|
493
|
+
- zh-CN: 内容格式不支持
|
|
494
|
+
en: Content format not supported
|
|
468
495
|
|
|
469
496
|
- zh-CN: 无法存储
|
|
470
497
|
en: Unable to store
|
|
@@ -484,14 +511,14 @@
|
|
|
484
511
|
- zh-CN: 已跳过
|
|
485
512
|
en: Skipped
|
|
486
513
|
|
|
487
|
-
- zh-CN:
|
|
488
|
-
en:
|
|
514
|
+
- zh-CN: 在异步过程中发现未处理的异常
|
|
515
|
+
en: Unhandled exception found during asynchronous process
|
|
489
516
|
|
|
490
517
|
- zh-CN: 颜色数据不正确:$1
|
|
491
518
|
en: "Color data incorrect: $1"
|
|
492
519
|
|
|
493
|
-
- zh-CN:
|
|
494
|
-
en:
|
|
520
|
+
- zh-CN: 请使用https访问如下路径
|
|
521
|
+
en: Please use HTTPS to access the following path
|
|
495
522
|
|
|
496
523
|
- zh-CN: 对象过大,$1未能完成比对
|
|
497
524
|
en: "Object too large, $1 failed to complete comparison"
|
|
@@ -646,8 +673,8 @@
|
|
|
646
673
|
- zh-CN: 父作用域链的长度必须相等着
|
|
647
674
|
en: The length of the parent scope chain must be equal
|
|
648
675
|
|
|
649
|
-
- zh-CN:
|
|
650
|
-
en:
|
|
676
|
+
- zh-CN: 同一个id不能使用两次
|
|
677
|
+
en: The same ID cannot be used twice
|
|
651
678
|
|
|
652
679
|
- zh-CN: 暂不支持在同一元素上使用多次if结构!
|
|
653
680
|
en: We currently do not support using the if structure multiple times on the same element!
|
|
@@ -667,8 +694,8 @@
|
|
|
667
694
|
- zh-CN: 加载$1失败!
|
|
668
695
|
en: Loading $1 failed!
|
|
669
696
|
|
|
670
|
-
- zh-CN:
|
|
671
|
-
en:
|
|
697
|
+
- zh-CN: 编译错误
|
|
698
|
+
en: Compilation error
|
|
672
699
|
|
|
673
700
|
- zh-CN: 请不要重复添加
|
|
674
701
|
en: Please do not add again
|
|
@@ -694,11 +721,11 @@
|
|
|
694
721
|
- zh-CN: 密码不正确!
|
|
695
722
|
en: The password is incorrect!
|
|
696
723
|
|
|
697
|
-
- zh-CN:
|
|
698
|
-
en:
|
|
724
|
+
- zh-CN: 输入新密码
|
|
725
|
+
en: Enter new password
|
|
699
726
|
|
|
700
|
-
- zh-CN:
|
|
701
|
-
en:
|
|
727
|
+
- zh-CN: 确认密码
|
|
728
|
+
en: Confirm password
|
|
702
729
|
|
|
703
730
|
- zh-CN: 两次输入密码不一致
|
|
704
731
|
en: The passwords entered twice are inconsistent
|
|
@@ -730,8 +757,8 @@
|
|
|
730
757
|
- zh-CN: "重复定义: $1"
|
|
731
758
|
en: "Duplicate definition: $1"
|
|
732
759
|
|
|
733
|
-
- zh-CN:
|
|
734
|
-
en:
|
|
760
|
+
- zh-CN: 路径不存在
|
|
761
|
+
en: Path does not exist
|
|
735
762
|
|
|
736
763
|
- zh-CN: 指定的任务 $1 不存在!
|
|
737
764
|
en: The specified task $1 does not exist!
|
|
@@ -751,8 +778,8 @@
|
|
|
751
778
|
- zh-CN: 余集变量不能有默认值
|
|
752
779
|
en: Residual variables cannot have default values
|
|
753
780
|
|
|
754
|
-
- zh-CN:
|
|
755
|
-
en:
|
|
781
|
+
- zh-CN: 辅助级别异常
|
|
782
|
+
en: Auxiliary level exception
|
|
756
783
|
|
|
757
784
|
- zh-CN: 自
|
|
758
785
|
en: since
|
|
@@ -1009,8 +1036,8 @@
|
|
|
1009
1036
|
- zh-CN: 有$1个文件上传失败!
|
|
1010
1037
|
en: $1 file failed to upload!
|
|
1011
1038
|
|
|
1012
|
-
- zh-CN:
|
|
1013
|
-
en:
|
|
1039
|
+
- zh-CN: 读取文件$1出错
|
|
1040
|
+
en: Error reading file $1
|
|
1014
1041
|
|
|
1015
1042
|
- zh-CN: 文件不存在
|
|
1016
1043
|
en: file does not exist
|
|
@@ -1075,8 +1102,8 @@
|
|
|
1075
1102
|
- zh-CN: 不能移入子文件夹
|
|
1076
1103
|
en: Unable to move into sub folder
|
|
1077
1104
|
|
|
1078
|
-
- zh-CN:
|
|
1079
|
-
en:
|
|
1105
|
+
- zh-CN: 请输入新的$1名
|
|
1106
|
+
en: Please enter a new $1 name
|
|
1080
1107
|
|
|
1081
1108
|
- zh-CN: 文件夹
|
|
1082
1109
|
en: Folder
|
|
@@ -1186,8 +1213,8 @@
|
|
|
1186
1213
|
- zh-CN: 更新连接
|
|
1187
1214
|
en: Update Connection
|
|
1188
1215
|
|
|
1189
|
-
- zh-CN: $1
|
|
1190
|
-
en:
|
|
1216
|
+
- zh-CN: $1首次引用点如下
|
|
1217
|
+
en: the first position $1 occurs is
|
|
1191
1218
|
|
|
1192
1219
|
- zh-CN: 与$1相关的项
|
|
1193
1220
|
en: item related to $1
|
|
@@ -1285,8 +1312,8 @@
|
|
|
1285
1312
|
- zh-CN: 正在查找
|
|
1286
1313
|
en: Finding
|
|
1287
1314
|
|
|
1288
|
-
- zh-CN:
|
|
1289
|
-
en:
|
|
1315
|
+
- zh-CN: 路径不正在
|
|
1316
|
+
en: Path not in progress
|
|
1290
1317
|
|
|
1291
1318
|
- zh-CN: "处理完成:$1\r\n => $2"
|
|
1292
1319
|
en: "Processing completed: $1\r\n => $2"
|
|
@@ -1300,8 +1327,8 @@
|
|
|
1300
1327
|
- zh-CN: 无法确定文件名
|
|
1301
1328
|
en: Unable to determine file name
|
|
1302
1329
|
|
|
1303
|
-
- zh-CN:
|
|
1304
|
-
en:
|
|
1330
|
+
- zh-CN: 完成
|
|
1331
|
+
en: Complete
|
|
1305
1332
|
|
|
1306
1333
|
- zh-CN: 服务器忙,请稍后再试!
|
|
1307
1334
|
en: "The server is busy, please try again later!"
|
|
@@ -1369,8 +1396,8 @@
|
|
|
1369
1396
|
- zh-CN: 参数异常!
|
|
1370
1397
|
en: Parameter exception!
|
|
1371
1398
|
|
|
1372
|
-
- zh-CN:
|
|
1373
|
-
en:
|
|
1399
|
+
- zh-CN: range参数错误
|
|
1400
|
+
en: Range parameter error
|
|
1374
1401
|
|
|
1375
1402
|
- zh-CN: each参数异常!
|
|
1376
1403
|
en: Abnormal each parameter!
|
|
@@ -1405,11 +1432,11 @@
|
|
|
1405
1432
|
- zh-CN: 正在合成
|
|
1406
1433
|
en: Synthesizing
|
|
1407
1434
|
|
|
1408
|
-
- zh-CN: 在 $1
|
|
1409
|
-
en:
|
|
1435
|
+
- zh-CN: 在 $1 中检测到可能不存在的外部变量
|
|
1436
|
+
en: Detected external variables that may not exist in $1
|
|
1410
1437
|
|
|
1411
|
-
- zh-CN:
|
|
1412
|
-
en:
|
|
1438
|
+
- zh-CN: 压缩($1/$2)
|
|
1439
|
+
en: Compress ($1/$2)
|
|
1413
1440
|
|
|
1414
1441
|
- zh-CN: 存在环形引用:$1
|
|
1415
1442
|
en: "There is a circular reference: $1"
|
|
@@ -1417,11 +1444,11 @@
|
|
|
1417
1444
|
- zh-CN: 没有可导出的文件!
|
|
1418
1445
|
en: There are no files to export!
|
|
1419
1446
|
|
|
1420
|
-
- zh-CN:
|
|
1421
|
-
en:
|
|
1447
|
+
- zh-CN: 缺少变量
|
|
1448
|
+
en: Missing variable
|
|
1422
1449
|
|
|
1423
|
-
- zh-CN:
|
|
1424
|
-
en:
|
|
1450
|
+
- zh-CN: 缺少常量
|
|
1451
|
+
en: Missing constant
|
|
1425
1452
|
|
|
1426
1453
|
- zh-CN: watch功能在当前操作系统可能无法使用!
|
|
1427
1454
|
en: The watch function may not be available on the current operating system!
|
|
@@ -1555,14 +1582,14 @@
|
|
|
1555
1582
|
- zh-CN: 有测试代码
|
|
1556
1583
|
en: With test code
|
|
1557
1584
|
|
|
1558
|
-
- zh-CN:
|
|
1559
|
-
en:
|
|
1585
|
+
- zh-CN: 环境依赖项
|
|
1586
|
+
en: Environmental dependencies
|
|
1560
1587
|
|
|
1561
1588
|
- zh-CN: 无环境依赖项
|
|
1562
1589
|
en: No environmental dependencies
|
|
1563
1590
|
|
|
1564
|
-
- zh-CN:
|
|
1565
|
-
en:
|
|
1591
|
+
- zh-CN: 导入项
|
|
1592
|
+
en: Import items
|
|
1566
1593
|
|
|
1567
1594
|
- zh-CN: 无导入项
|
|
1568
1595
|
en: No import items
|
|
@@ -1621,8 +1648,8 @@
|
|
|
1621
1648
|
- zh-CN: 序号
|
|
1622
1649
|
en: Number
|
|
1623
1650
|
|
|
1624
|
-
- zh-CN:
|
|
1625
|
-
en:
|
|
1651
|
+
- zh-CN: 翻译结果仅做为参考,未必完美替换,语法参考
|
|
1652
|
+
en: The translation results are only for reference and may not be a perfect replacement. Grammar reference
|
|
1626
1653
|
|
|
1627
1654
|
- zh-CN: 国际化工具仅在浏览器支持 showDirectoryPicker 时可用
|
|
1628
1655
|
en: International chemical tools are only available when the browser supports showDirectoryPicker
|
|
@@ -1633,11 +1660,11 @@
|
|
|
1633
1660
|
- zh-CN: 导出到文件
|
|
1634
1661
|
en: Export to file
|
|
1635
1662
|
|
|
1636
|
-
- zh-CN:
|
|
1637
|
-
en:
|
|
1663
|
+
- zh-CN: 翻译缺失
|
|
1664
|
+
en: Lack of translation
|
|
1638
1665
|
|
|
1639
|
-
- zh-CN:
|
|
1640
|
-
en:
|
|
1666
|
+
- zh-CN: 翻译
|
|
1667
|
+
en: Translation
|
|
1641
1668
|
|
|
1642
1669
|
- zh-CN: "跳过了缺少参数的请求:$1 $2 $3\r\n缺少参数:$4"
|
|
1643
1670
|
en: "Skipped request $1 $2 $3 \r\n Missing parameters $4"
|
|
@@ -1801,8 +1828,8 @@
|
|
|
1801
1828
|
- zh-CN: 帮助
|
|
1802
1829
|
en: HELP
|
|
1803
1830
|
|
|
1804
|
-
- zh-CN: $1
|
|
1805
|
-
en:
|
|
1831
|
+
- zh-CN: $1可以使用的命令语法有
|
|
1832
|
+
en: The command syntax that can be used for $1 is
|
|
1806
1833
|
|
|
1807
1834
|
- zh-CN: 其中
|
|
1808
1835
|
en: among them
|
|
@@ -1819,8 +1846,8 @@
|
|
|
1819
1846
|
- zh-CN: 连接到
|
|
1820
1847
|
en: connection to
|
|
1821
1848
|
|
|
1822
|
-
- zh-CN:
|
|
1823
|
-
en:
|
|
1849
|
+
- zh-CN: 可以使用的命令有
|
|
1850
|
+
en: The commands that can be used are
|
|
1824
1851
|
|
|
1825
1852
|
- zh-CN: 如要显示更具体的信息,请使用:$1
|
|
1826
1853
|
en: "To show more messages, use $1"
|
|
@@ -1864,20 +1891,20 @@
|
|
|
1864
1891
|
- zh-CN: 没有自定义的环境变量
|
|
1865
1892
|
en: No custom environment variables
|
|
1866
1893
|
|
|
1867
|
-
- zh-CN: 已设置如下 $1
|
|
1868
|
-
en:
|
|
1894
|
+
- zh-CN: 已设置如下 $1 个环境变量
|
|
1895
|
+
en: The following $1 environment variables have been set
|
|
1869
1896
|
|
|
1870
|
-
- zh-CN:
|
|
1871
|
-
en:
|
|
1897
|
+
- zh-CN: 未修改过的默认变量如下
|
|
1898
|
+
en: The unmodified default variables are as follows
|
|
1872
1899
|
|
|
1873
|
-
- zh-CN:
|
|
1874
|
-
en:
|
|
1900
|
+
- zh-CN: 其他环境变量如下
|
|
1901
|
+
en: Other environmental variables are as follows
|
|
1875
1902
|
|
|
1876
1903
|
- zh-CN: 不支持该命令<red2> $1 </red2>
|
|
1877
1904
|
en: The command <red2>$1</red2> is not supported
|
|
1878
1905
|
|
|
1879
|
-
- zh-CN:
|
|
1880
|
-
en:
|
|
1906
|
+
- zh-CN: 如下命令与您输入的命令相似
|
|
1907
|
+
en: The following command is similar to the one you entered
|
|
1881
1908
|
|
|
1882
1909
|
- zh-CN: 异常退出
|
|
1883
1910
|
en: Abnormal exit
|
|
@@ -8,8 +8,13 @@ function xto0(x) {
|
|
|
8
8
|
|
|
9
9
|
function parseNumber(str) {
|
|
10
10
|
var s = 10;
|
|
11
|
+
str = str.replace(/\_/g, '');
|
|
11
12
|
if (!isString(str)) return str;
|
|
12
|
-
|
|
13
|
+
var num = str.replace(/^[\+\-]+/, '');
|
|
14
|
+
var neg = str.slice(0, str.length - num.length).replace(/\+/g, '').length & 1;
|
|
15
|
+
if (neg) neg = "-";
|
|
16
|
+
else neg = '';
|
|
17
|
+
switch (num.slice(0, 2).toLowerCase()) {
|
|
13
18
|
case "0x":
|
|
14
19
|
s = 16;
|
|
15
20
|
break;
|
|
@@ -20,15 +25,15 @@ function parseNumber(str) {
|
|
|
20
25
|
s = 2;
|
|
21
26
|
break;
|
|
22
27
|
default:
|
|
23
|
-
return parseFloat(
|
|
28
|
+
return parseFloat(neg + num);
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
if (/x/i.test(
|
|
30
|
+
num = num.slice(2).replace(/\_/g, '');
|
|
31
|
+
if (/x/i.test(num)) {
|
|
27
32
|
return bitTest.bind(null,
|
|
28
|
-
parseInt(
|
|
29
|
-
parseInt(
|
|
33
|
+
parseInt(neg + num.replace(/[\s\S]/g, xto0), 2),
|
|
34
|
+
parseInt(neg + num.replace(/x/g, '0'), 2)
|
|
30
35
|
);
|
|
31
36
|
}
|
|
32
|
-
return parseInt(
|
|
37
|
+
return parseInt(neg + num, s);
|
|
33
38
|
}
|
|
34
39
|
module.exports = parseNumber
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function percent(value, compare_value) {
|
|
2
|
+
if (!isFinite(value)) return value;
|
|
3
|
+
value *= 100;
|
|
4
|
+
var fix = 1000000;
|
|
5
|
+
var flag = value;
|
|
6
|
+
if (flag < 0) flag = -flag;
|
|
7
|
+
if (flag > 100);
|
|
8
|
+
else if (flag > 50) flag = 100 - flag;
|
|
9
|
+
if (isFinite(compare_value) && 100 * compare_value !== value) Math.min(Math.abs(value - compare_value), flag);
|
|
10
|
+
switch (Math.log(flag) | 0) {
|
|
11
|
+
case -Infinity:
|
|
12
|
+
case 2:
|
|
13
|
+
case 3:
|
|
14
|
+
case 4:
|
|
15
|
+
fix = 1; break;
|
|
16
|
+
case 1:
|
|
17
|
+
fix = 10; break;
|
|
18
|
+
case 0:
|
|
19
|
+
fix = 100; break;
|
|
20
|
+
case -1:
|
|
21
|
+
fix = 1000; break;
|
|
22
|
+
case -2:
|
|
23
|
+
fix = 10000; break;
|
|
24
|
+
case -3:
|
|
25
|
+
fix = 100000; break;
|
|
26
|
+
}
|
|
27
|
+
return (value * fix | 0) / fix + "%";
|
|
28
|
+
}
|
package/coms/basic/refilm.js
CHANGED
|
@@ -35,7 +35,10 @@ var writeField = refilm.writeField = function (data, field, value, offset = fiel
|
|
|
35
35
|
var limit = byteLimit;
|
|
36
36
|
while (limit-- > 0) {
|
|
37
37
|
v.push(value & 0xff);
|
|
38
|
-
|
|
38
|
+
if (limit >= 4) {
|
|
39
|
+
value = value / 256;
|
|
40
|
+
}
|
|
41
|
+
else value = value >>> 8;
|
|
39
42
|
}
|
|
40
43
|
if (value) throw new Error(i18n`数据过大`);
|
|
41
44
|
value = v;
|
|
@@ -56,21 +59,37 @@ var writeFields = refilm.writeFields = function (data, fields, values, offset =
|
|
|
56
59
|
};
|
|
57
60
|
var toint = function (buf) {
|
|
58
61
|
var n = 0;
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
if (buf.length >= 7 && (buf[7] || buf[6] > 0x1f)) return buf;
|
|
63
|
+
switch (buf.length) {
|
|
64
|
+
default:
|
|
65
|
+
case 3:
|
|
66
|
+
n |= buf[2] << 16;
|
|
67
|
+
case 2:
|
|
68
|
+
n |= buf[1] << 8;
|
|
69
|
+
case 1:
|
|
70
|
+
n |= buf[0];
|
|
71
|
+
case 0:
|
|
72
|
+
}
|
|
73
|
+
for (var cx = 3, dx = buf.length; cx < dx; cx++) {
|
|
74
|
+
n += buf[cx] * 2 ** (cx << 3);
|
|
61
75
|
}
|
|
62
76
|
return n;
|
|
63
77
|
};
|
|
64
|
-
var
|
|
78
|
+
var readBuffer = refilm.readBuffer = function (data, field, offset = field.offset, size = field.size * field.ratio) {
|
|
65
79
|
return data.slice(offset, offset + size);
|
|
66
80
|
};
|
|
67
81
|
|
|
82
|
+
var readField = refilm.readField = function (data, field, offset, size) {
|
|
83
|
+
var v = readBuffer(data, field, offset, size);
|
|
84
|
+
if (/^([us]?int|byte|word|dword|qword|long)/i.test(field.type)) v = toint(v);
|
|
85
|
+
return v;
|
|
86
|
+
};
|
|
87
|
+
|
|
68
88
|
refilm.readFields = function (data, fields, offset = fields.offset || 0) {
|
|
69
89
|
var res = Object.create(null);
|
|
70
90
|
for (var f of fields) {
|
|
71
91
|
var size = f.size * f.ratio;
|
|
72
92
|
var v = readField(data, f, offset, size);
|
|
73
|
-
if (size <= 4) v = toint(v);
|
|
74
93
|
res[f.key] = v;
|
|
75
94
|
offset += size;
|
|
76
95
|
}
|
|
@@ -338,9 +338,13 @@ function parse(piece) {
|
|
|
338
338
|
[name, key, needs, holder] = spreadkey(name);
|
|
339
339
|
if (key === undefined && !/^(title|label|headline)$/i.test(type)) key = name;
|
|
340
340
|
}
|
|
341
|
-
|
|
341
|
+
var value = /\/?\=([^\/\\]+)/.exec(type);
|
|
342
|
+
if (value) type = type.slice(0, value.index) + type.slice(value.index + value[0].length), value = parseValue(value[1]);
|
|
343
|
+
if (/^[a-z]+(\d+|\d*\/\d+)$/i.test(type)) {
|
|
342
344
|
let [_, t, d] = /^(\w*?)\/?(\d+)$/.exec(type);
|
|
343
|
-
|
|
345
|
+
if (_.length === t.length + d.length) t = _;
|
|
346
|
+
if (d & 0b111 === 0) type = (d >>> 3) + 'byte/' + t;
|
|
347
|
+
else type = d + 'bit/' + t;
|
|
344
348
|
}
|
|
345
349
|
var sizematch = /^(\-?\d+|\-?\d*\.\d+)?([YZEPTGMK]i?b?|bytes?|bits?|words?|dword|real[48]|long|B|[^\/]*)([\/]|$|\s|\=)/i.exec(type);
|
|
346
350
|
if (!sizematch[1] && /^\$\d/.test(sizematch[2])) sizematch = null;
|
|
@@ -6,6 +6,7 @@ var test = function (fields, key, expect) {
|
|
|
6
6
|
if (!valid) console.log(fields)
|
|
7
7
|
};
|
|
8
8
|
test(refilm`启动时间/time $1`, 'key', 'time');
|
|
9
|
+
test(refilm`启动时间/time int64/=1`, 'type', 'int64');
|
|
9
10
|
test(refilm`启动时间/time $1`, 'type', '$1');
|
|
10
11
|
test(refilm`启动时间/time ${test}`, 'key', "time");
|
|
11
12
|
test(refilm`启动时间/time ${test}`, 'type', test);
|
|
@@ -37,6 +37,11 @@ test('${i18n`加载中..`}<div class="loader"></div>');
|
|
|
37
37
|
test('${a +typeof i18n`加载中..`}<div class="loader"></div>', '${a + typeof i18n`加载中..`}<div class="loader"></div>');
|
|
38
38
|
test('${a > 1}');
|
|
39
39
|
test('a>1', 'a > 1');
|
|
40
|
+
test('a<1>>1', 'a < 1 >> 1');
|
|
41
|
+
test('a<b>>1', 'a < b >> 1');
|
|
42
|
+
test('a < b >> 1', '1.type', 8);
|
|
43
|
+
test('a < z >> 1', '2.type', 128);
|
|
44
|
+
test('a<<z>1', 'a << z > 1');
|
|
40
45
|
test(`<meta charset="utf-8" />`);
|
|
41
46
|
test('a><a></a>', 'a > <a></a>');
|
|
42
47
|
test('X', 'X');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var strings = require("../basic/strings");
|
|
3
3
|
var Program = require("./Program");
|
|
4
4
|
var backEach = require("../basic/backEach");
|
|
5
|
-
|
|
5
|
+
var parseNumber = require('../basic/parseNumber');
|
|
6
6
|
const {
|
|
7
7
|
/* 1 */COMMENT,
|
|
8
8
|
/* 2 */SPACE,
|
|
@@ -172,7 +172,9 @@ var fixType = function (o) {
|
|
|
172
172
|
if (last && last.type === EXPRESS && /[^\.]\.$/.test(last.text)) {
|
|
173
173
|
type = EXPRESS;
|
|
174
174
|
}
|
|
175
|
-
else if (isProperty(o))
|
|
175
|
+
else if (isProperty(o)) {
|
|
176
|
+
if (!o.isdigit) type = PROPERTY;
|
|
177
|
+
}
|
|
176
178
|
else if (m === 'from') {
|
|
177
179
|
if (!last || last.type === STRAP && !/^(im|ex)port$/.test(last.text)) {
|
|
178
180
|
type = EXPRESS;
|
|
@@ -621,6 +623,14 @@ function detour(o, ie) {
|
|
|
621
623
|
if (/^0[0-7]+$/.test(o.text)) {
|
|
622
624
|
o.text = '0o' + o.text.slice(1);
|
|
623
625
|
}
|
|
626
|
+
if (o.isprop) {
|
|
627
|
+
if ((o.isdigit)) {
|
|
628
|
+
var value = parseNumber(o.text);
|
|
629
|
+
if (Number.isNaN(value) || value < 0)
|
|
630
|
+
console.warn(i18n`发现异常属性:${`<yellow>${o.text}</yellow>`}`);
|
|
631
|
+
else o.text = String(value);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
624
634
|
break;
|
|
625
635
|
case QUOTED:
|
|
626
636
|
if (o.length) {
|
|
@@ -26,6 +26,9 @@ var testDetour = function (a, e) {
|
|
|
26
26
|
c.break();
|
|
27
27
|
assert(c.toString(), e);
|
|
28
28
|
}
|
|
29
|
+
testDetour('={0x1:1}', '= { 1: 1 }')
|
|
30
|
+
testDetour('={-0x1:1}', '= { -0x1: 1 }')
|
|
31
|
+
testDetour('={false:1}', '= { ["false"]: 1 }')
|
|
29
32
|
testDetour('1.1', '1.1')
|
|
30
33
|
testDetour('1.1.a', '1.1["a"]')
|
|
31
34
|
testDetour('-1e10.a', '-1e10["a"]')
|