removing-comments

Best way to automatically remove comments from PHP code

Whats the best way to remove comments from a PHP file? I want to do something similar to strip-whitespace() - but it shouldn't remove the line breaks as well. EG: I want this: <?PHP // something if ($whatsit) { do_something(); # we do something here echo '<html>Some embedded HTML</html>'; } /* another long comment */ some_mo...

Script to remove comments in Java.

Does anyone know how (or process) to remove comments from Java class file at build time? i would like to do this for specific packages in the project when the project is build using Ant. Any ANT scripts or some custom code most welcome. ...

a C++ program to remove comments

Hi, I'm trying to create a program that takes a text file of c++ code and outputs another file with that code, minus any comments that it contains. Assuming that rFile and wFile are defined as follows: ifstream rFile; // File stream object for read only ofstream wFile; // File stream object for write only rFile.open("input.txt", ios:...