INNER CODE UNIT · JavaScript
analyzeFallback
Fausto-404/js-reverse-automation--skill · js-reverse-automation/scripts/ast_candidate_analyzer.js:96
function analyzeFallback(code, map) {
const patterns = [
/function\s+([A-Za-z_$][\w$]*)\s*\([^)]*\)\s*\{/g,
/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\s*)?\([^)]*\)\s*=>?\s*\{/g,
/([A-Za-z_$][\w$]*)\s*:\s*(?:async\s*)?function\s*\([^)]*\)\s*\{/g
];
for (const pattern of patterns) {
let match;
while ((match = pattern.exec(code)))
addCandidate(map, code, match[1], match.index, Math.min(code.length, match.index + 3000), "fallback-regex");
}
}
function main() {
const opt = args();
const code = fs.readFileSync(opt.input, "utf8");
const map = new Map();