Re: [PATCH] substitute with $&, $0

"Daniel F. Savarese" <[email protected]>
Newsgroups gmane.comp.jakarta.oro.devel
Message-ID <[email protected]>
In message <[email protected]>, Takashi Okamoto writ
es:
>I can't obtain above result with oro. I wrote a patch for this
>problem. My patch support '$&' and '$0' for substituting entire
>matched pattern.
>
>Could you take it?

I don't object to including $&, even though it was purposely omitted
(see some a former thread on the subject that I'm not going to track down
right now).  I do have issues with $0 because it no longer means the same
thing as $& in Perl anymore.  However, given that 1. the current
Perl5Substitution behavior is to treat $0 an undefined, and 2. that there
is no sensible Java analog to treating $0 the same as Perl in the context
of a substitution, I see no reason not to apply your patch verbatim, which
I have done.  The patch had a bug right here though:
+	} else {
+	  if (c == '&') {
+	    posParam = 0;
+	    current++;
+	  }
so I changed it, but after some more testing (didn't someone offer to
write some unit tests????) I noticed a subtle bug in the change I made
so I changed it again.  I also added documentation explaining the behavior
of $&, with a warning about $0 and also fixed a couple typos I had left
in the javadocs.

daniel



--
To unsubscribe, e-mail:   <mailto:[email protected]>
For additional commands, e-mail: <mailto:[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.