MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / skipTrivia

Function skipTrivia

src/resolution/frameworks/drupal.ts:472–486  ·  view source on GitHub ↗

The offset of the next code after `at`: past whitespace and comments.

(s: string, at: number)

Source from the content-addressed store, hash-verified

470
471/** The offset of the next code after `at`: past whitespace and comments. */
472function skipTrivia(s: string, at: number): number {
473 let i = at;
474 for (;;) {
475 while (i < s.length && /\s/.test(s[i]!)) i++;
476 if (s.startsWith('//', i) || (s[i] === '#' && s[i + 1] !== '[')) {
477 const end = s.indexOf('\n', i);
478 if (end < 0) return s.length;
479 i = end;
480 } else if (s.startsWith('/*', i)) {
481 const end = s.indexOf('*/', i);
482 if (end < 0) return s.length;
483 i = end + 2;
484 } else return i;
485 }
486}
487
488/**
489 * Every declaration that carries attributes. Read from the source, not from

Callers 1

attributedDeclarationsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected