MCPcopy Index your code
hub / github.com/nodejs/node / parseProbeTokens

Function parseProbeTokens

lib/internal/debugger/inspect_probe.js:315–446  ·  view source on GitHub ↗
(tokens, args)

Source from the content-addressed store, hash-verified

313}
314
315function parseProbeTokens(tokens, args) {
316 let port = 0;
317 let preview = false;
318 let timeout = kProbeDefaultTimeout;
319 let json = false;
320 let sawSeparator = false;
321 let childStartIndex = args.length;
322 let pendingTarget;
323 let expectedExprIndex = -1;
324 const probes = [];
325
326 for (const token of tokens) {
327 if (token.kind === 'option-terminator') {
328 sawSeparator = true;
329 childStartIndex = token.index + 1;
330 break;
331 }
332
333 if (pendingTarget !== undefined) {
334 if (token.kind === 'option' &&
335 token.name === 'expr' &&
336 token.index === expectedExprIndex &&
337 token.value !== undefined) {
338 ArrayPrototypePush(probes, {
339 expr: token.value,
340 target: pendingTarget,
341 });
342 pendingTarget = undefined;
343 continue;
344 }
345
346 throw new ERR_DEBUGGER_STARTUP_ERROR(
347 'Each --probe must be followed immediately by --expr <expr>');
348 }
349
350 if (token.kind === 'positional') {
351 childStartIndex = token.index;
352 break;
353 }
354
355 switch (token.name) {
356 case 'json':
357 json = true;
358 break;
359 case 'timeout':
360 if (token.value === undefined) {
361 throw new ERR_DEBUGGER_STARTUP_ERROR(`Missing value for ${token.rawName}`);
362 }
363 timeout = parseUnsignedInteger(token.value, 'timeout', true);
364 break;
365 case 'port':
366 if (token.value === undefined) {
367 throw new ERR_DEBUGGER_STARTUP_ERROR(`Missing value for ${token.rawName}`);
368 }
369 port = parseUnsignedInteger(token.value, 'inspector port', true);
370 break;
371 case 'preview':
372 preview = true;

Callers 1

startInspectFunction · 0.85

Calls 2

parseUnsignedIntegerFunction · 0.85
parseProbeTargetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…