Page 1 of 1

Comment Filterer

Posted: Tue Dec 02, 2003 12:00 am
by mr. xsism
hey, i was bored yesterday and coded this in about 2 hours. Hope you guys find it useful. Tell me what you think? it is ment for single char '\n' terminated comments. So it won't really work for C but it works great with asm and sql code.

<a href="http://www.osdever.net/temp/xsism/remove.zip" target="newwin">Get it here.</a>

i hope this board allows html ;)

RE:Comment Filterer

Posted: Wed Dec 03, 2003 12:00 am
by carbonBased
Why would you want to _remove_ comments?  (I'm simply guessing by the .zip name... I'm at work, and can't download the actual app...)

Unless you're stealing/borrowing/using someone elses code constantly and don't want anyone to know...?

Cheers,
Jeff

RE:Comment Filterer

Posted: Wed Dec 03, 2003 12:00 am
by mr. xsism
oh yeah, that's it, i was stealing some code from like 20 diff people, and they all had different comment methods :P

no

kj and i were actually backing up our mysql DB and there was a problem importing it to a diff version mysql so we had to take out a ton o '#' comments but there was too many. So i made this thing real fast used it and added some functionality after the basic idea worked.

It may come in handy for cutting down on src size if you want a clean, commentless tree? I'm sure there are plenty of uses. Besides, ocde is easier to read when it isn't litered with comments.

mr. xsism

RE:Comment Filterer

Posted: Wed Dec 03, 2003 12:00 am
by carbonBased
Fair enough :)  I've actually had similar issues with my web server not liking mysqldump's -- comments.  However, this is where awk really comes in handy, though...

/^--/ { skip=1}
{
  if(skip == 0) print $0;
  skip = 0
}

That's what I use to remove 'em :)  If you're using a unix system, you should check it out... you can do some pretty trippy stuff in even less time...

Cheers,
Jeff

RE:Comment Filterer

Posted: Wed Dec 03, 2003 12:00 am
by mr. xsism
kool, when i'm in linux next time i'll check it out. I use linux occasionally :)

mr. xsism :D