in reply to Re: How do I match/extract a function from a JavaScript file?
in thread How do I match/extract a function from a JavaScript file?
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.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; } }
That's not valid EMCAScript.
-David.
|
|---|