I have a long, complex JS file and, in an attempt to figure out what's going on, I'd like to print out just a list of active function names (by "active" I mean not commented out). In other words, something like the functions popdown menu in BBEdit -- but in an editable text form that I can laser print with lots of space between the function names to draw arrows, scribble notes on, etc. (Actually BBEdit's popdown is better, because it shows nesting through indentation, and in desperation I've resorted to making a screenshot of it and printing that.)
So far I've created three regexps that seem to work, more or less: Find all regular function definitions: function\s?\w+\s?\(.*\) Find all function expressions: (var\s)?.*\s?=\s?function\(.*\) Combine the first two, to find all function declarations of either kind: function\s?\w+\s?\(.*\)|(var\s)?.*\s?=\s?function\(.*\) In case you're wondering, I'm not concerned with anonymous functions in this file. Of course that's pretty limited. In addition to not screening out commented-out functions (I could probably figure out how to do that), it doesn't get me very far -- it doesn't tell me what to _do_ with the found results in order to generate a text list (in a separate file). All it does is find the functions one at a time... I've googled a fair amount, but couldn't find any complete solution for doing this. (Others have asked too -- though not in a BBEdit context -- but I couldn't find anyone who got a real answer.) Rather than use regexps, some people suggested doing it in JavaScript itself, searching for function types or something like that. Can anyone point me in the right direction... Can I build on the regexps I've created so far? What should I be trying next? Thank you. -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
