I often have a large function to which I add inline comments, but then I can't see the forest for the trees. How can I make a tool that extracts the comments and tokens within them to generate an overview or structured outline of the large complex function? For instance:
BigNastyFunction[input_List, xSpecArg_, ySpecArg_, OptionsPattern[]] :=
Module[
{
(*1:1 Local variables*)
data, ySpecContinousQ, xSpecContinousQ, groupsQ, joinedCounts, colors, ymin, ymax, xmin,
(*1:2 Option variables*)
axesLabelsQ, barOrigin, background, diskSizeScaling, displayFunction, frameQ
}
(*2:1 Check for null Input*)
If[times === {}, Return[$Failed]];
(*2:2:1 Check for groups *)
check1 = Depth[input] === 4;
(*2:2:2 Check for nongroups *)
check2 = Depth[input] === 3;
etc...
Would be transformed into something like:
Outline of BigNastyFunction
Part 1.
.....Step 1. Local variables
.....Step 2. Option variables
Part 2.
.....Step 1. Check for null Input
.....Step 2.
..........a) Check for groups
..........b) Check for nongroups


SetOptions[$FrontEndSession, AutoStyleOptions -> {"CommentStyle" -> {FontColor -> RGBColor[1., 0.5, 0.], ShowAutoStyles -> False, ShowSyntaxStyles -> False, AutoNumberFormatting -> False}} ]– Mr.Wizard♦ Sep 13 '12 at 7:16