Re: A task for someone - a comment remover.
Brought to you by:
bs_php,
nigelswinson
From: Tim S. <ti...@di...> - 2002-02-05 10:40:12
|
Hello, Nigel Swinson wrote: > XPath.production.class.php will functionally be the same as XPath.class.php, > but will have ALL the comments removed apart from the copyright and version > header at the top. > > Is there anyone out there who could write this for us? It seems like a > fairly self contained task that wouldn't take too long. You could base it > on the GeneratePhpDocumentation.pl Perl script that ships with the module > perhaps? > > Anyway if there is anyone out there who would like to do this, let us know. this sounded like fun, so I wrote a simple "comment remover" for PHP source code. Tested it on some 50,000 lines of our PHP code and it didn't break anything ... It is written in PHP because I don't like Perl :) The code is intentionally not optimized for efficiency, but for comprehensibility. What do you think about it? I have attached the code to this mail - I hope attachments are OK on this list. Test it like this: php -q commentremover.php yourfile.php > yourfile_nocomments.php Please note that this currently removes ALL comments. Special handling for the copyright + version comments is not implemented yet. I hope this seems useful to you. Regards, Tim -- ------------------------------------------------------- Tim Strehle Development Digital Collections Phone: +49 40 235 35 0 Hammerbrookstr. 93 Fax: +49 40 235 35 180 20097 Hamburg / Germany http://www.digicol.com ------------------------------------------------------- |