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

Function mark

src/resolution/cpp-raw-strings.ts:85–99  ·  view source on GitHub ↗
(from: number, to: number)

Source from the content-addressed store, hash-verified

83 };
84 // Mark [from, to) of the text, which may span lines, as raw string contents.
85 const mark = (from: number, to: number): void => {
86 seek(from);
87 let l = line;
88 let start = from - lineStart - (hasCarriageReturns ? carriageReturnsIn(text, lineStart, from) : 0);
89 for (let k = from; ;) {
90 const nl = text.indexOf('\n', k);
91 const end = nl < 0 || nl >= to ? to : nl;
92 const width = end - k - (hasCarriageReturns ? carriageReturnsIn(text, k, end) : 0);
93 if (width > 0) (lines.get(l) ?? lines.set(l, []).get(l)!).push([start, start + width]);
94 if (end === to) break;
95 k = end + 1;
96 l++;
97 start = 0;
98 }
99 };
100 let i = 0;
101 while (i < n) {
102 const c = text.charCodeAt(i);

Callers 1

cppNonCodeLinesFunction · 0.70

Calls 5

seekFunction · 0.85
carriageReturnsInFunction · 0.85
pushMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected