You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2001/05/02 01:37:23 UTC

Re: Perl Substitution

>     \l          lowercase next char (think vi)
>     \u          uppercase next char (think vi)
>     \L          lowercase till \E (think vi)
>     \U          uppercase till \E (think vi)
>     \E          end case modification (think vi)
...
>Would there be enough interest for my changes to be added to the source?

I think this came up once before.  Since these are part of Perl's
double-quoted string processing and not its regular expression
handling, it is not currently implemented.  However, I think it
would be entirely appropriate to add them to Perl5Substitution as
a convenience and you should definitely give it a go.  I would
advise against too many other additions requiring more on the
fly parsing/interpreting (not that I can think of any at the moment)
because it is more efficient to implement the Substitution interface and
make it do whatever custom substitution processing you need using Java
code.

daniel



Re: Perl Substitution

Posted by "Mark F. Murphy" <ma...@tyrell.com>.
At 7:37 PM -0400 5/1/01, Daniel F. Savarese wrote:
>I think this came up once before.  Since these are part of Perl's
>double-quoted string processing and not its regular expression
>handling, it is not currently implemented.  However, I think it
>would be entirely appropriate to add them to Perl5Substitution as
>a convenience and you should definitely give it a go.

I already did... and yes... it's in Perl5Substitution.java.

>I would
>advise against too many other additions requiring more on the
>fly parsing/interpreting (not that I can think of any at the moment)
>because it is more efficient to implement the Substitution interface and
>make it do whatever custom substitution processing you need using Java
>code.

I changed the way _parseSubs and _calSubs do a lot of String passing.

Since the original sub string is available... and the match string is 
available, I use offsets and counts into those... and use char 
arrays.  This avoids the multiple copying in the current version.

Basically extending the Vector (subs).

I added some opcodes to the vector which handle offsets to sub 
string, lower/upper case next char, lower/upper case until /E.

Also, now allow backslash for $.

I can't think of anything else the substitution string would really 
need.... but then again... I haven't looked at the latest version of 
perl to see what's been added in that area.

I've looked at the requirements for submitting changes.

Should I post a DIFF here of what I have?

mark

-- 
---------------------------------------------------------------------------
  Mark F. Murphy, Director Software Development   <ma...@tyrell.com>
  Tyrell Software Corp                            <http://www.tyrell.com>
  PowerPerl(tm), Add Power To Your Webpage!       <http://www.powerperl.com>
---------------------------------------------------------------------------
  Families Against Internet Censorship:        http://www.netfamilies.org/