summaryrefslogtreecommitdiff
path: root/mad
diff options
context:
space:
mode:
authorGerard Goossen <gerard@tty.nl>2007-06-26 22:33:50 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-07-07 08:03:49 +0000
commitb3f5cf18528ca19187726d11aa6582cb64debc65 (patch)
treea4755ba070818fdb6044cadc6217abad0f065728 /mad
parentcbd87e7ef183ffa0dd4ce9a35b2df1221f037667 (diff)
downloadperl-b3f5cf18528ca19187726d11aa6582cb64debc65.tar.gz
p55: correctly translate things like s//$#foo/ge
Message-ID: <20070626183350.GA11336@ostwald> p4raw-id: //depot/perl@31552
Diffstat (limited to 'mad')
-rwxr-xr-xmad/Nomad.pm5
-rw-r--r--mad/P5AST.pm3
-rw-r--r--mad/t/p55.t11
3 files changed, 13 insertions, 6 deletions
diff --git a/mad/Nomad.pm b/mad/Nomad.pm
index 4fdd3a89ee..5ccda4ff90 100755
--- a/mad/Nomad.pm
+++ b/mad/Nomad.pm
@@ -1683,7 +1683,10 @@ sub ast {
if ($rfirst[-1]->uni ne $llast[-1]->uni) {
push @newkids, @rfirst;
}
-
+ # remove the fake '\n' if /e and '#' in replacement.
+ if (@mods and $mods[0] =~ m/e/ and ($self->madness('R'))[0]->uni =~ m/#/) {
+ unshift @rlast, bless {}, 'chomp'; # hack to remove '\n'
+ }
push @newkids, $bits->{repl}, @rlast, @mods;
my $retval = $self->newtype->new(Kids => [@newkids]);
diff --git a/mad/P5AST.pm b/mad/P5AST.pm
index d253c86057..eaf3bd3e20 100644
--- a/mad/P5AST.pm
+++ b/mad/P5AST.pm
@@ -75,6 +75,9 @@ sub p5text {
}
$text .= $newtext;
}
+ elsif ($type eq "chomp") {
+ $text =~ s/\n$//g;
+ }
elsif ($type) {
$text .= $kid->p5text(@_);
}
diff --git a/mad/t/p55.t b/mad/t/p55.t
index ef4c397e3b..f3addd113c 100644
--- a/mad/t/p55.t
+++ b/mad/t/p55.t
@@ -62,8 +62,6 @@ use File::Find;
use Test::Differences;
our %failing = map { $_, 1 } qw|
-../t/op/subst.t
-
../t/comp/require.t
../t/io/layers.t
@@ -83,6 +81,9 @@ our %failing = map { $_, 1 } qw|
../t/op/symbolcache.t
../t/op/threads.t
+
+../t/op/exec.t
+../t/io/say.t
|;
my @files;
@@ -139,13 +140,13 @@ for (my $i=0; $i<3; $i++) { }
########
for (; $a<3; $a++) { }
########
-# TODO
+#
s//$#foo/ge;
########
-# TODO
+#
s//m#.#/ge;
########
-# TODO
+#
eval { require 5.005 }
########
# TODO Reduced test case from t/io/layers.t