29 lines
583 B
Text
29 lines
583 B
Text
use System.IO.File;
|
|
|
|
class StripComments {
|
|
function : Main(args : String[]) ~ Nil {
|
|
reader : FileReader;
|
|
if(args->Size() = 1) {
|
|
reader := FileReader->New(args[0]);
|
|
line := reader->ReadString();
|
|
while(line <> Nil) {
|
|
index := line->FindLast(';');
|
|
if(index < 0) {
|
|
index := line->FindLast('#');
|
|
};
|
|
|
|
if(index > -1) {
|
|
line->SubString(index)->PrintLine();
|
|
};
|
|
|
|
line := reader->ReadString();
|
|
};
|
|
};
|
|
|
|
leaving {
|
|
if(reader <> Nil) {
|
|
reader->Close();
|
|
};
|
|
};
|
|
}
|
|
}
|