提交 31da7dcf 编写于 作者: P pc-ls 提交者: ninecents

LJWT

上级 2092418d
......@@ -98,7 +98,8 @@ export default {
},
winError() {
var objJson = [];
var r = /\/\/ (.*)\n\/\/\n#define (\S+)\s+(\d+)L/g;
// // (.*)\n//\n#define (\S+)\s+(\d+)L/g
var r = /\/\/ (.*)\n\/\/\n#define (\S+)\s+(\d+)L/g;
var a = null;
while ((a = r.exec(this.current.input))) { //循环执行匹配操作
console.log("匹配文本 = " + a[0] + " a.index = " + a.index + " r.lastIndex = " + r.lastIndex); //显示每次匹配后返回的数组信息
......
......@@ -42,12 +42,26 @@ export default {
item.hex = hex;
this.kMaps[k] = item;
this.kMaps[v] = item;
this.kMaps[hex] = item;
});
},
methods: {
handle() {
var item = this.kMaps[this.current.input];
var input = this.current.input.trim();
// 支持后缀H、h、L、l
if (input.endsWith('H') || input.endsWith('h')) {
input = '0x' + input.slice(0, -1);
} else if (input.endsWith('L') || input.endsWith('l')) {
input = input.slice(0, -1);
}
var item = null;
// 不是数字
if (isNaN(Number(input))) {
item = this.kMaps[input];
} else {
// 转为数字,然后转为字符串
item = this.kMaps[Number(input) + ''];
}
console.log(item)
if (item) {
this.current.output = item;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册