[CLUE-Tech] Extracting whole function blocks from multiple files for comparison

Keith Christian keithchristian at yahoo.com
Tue Oct 29 15:47:50 MST 2002


Hi Folks,

I have over 100 server side JavaScript files, some of which may contain
duplicate function definitions.  What I need to do is to find the duplicate
function definitions (no problem, that is solved.)  Then, I need to extract
the whole function block from the source code to infdividual files so that I
compare only the function blocks for differences.

I have done this in the past with VI this way: go to the function's opening
brace, note the line number in VI, then pressing % to match the closing brace,
note the line number, then :50,75w function_foo.txt to write out the function
and compare with DIFF.


So, does anyone know of a tool that, given a filename, will open said file,
locate a function and its opening brace, its closing brace, then write it out?

function foo() {
   var x=5;
   var y=10;
   var bar="Joe's";
   for(x=0;x<=y;x++) {
      Response.write("<br>CLUE-TECH RULES");
      if(x == 6) {
          Response.write("Eat at " + bar);
      }
   }
}

The tool shouldn't get confused and call the closing brace in the FOR loop or
the IF statement the ending brace for FUNCTION FOO(), et cetera.

Any ideas appreciated!

====Keith


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/



More information about the clue-tech mailing list