Hi, daniel.
ORO doesn't work correctly when I substitute string into entire
matched pattern.
For example,
-----tmp.pl-----
$a="foo bar hoo";
$a=~s/bar/bar=$&/g;
print $a;
----------------
$ perl tmp.pl
foo bar=bar hoo
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?
regards,
----
Takashi Okamoto
--- Perl5Substitution.java.orig Sun Mar 10 16:57:53 2002
+++ Perl5Substitution.java Sun Mar 10 16:57:08 2002
@@ -246,11 +246,16 @@
__addElement(posParam);
}
continue;
+ } else {
+ if (c == '&') {
+ posParam = 0;
+ current++;
+ }
}
__addElement(posParam);
posParam = 0;
saveDigits = false;
- }
+ }
if ((c != '$' && c != '\\') || escapeMode) {
escapeMode = false;
@@ -278,7 +283,7 @@
// Positional params
if (c == '$') {
- saveDigits = (nextc != '0' && Character.isDigit(nextc));
+ saveDigits = Character.isDigit(nextc) || nextc == '&';
} else if (c == '\\') { // Escape codes
if (nextc == 'l') {
if (!caseMode){
@@ -334,7 +339,7 @@
// If we have a group, set up interpolation, else
// interpret op code.
- if(value > 0 && value < result.groups()) {
+ if(value >= 0 && value < result.groups()) {
int end, len;
offset = result.begin(value);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>