nofernandes has asked for the wisdom of the Perl Monks concerning the following question:
I need to I make a program which the main objective is to extract the comments on source code in order to see if the programmers did cumply with one of the principles of development of my company! The principle of commented code, for a better understanding of it, for later upgrading or bugs fixing!
In order to do that i must be capable of extracting the comments of any type of source code(PERL, JAVA, PL/SQL, ProC, C++, etc)!! I have tested a Module(Regexp http://search.cpan.org/author/ABIGAIL/Regexp-Common-2.113/lib/Regexp/Common/comment.pm) that is a very nice and helpfull tool for this kind of work!! But the problem is that the regexes donīt preview all the cases!
And this module catches all the above examples!!#This is a comment print "# This is not a comment"; qw/ # Neither is this/ @array= ('#', "or this"); ?#array #or this
Or/* This is a comment*/ /*This is also a comment */
Other idea is to have the following structure:/** This is * a * comment for javadoc! **/
Where the source file is the file to be analyzed, the ParserPl.pl is the file where are the regexes to match the comments and the program.pl is the file to process the results of the parsing...> program.pl source.pl ParserPl.pl
My question is if you have any sugestion to do this kind of program??ex: > program.pl source.c ParserC.pl > program.pl source.java ParserJava.pl > etc...
2003-06-21 edit ybiC: <code> and evidently intended <p> tags
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting Comments
by particle (Vicar) on Jun 18, 2003 at 18:38 UTC | |
|
Re: Extracting Comments
by aquarium (Curate) on Jun 20, 2003 at 08:56 UTC | |
|
Re: Extracting Comments (asked and answered)
by particle (Vicar) on Jun 20, 2003 at 12:53 UTC | |
by aquarium (Curate) on Jun 20, 2003 at 14:17 UTC | |
by particle (Vicar) on Jun 20, 2003 at 14:34 UTC | |
by Anonymous Monk on Jun 20, 2003 at 17:04 UTC | |
by Anonymous Monk on Jun 20, 2003 at 17:38 UTC | |
by particle (Vicar) on Jun 20, 2003 at 17:53 UTC | |
by aquarium (Curate) on Jun 21, 2003 at 00:34 UTC | |
|
Re: Extracting Comments
by castaway (Parson) on Jun 20, 2003 at 12:10 UTC | |
|
Re: Extracting Comments
by zentara (Cardinal) on Jun 19, 2003 at 15:43 UTC | |
|
Re: Extracting Comments
by Lachesis (Friar) on Jun 20, 2003 at 09:38 UTC | |
|
Re: Extracting Comments
by graff (Chancellor) on Jun 21, 2003 at 02:47 UTC | |
|
Re: Extracting Comments
by bdimych (Monk) on Jun 23, 2009 at 16:03 UTC | |
|
Re: Extracting Comments
by ScooterQ (Pilgrim) on Jun 18, 2003 at 18:01 UTC | |
by waswas-fng (Curate) on Jun 18, 2003 at 18:27 UTC |