Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Rec::Descent Woes - Parsing JavaScript Files and Other Issues

by I0 (Priest)
on Jun 26, 2002 at 23:59 UTC ( #177591=note: print w/ replies, xml ) Need Help??


in reply to Rec::Descent Woes - Parsing JavaScript Files and Other Issues

$_ = join'',<DATA>; (my $re=$_) =~ s/(({)|(})|.)/${['(','']}[!$2]\Q$1\E${[')','']}[!$3]/gs +; $re = join'|',map quotemeta,eval{/$re/}; warn $@ if $@ =~ /unmatched/; print join "\n",/(\bfunction\b[^()]*\([^()]*\)\s*(?:$re))/g,''; __DATA__ function functStart () {}; var g1, g2 = __QUOTE__; var g3 = 10000000; if (g1) { var XXXXXXX = __QUOTE__; } if ( ! defaultCookieCrumbNav ) { cookieCrumbNavBarHTML = __QUOTE__ ; +} else { function funct1 () { }; var xxx = __QUOTE__ ; } if (true == false) { alert(var1); } if (1) { if (1) { function funct2 (X) { x = funct3 (1,2); }; function + funct3 () { alert(1); } } } function funct4 (a,b) { alert (1,2,3,4); return (a + b); } function funct5 () { var aaa = 1; } var g4; var g7 = __QUOTE__; function funct6 () { var b = __REGEX__; c = __REGEX__; if (test333()) + { return true; } } function funct7 () { var a = 111; } alert ( 3 ); funct5 ( funct6 ( funct2 () ) ); function functEnd () {}


Comment on Re: Rec::Descent Woes - Parsing JavaScript Files and Other Issues
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://177591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2015-07-30 04:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls