!17 modify codecheck continue

Merge pull request !17 from zhaoxudong/master
This commit is contained in:
openharmony_sig_ci 2022-02-09 09:07:26 +00:00 committed by Gitee
commit cf67cc7146
5 changed files with 53 additions and 68 deletions

View File

@ -52,7 +52,6 @@ function analyzeFile(fn) {
let exportName = re.getReg(data, tt.regs[1])
data = re.removeReg(data, tt.regs[0]);
result.exportDefault.push(exportName)
continue;
}
tt = re.match("(export )*type ([a-zA-Z]+) = ([()a-zA-Z :=>,\"| ]+);", data)
@ -67,7 +66,6 @@ function analyzeFile(fn) {
if (tt.regs[1][0] != -1) {
result.exports.push(exportName)
}
continue;
}
tt = re.match("(export )*type ([a-zA-Z]+) = ({)", data)
@ -82,7 +80,6 @@ function analyzeFile(fn) {
if (tt.regs[1][0] != -1) {
result.exports.push(exportName)
}
continue;
}
tt = re.match("declare namespace ([a-zA-Z0-9]+) ({)", data);
@ -100,7 +97,6 @@ function analyzeFile(fn) {
// zzzz: "zzzz",//this is namespace
body: analyzeNamespace(namespaceData)
})
continue;
}
tt = re.match("(export )*(declare )*interface ([A-Za-z_0-9<>= ]+) (extends [a-zA-Z]+ )*({)", data)
@ -113,7 +109,6 @@ function analyzeFile(fn) {
name: interfaceName,
body: {}
})
continue
}
tt = re.match("declare function ([A-Za-z0-9_]+)\\(([\n a-zA-Z:;=,_0-9?<>{}|]*)\\) *:"
@ -128,7 +123,6 @@ function analyzeFile(fn) {
name: functionName,
body: functionBody
})
continue
}
if (oldData == data) {

View File

@ -46,7 +46,6 @@ function analyzeInterface(data) {//same as class
name: valueName,
type: valueType
})
continue
}
tt = re.match(" *([A-Za-z0-9_]+)\\(([\n a-zA-Z:;=,_0-9?<>{}|]*)\\) *: *([A-Za-z0-9_<>{}:, .]+)", t)
if (tt) {//函数
@ -54,7 +53,6 @@ function analyzeInterface(data) {//same as class
re.getReg(t, tt.regs[2]), re.getReg(t, tt.regs[3]))
if (funcDetail != null)
result.function.push(funcDetail)
continue
}
}
return result

View File

@ -51,7 +51,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(enumName)
}
continue
}
tt = re.match("(export )*const ([a-zA-Z_]+) *[:=]{1} ([a-zA-Z0-9]+);", data)
@ -65,7 +64,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(constName)
}
continue
}
tt = re.match("(export )*interface ([A-Za-z_0-9]+)(<T>)* (extends [a-zA-Z]+ )*({)", data)
@ -83,7 +81,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(interfaceName)
}
continue
}
// tt = re.match("(export )*function
@ -114,7 +111,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(funcName)
}
continue
}
tt = re.match("(export )*type ([a-zA-Z]+) = *([\\(\\):=a-zA-Z<> |\n']+);", data)
@ -128,7 +124,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(typeName)
}
continue
}
tt = re.match("(export )*type ([a-zA-Z]+) = ({)", data)
@ -143,7 +138,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(typeName)
}
continue
}
tt = re.match("(export )*class ([a-zA-Z]+) (extends [a-zA-Z]+ )*(implements [a-zA-Z]+ )*({)", data)
@ -160,7 +154,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(className)
}
continue
}
tt = re.match("(export )*namespace ([a-zA-Z0-9]+) ({)", data)
@ -175,7 +168,6 @@ function analyzeNamespace(data) {
if (tt.regs[1][0] != -1) {
result.exports.push(namespaceName)
}
continue
}
tt = re.match("export { ([a-zA-Z]+) };", data)
@ -183,19 +175,16 @@ function analyzeNamespace(data) {
let exportName = re.getReg(data, tt.regs[1])
result.exports.push(exportName)
data = re.removeReg(data, tt.regs[0])
continue
}
tt = re.match("export import [a-zA-Z]+ = [a-zA-Z\\.]+;", data)
if (tt) {
data = re.removeReg(data, tt.regs[0])
continue
}
tt = re.match("readonly [a-zA-Z]+: [a-z\\[\\]]+;*", data)
if (tt) {
data = re.removeReg(data, tt.regs[0])
continue
}
if (oldData == data) {

View File

@ -61,6 +61,7 @@ function stringToUint8Array(string,
while (pos < len) {
let value = string.charCodeAt(pos++);
let isContinue = false;
if (value >= 0xd800 && value <= 0xdbff) {
// high surrogate
if (pos < len) {
@ -71,37 +72,41 @@ function stringToUint8Array(string,
}
}
if (value >= 0xd800 && value <= 0xdbff) {
continue; // drop lone surrogate
isContinue = true; // drop lone surrogate
}
}
// expand the buffer if we couldn't write 4 bytes
if (at + 4 > target.length) {
tlen += 8; // minimum extra
tlen *= (1.0 + (pos / string.length) * 2); // take 2x the remaining
tlen = (tlen >> 3) << 3; // 8 byte offset
if (!isContinue) {
// expand the buffer if we couldn't write 4 bytes
if (at + 4 > target.length) {
tlen += 8; // minimum extra
tlen *= (1.0 + (pos / string.length) * 2); // take 2x the remaining
tlen = (tlen >> 3) << 3; // 8 byte offset
const update = new Uint8Array(tlen);
update.set(target);
target = update;
}
const update = new Uint8Array(tlen);
update.set(target);
target = update;
}
if ((value & 0xffffff80) === 0) { // 1-byte
target[at++] = value; // ASCII
continue;
} else if ((value & 0xfffff800) === 0) { // 2-byte
target[at++] = ((value >> 6) & 0x1f) | 0xc0;
} else if ((value & 0xffff0000) === 0) { // 3-byte
target[at++] = ((value >> 12) & 0x0f) | 0xe0;
target[at++] = ((value >> 6) & 0x3f) | 0x80;
} else if ((value & 0xffe00000) === 0) { // 4-byte
target[at++] = ((value >> 18) & 0x07) | 0xf0;
target[at++] = ((value >> 12) & 0x3f) | 0x80;
target[at++] = ((value >> 6) & 0x3f) | 0x80;
} else {
continue;
if ((value & 0xffffff80) === 0) { // 1-byte
target[at++] = value; // ASCII
isContinue = true;
} else if ((value & 0xfffff800) === 0) { // 2-byte
target[at++] = ((value >> 6) & 0x1f) | 0xc0;
} else if ((value & 0xffff0000) === 0) { // 3-byte
target[at++] = ((value >> 12) & 0x0f) | 0xe0;
target[at++] = ((value >> 6) & 0x3f) | 0x80;
} else if ((value & 0xffe00000) === 0) { // 4-byte
target[at++] = ((value >> 18) & 0x07) | 0xf0;
target[at++] = ((value >> 12) & 0x3f) | 0x80;
target[at++] = ((value >> 6) & 0x3f) | 0x80;
} else {
isContinue = true;
}
if (!isContinue) {
target[at++] = (value & 0x3f) | 0x80;
}
}
target[at++] = (value & 0x3f) | 0x80;
}
return target.slice(0, at);
}

View File

@ -75,34 +75,33 @@ function checkOutBody(body, off, flag, binside) {
for (let i = off + flag[0].length; i < body.length; i++) {
// print(body[i])
if (body[i] == '"') cs1 += 1
if (cs1 % 2 != 0) continue
// print(i,csl,csr)
let tb1 = true;
for (let k in csl) {
if (csl[k] != csr[idx[k]]) {
tb1 = false;
break;
if (cs1 % 2 == 0) {
// print(i,csl,csr)
let tb1 = true;
for (let k in csl) {
if (csl[k] != csr[idx[k]]) {
tb1 = false;
break;
}
}
}
if (tb1) {
// # print("i=",i,body[i:i + len(flag[1])])
if (body.substring(i, i + flag[1].length) == flag[1]) {
if (binside)
return body.substring(off + flag[0].length, i);
return body.substring(off, i + flag[1].length);
if (tb1) {
// # print("i=",i,body[i:i + len(flag[1])])
if (body.substring(i, i + flag[1].length) == flag[1]) {
if (binside)
return body.substring(off + flag[0].length, i);
return body.substring(off, i + flag[1].length);
}
}
if (body[i] in csl) {
csl[body[i]] += 1;
if (body[i] in csr) csr[body[i]] += 1;
}
if (body[i] in csr) {
csr[body[i]] += 1;
}
}
if (body[i] in csl) {
csl[body[i]] += 1;
if (body[i] in csr) csr[body[i]] += 1;
continue;
}
if (body[i] in csr) {
csr[body[i]] += 1;
continue;
}
}
return null;