ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Moebius <stmoeb...@yahoo.com>
Subject Re: [PATCH] ReplaceRegExp should not append additional newline
Date Fri, 20 Sep 2002 10:49:19 GMT

--- Stefan Bodewig <bodewig@apache.org> wrote:
> On Thu, 19 Sep 2002, Stefan Moebius <stmoebius@yahoo.com> wrote:
> 
> > Ok, I read some documentation on sed and perl. Pretty confusing and
> > somewhat platform dependent.
> 
> Oh, it gets even more confusing as soon as you add Java and the
> different regexp implementations to the mix 8-).  See the notes in
> the manual page for the task we are talking about here.

Towards that end: Why do you want to cater to the specifics and bugs of
each and every regexp implementation? Why not give the user a specified
behavior of what gets passed into the matcher and let the rest be up to
the matcher and the user's regexp?

> > 1. We never want to inadvertently change existing linebreaks.
> 
> I think I agree (bad wording, I know), but the current implementation
> does, it changes lineends to the current platforms style, potentially
> changing them as it goes.
> 
> > 2. In line-mode it is impossible to change linbreaks.
> 
> See above.  If you run the task in line-mode on a file with \r\n
> linebreaks on Unix, you will effectively strip the cariage returns.
> so we don't change where the linebreak occurs, but we may change the
> style of it.  On second thought, this sounds like a bug.
> 
> > Consequences:
> > 2.1 In line-mode one cannot change the number of lines in a file.
> 
> Good goal +1
> 
> > 3. A line is always finally terminated by '\n', i.e. "\r\n\n" are
> > two lines.
> 
> Nope.  No line-feeds at all on a Mac (at least on MacOS 9).

Mmh. That means:
"some text\r\r" - two lines (MAC)
"some text\r\n" - one line  (DOS)
"some text\n\n" - two lines (Unix)

Would you want to 'properly' support files with mixed linebreaks? This
gets a little complicated when empty lines come into play...

Stefan

=====
Stefan Moebius       <stmoebius@yahoo.com> 
  Wurzener Str. 43        +49 351 8475827
  01127 Dresden           +49 172 8739617

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message