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

Method extractTagBased

src/extraction/cfml-extractor.ts:149–182  ·  view source on GitHub ↗

Legacy tag-based CFML: walk ` `/` `, delegating ` ` bodies.

()

Source from the content-addressed store, hash-verified

147
148 /** Legacy tag-based CFML: walk `<cfcomponent>`/`<cffunction>`, delegating `<cfscript>` bodies. */
149 private extractTagBased(): void {
150 const parser = getParser('cfml');
151 if (!parser) {
152 // Same code as TreeSitterExtractor's missing parser, so a grammar that
153 // failed to load is never stored as this file's index data (#2335).
154 this.errors.push({
155 message: 'cfml grammar not loaded',
156 severity: 'error',
157 code: 'parser_error',
158 });
159 return;
160 }
161
162 // Within the file's budget, as every indexing parse (#3274).
163 const budgetMs = indexParseBudgetMs(this.source.length);
164 const tree = parseWithinBudget(parser, this.source, budgetMs);
165 if (!tree) {
166 this.errors.push({
167 message: parseTimeoutMessage(budgetMs),
168 severity: 'error',
169 code: 'parse_error',
170 });
171 return;
172 }
173
174 try {
175 const fileNode = this.createFileNode();
176 this.walkProgram(tree.rootNode, fileNode.id);
177 } finally {
178 // Trees hold wasm heap memory V8's GC never sees — free it per file.
179 tree.delete();
180 }
181 this.extractTagExpressions();
182 }
183
184 /** Build the file's own `kind:'file'` node, spanning the whole source. Tag-based files need this explicitly — unlike `extractBareScript` (which delegates the whole file to `TreeSitterExtractor` and inherits its file node), `extractTagBased` walks the tree itself and has no other source of one. */
185 private createFileNode(): Node {

Callers 1

extractMethod · 0.95

Calls 9

createFileNodeMethod · 0.95
walkProgramMethod · 0.95
extractTagExpressionsMethod · 0.95
getParserFunction · 0.90
indexParseBudgetMsFunction · 0.90
parseWithinBudgetFunction · 0.90
parseTimeoutMessageFunction · 0.90
pushMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected