MCPcopy Create free account
hub / github.com/Houseofmvps/codesight / extractBrightScriptFunctions

Function extractBrightScriptFunctions

src/ast/extract-brightscript.ts:63–85  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

61 * inline function expressions (which BrightScript supports inside tables).
62 */
63export function extractBrightScriptFunctions(content: string): ExportItem[] {
64 const exports: ExportItem[] = [];
65 const lines = content.split("\n");
66 const declPattern = /^(function|sub)\s+([A-Za-z_][\w]*)\s*\(([^)]*)\)/i;
67
68 const seen = new Set<string>();
69 for (const line of lines) {
70 const m = line.match(declPattern);
71 if (!m) continue;
72 const kind = m[1].toLowerCase() === "sub" ? "sub" : "function";
73 const name = m[2];
74 const params = m[3].trim();
75 if (seen.has(name)) continue;
76 seen.add(name);
77 exports.push({
78 name,
79 kind: "function",
80 signature: `${kind} ${name}(${params})`,
81 });
82 }
83
84 return exports;
85}
86
87/**
88 * Extract observeField / observeFieldScoped registrations.

Callers 2

detectLibsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected