MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cellTokens

Function cellTokens

graph-ui/src/provider/compact-rows.ts:100–144  ·  view source on GitHub ↗

Quoted @N+ values are literals; retain that distinction until expansion.

(line: string)

Source from the content-addressed store, hash-verified

98
99/** Quoted @N+ values are literals; retain that distinction until expansion. */
100function cellTokens(line: string): { value: string; quoted: boolean }[] {
101 const cells: { value: string; quoted: boolean }[] = [];
102 let i = 0;
103 while (i < line.length) {
104 while (i < line.length && (line[i] === ' ' || line[i] === '\t')) {
105 i += 1;
106 }
107 if (i >= line.length) {
108 break;
109 }
110 if (line[i] === '"') {
111 i += 1;
112 let buf = '';
113 let closed = false;
114 while (i < line.length) {
115 const ch = line[i];
116 if (ch === '\\' && i + 1 < line.length) {
117 buf += line[i + 1];
118 i += 2;
119 continue;
120 }
121 if (ch === '"') {
122 i += 1;
123 closed = true;
124 break;
125 }
126 buf += ch;
127 i += 1;
128 }
129 if (!closed) {
130 throw new Error(
131 `kompakte Zeile hat ein nicht geschlossenes Anfuehrungszeichen: ${line.trim()}`,
132 );
133 }
134 cells.push({ value: buf, quoted: true });
135 continue;
136 }
137 const start = i;
138 while (i < line.length && line[i] !== ' ' && line[i] !== '\t') {
139 i += 1;
140 }
141 cells.push({ value: line.slice(start, i), quoted: false });
142 }
143 return cells;
144}
145
146function unquote(value: string): string {
147 const trimmed = value.trim();

Callers 2

splitCellsFunction · 0.85
collectRowsFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected