|
1 | 1 | import { VariableObject } from "./backend";
|
2 | 2 | import { MINode } from "./mi_parse";
|
3 |
| -const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-:\ \<\>\(\)]*|\[\d+\])\s*=\s*/; |
4 |
| -const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/; |
| 3 | +const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-<> :(),]*|\[\d+\])\s*=\s*/; |
| 4 | +const variableRegex = /^[a-zA-Z_\-\'\(][a-zA-Z0-9_\-\>\ \\\'\)\:]*/; |
5 | 5 | const errorRegex = /^\<.+?\>/;
|
6 | 6 | const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
|
7 | 7 | const referenceRegex = /^0x[0-9a-fA-F]+/;
|
@@ -104,10 +104,11 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
|
104 | 104 | const eqPos = value.indexOf("=");
|
105 | 105 | const newValPos1 = value.indexOf("{");
|
106 | 106 | const newValPos2 = value.indexOf(",");
|
| 107 | + const newValPos3 = value.indexOf("}"); |
107 | 108 | let newValPos = newValPos1;
|
108 | 109 | if (newValPos2 != -1 && newValPos2 < newValPos1)
|
109 | 110 | newValPos = newValPos2;
|
110 |
| - if (newValPos != -1 && eqPos > newValPos || eqPos == -1 || value.startsWith("std::")) { // is value list |
| 111 | + if (newValPos != -1 && eqPos > newValPos || eqPos == -1 || eqPos > newValPos3 || value.startsWith("std::")) { // is value list |
111 | 112 | const values = [];
|
112 | 113 | stack.push("[0]");
|
113 | 114 | let val = parseValue();
|
@@ -209,18 +210,20 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
|
209 | 210 | value = value.trim();
|
210 | 211 | value = value.replace(/^static /, "");
|
211 | 212 | const variableMatch = resultRegex.exec(value);
|
212 |
| - if (!variableMatch) |
| 213 | + if (!variableMatch){ |
213 | 214 | return undefined;
|
| 215 | + } |
214 | 216 | value = value.substring(variableMatch[0].length).trim();
|
215 | 217 | let name = variable = variableMatch[1].trim();
|
216 | 218 |
|
217 | 219 | const tmpName = name.split(" ");
|
218 |
| - if(tmpName.length > 1 && !name.includes("anonymous union")){ |
| 220 | + if(tmpName.length > 1 && !name.includes("anonymous union") && !name.includes(',')){ |
219 | 221 | name = tmpName[tmpName.length - 1];
|
220 | 222 | }
|
221 | 223 |
|
222 | 224 | if (pushToStack)
|
223 | 225 | stack.push(variable);
|
| 226 | + |
224 | 227 | const val = parseValue();
|
225 | 228 | if (pushToStack)
|
226 | 229 | stack.pop();
|
|
0 commit comments