|
1 | 1 | import { VariableObject } from "./backend";
|
2 | 2 | import { MINode } from "./mi_parse";
|
3 |
| - |
4 |
| -const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-:]*|\[\d+\])\s*=\s*/; |
| 3 | +const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-:\ \<\>\(\)]*|\[\d+\])\s*=\s*/; |
5 | 4 | const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/;
|
6 | 5 | const errorRegex = /^\<.+?\>/;
|
7 | 6 | const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
|
@@ -113,6 +112,9 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
|
113 | 112 | stack.push("[0]");
|
114 | 113 | let val = parseValue();
|
115 | 114 | stack.pop();
|
| 115 | + if(typeof val == "string" && val.endsWith('>')){ |
| 116 | + val = val.substring(0, val.length - 2); |
| 117 | + } |
116 | 118 | values.push(createValue("[0]", val));
|
117 | 119 | const remaining = value;
|
118 | 120 | let i = 0;
|
@@ -201,13 +203,22 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
|
201 | 203 | };
|
202 | 204 |
|
203 | 205 | parseResult = (pushToStack: boolean = false) => {
|
| 206 | + if (value[0] == '<') { |
| 207 | + value = value.substring(1).trim(); |
| 208 | + } |
204 | 209 | value = value.trim();
|
205 | 210 | value = value.replace(/^static /, "");
|
206 | 211 | const variableMatch = resultRegex.exec(value);
|
207 | 212 | if (!variableMatch)
|
208 | 213 | return undefined;
|
209 | 214 | value = value.substring(variableMatch[0].length).trim();
|
210 |
| - const name = variable = variableMatch[1]; |
| 215 | + let name = variable = variableMatch[1].trim(); |
| 216 | + |
| 217 | + const tmpName = name.split(" "); |
| 218 | + if(tmpName.length > 1 && !name.includes("anonymous union")){ |
| 219 | + name = tmpName[tmpName.length - 1]; |
| 220 | + } |
| 221 | + |
211 | 222 | if (pushToStack)
|
212 | 223 | stack.push(variable);
|
213 | 224 | const val = parseValue();
|
@@ -236,6 +247,17 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
|
236 | 247 | ref = variableCreate(getNamespace(name));
|
237 | 248 | val = "...";
|
238 | 249 | }
|
| 250 | + |
| 251 | + value = value.trim(); |
| 252 | + if (value[0] == ',') |
| 253 | + { |
| 254 | + let tmp = value; |
| 255 | + tmp = tmp.substring(1).trim(); |
| 256 | + if(tmp.startsWith("<No data fields>")){ |
| 257 | + value = tmp = tmp.substring("<No data fields>".length); |
| 258 | + } |
| 259 | + } |
| 260 | + |
239 | 261 | return {
|
240 | 262 | name: name,
|
241 | 263 | value: val,
|
|
0 commit comments