MCPcopy Create free account
hub / github.com/Marus/cortex-debug / parsePrimitive

Function parsePrimitive

src/backend/gdb_expansion.ts:158–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156 };
157
158 const parsePrimitive = () => {
159 let primitive: any;
160 let match;
161 value = value.trim();
162 if (value.length === 0) {
163 primitive = undefined;
164 }
165 else if (value.startsWith('true')) {
166 primitive = 'true';
167 value = value.substr(4).trim();
168 }
169 else if (value.startsWith('false')) {
170 primitive = 'false';
171 value = value.substr(5).trim();
172 }
173 else if (match = nullpointerRegex.exec(value)) {
174 primitive = '<nullptr>';
175 value = value.substr(match[0].length).trim();
176 }
177 else if (match = referenceStringRegex.exec(value)) {
178 value = value.substr(match[1].length).trim();
179 primitive = parseCString();
180 }
181 else if (match = referenceRegex.exec(value)) {
182 primitive = '*' + match[0];
183 value = value.substr(match[0].length).trim();
184 }
185 else if (match = charRegex.exec(value)) {
186 primitive = match[1];
187 value = value.substr(match[0].length - 1);
188 primitive += ' ' + parseCString();
189 }
190 else if (match = numberRegex.exec(value)) {
191 primitive = match[0];
192 value = value.substr(match[0].length).trim();
193 }
194 else if (match = variableRegex.exec(value)) {
195 primitive = match[0];
196 value = value.substr(match[0].length).trim();
197 }
198 else if (match = errorRegex.exec(value)) {
199 primitive = match[0];
200 value = value.substr(match[0].length).trim();
201 }
202 else {
203 primitive = value;
204 }
205 return primitive;
206 };
207
208 parseValue = () => {
209 value = value.trim();

Callers 1

expandValueFunction · 0.85

Calls 1

parseCStringFunction · 0.70

Tested by

no test coverage detected