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

Method extractTagBased

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

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

()

Source from the content-addressed store, hash-verified

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