1. 解决 std::regex 解析失败问题
This commit is contained in:
parent
970d339dc8
commit
173b277d42
|
@ -1,7 +1,7 @@
|
||||||
import { MINode } from "./mi_parse";
|
import { MINode } from "./mi_parse";
|
||||||
|
|
||||||
const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-\>\ \<\:\(\)]*|\[\d+\])\s*=\s*/;
|
const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-<> :(),]*|\[\d+\])\s*=\s*/;
|
||||||
const variableRegex = /^[a-zA-Z_\-\'][a-zA-Z0-9_\-\>\ \\\']*/;
|
const variableRegex = /^[a-zA-Z_\-\'\(][a-zA-Z0-9_\-\>\ \\\'\)\:]*/;
|
||||||
const errorRegex = /^\<.+?\>/;
|
const errorRegex = /^\<.+?\>/;
|
||||||
const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
|
const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
|
||||||
const referenceRegex = /^(0x[0-9a-fA-F]+)/;
|
const referenceRegex = /^(0x[0-9a-fA-F]+)/;
|
||||||
|
@ -278,6 +278,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
|
||||||
const variableMatch = resultRegex.exec(value);
|
const variableMatch = resultRegex.exec(value);
|
||||||
if (!variableMatch)
|
if (!variableMatch)
|
||||||
{
|
{
|
||||||
|
logger.debug(`parseResult: match fail, value:${JSON.stringify(value)}`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
value = value.substring(variableMatch[0].length).trim();
|
value = value.substring(variableMatch[0].length).trim();
|
||||||
|
@ -288,7 +289,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
|
||||||
}
|
}
|
||||||
|
|
||||||
let tmpName = name.split(" ");
|
let tmpName = name.split(" ");
|
||||||
if(tmpName.length>1 && !name.includes("anonymous union")){
|
if(tmpName.length>1 && !name.includes("anonymous union") && !name.includes(',')){
|
||||||
name = tmpName[tmpName.length-1];
|
name = tmpName[tmpName.length-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +297,8 @@ export function expandValue(variableCreate: Function, value: string, root: strin
|
||||||
if (pushToStack){
|
if (pushToStack){
|
||||||
stack.push(variable);
|
stack.push(variable);
|
||||||
}
|
}
|
||||||
|
logger.debug(`parseResult: will parseValue, name:${name}, value:${JSON.stringify(value)}`);
|
||||||
|
|
||||||
const val = parseValue();
|
const val = parseValue();
|
||||||
if (pushToStack){
|
if (pushToStack){
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
|
Loading…
Reference in New Issue