sub _extract {
my ($funct,$Jscript) = @_;
my ($round,$curly);
$round = qr!\(([^()]*|(??{$round}))*\)!;
$curly = qr!\{([^{}]*|(??{$curly}))*\}!;
if ($Jscript =~ m!($funct\s*$round\s*$curly)!ms) {
print "Matched :\n",$1;
}
}
err, I can't see where you've matched the
function keyword or the
function operator anywhere in your code. That would seem to be a prerequisite to parsing out functions from ECMAScript source.
foo (a, b, c) {
if (c) { a++; } else { b--; }
print "hi";
}
fum (d, e, f, g, h) {
if (d) { e++; } else { f = g + h; }
print "ho";
}
That's not valid EMCAScript.
-David.