euglug.org

[Eug-lug] Source Code Processing

작성자

카테고리:



Jason Van CleveWed May 4 11:28:45 PDT 2005

Quoth larry price, on Tue, 3 May 2005 21:59:47 -0700:

> if you want speed try sed(1)

Interesting.  I thought of sed, but I know only the tip of that iceberg,
and I actually presumed that as a general parser, it would be slower
than something like indent.

> s/[\w]*$//g #remove any number of white space characters before end of
> line s/^$//g #remove blank lines

I'll work with that first line, thank you.  It may be the ticket.  The
second line is no good for me, since blank lines are an integral part of
my source code formatting convention.

> although if you are getting fancy you might want to rewrite it in perl
> or $language

Nah, that's just what I don't want to have to do.  My own $language is
actually Java, which would be too slow for this.  I'm weak with C, and I
figure writing this in C would have to be a wheel reinvention.

> (it's also a good idea to make a copy of the target files before you
> munge them so that you can recover from your mistakes while you are
> figuring out your regex)

Thanks, but I didn't need to be told that.  8-)

--Jason

--
User has performed an invalid operation and will be terminated.